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

cue: embedded scalar resulting from conditional fails #729

Closed
myitcv opened this issue Feb 5, 2021 · 2 comments
Closed

cue: embedded scalar resulting from conditional fails #729

myitcv opened this issue Feb 5, 2021 · 2 comments

Comments

@myitcv
Copy link
Contributor

myitcv commented Feb 5, 2021

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
@mpvl
Copy link
Contributor

mpvl commented Feb 6, 2021

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.

cueckoo pushed a commit that referenced this issue Feb 7, 2021
A left-over omission to support embedded scalars.

First, treat comprehensions as embedded for scalars.

This also adjust some control flow issues. As we now associate
nodeContext with the node, there is more of a reliance on
states progressing monotonically. So Partial should not be
set too early, nor is this necessary.

Fixes #729
Fixes #739

Change-Id: If283f3ec47532ecac8237c1df1931abb5cbe98a6
cueckoo pushed a commit that referenced this issue Feb 7, 2021
A left-over omission to support embedded scalars.

First, treat comprehensions as embedded for scalars.

This also adjust some control flow issues. As we now associate
nodeContext with the node, there is more of a reliance on
states progressing monotonically. So Partial should not be
set too early, nor is this necessary.

Fixes #729
Fixes #739

Change-Id: If283f3ec47532ecac8237c1df1931abb5cbe98a6
cueckoo pushed a commit that referenced this issue Feb 7, 2021
A left-over omission to support embedded scalars.

First, treat comprehensions as embedded for scalars.

This also adjust some control flow issues. As we now associate
nodeContext with the node, there is more of a reliance on
states progressing monotonically. So Partial should not be
set too early, nor is this necessary.

Fixes #729
Fixes #739

Change-Id: If283f3ec47532ecac8237c1df1931abb5cbe98a6
@cueckoo cueckoo closed this as completed in b25147c Feb 8, 2021
@cueckoo
Copy link

cueckoo commented Jul 3, 2021

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

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.
Projects
None yet
Development

No branches or pull requests

3 participants