Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cue: embedded scalar resulting from conditional fails #729

Closed
cueckoo opened this issue Jul 3, 2021 · 1 comment
Closed

cue: embedded scalar resulting from conditional fails #729

cueckoo opened this issue Jul 3, 2021 · 1 comment

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @myitcv in cuelang/cue#729

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

$ cue version
cue version +fdccfbc5 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

exec cue eval

-- x.cue --
package x

_#cond: true

if _#cond {5}

What did you expect to see?

5

What did you see instead?

[stderr]
conflicting values 5 and {_#cond(:x):true,if _#cond(:x) {5}} (mismatched types int and struct):
    ./x.cue:1:1
    ./x.cue:5:12
@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#729 (comment)

FTR: this works:

_#cond: true

_
if _#cond {5}

But so does this:

{5}

In the spirit of the spec, at least, I would say the latter is correct. So this issue would be correct to call this a bug.

Also FTR: add this test case:

_#cond: true
if _#cond {5}
"v"

It currently crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant