Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Missed cycle detection #787

Closed
verdverm opened this issue Feb 21, 2021 · 2 comments
Closed

Missed cycle detection #787

verdverm opened this issue Feb 21, 2021 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@verdverm
Copy link
Contributor

What version of CUE are you using (cue version)?

beta.5

Does this issue reproduce with the latest release?

have tried other versions

What did you do?

exec cue eval cycle.cue
-- cycle.cue --
#A: {
        env: [string]: string
        env: FOO: "bar"

        #foo: {
                env: env
                env: OPTION: "true"
        }
}

What did you expect to see?

Error about cyclical value for env: env

What did you see instead?

#A: {
    env: {
        FOO: "bar"
    }
    #foo: {
        env: {
            OPTION: "true"
        }
    }
}

There is also this curious output:

#A: {
        #foo: {
                env: env
        }
}

cue eval results in

#A: {
    #foo: {
        env: _
    }
}
@mpvl
Copy link
Contributor

mpvl commented Feb 21, 2021

It is technically correct cue: env: env logically means env == env, so it's a tautology, but valid. The evaluation indeed is env: _. This is all correct.
The eval correct you show is incorrect (the env field itself is missing), but I'm getting the correct output on my machine.

That said, in reality this is almost never intended, and it should at least be a vet check.
This is a duplicate of #466, btw.

@mpvl mpvl closed this as completed Feb 21, 2021
@mpvl mpvl added duplicate This issue or pull request already exists and removed NeedsInvestigation labels Feb 21, 2021
@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#787.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants