Skip to content

evalv3: another "undefined field" regression #3699

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

Closed
mvdan opened this issue Jan 24, 2025 · 2 comments
Closed

evalv3: another "undefined field" regression #3699

mvdan opened this issue Jan 24, 2025 · 2 comments
Labels
evaluator evalv3 issues affecting only the evaluator version 3 unity-win bugs found thanks to projects added to Unity

Comments

@mvdan
Copy link
Member

mvdan commented Jan 24, 2025

# With the old evaluator.
env CUE_EXPERIMENT=evalv3=0
exec cue export

# With the new evaluator.
env CUE_EXPERIMENT=evalv3=1
exec cue export

-- input.cue --
package p

_res: {
	_fooTrue: {} | *{foo: true}
	_msgSwitch: [
		if _fooTrue.foo { msg: "foo" },
		{ msg: "bar" },
	][0]
	out: _msgSwitch.msg
}
let res = {
	out: (_res & {}).out
}
out: res.out

As of f53f655:

# With the old evaluator. (0.010s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue export
[stdout]
{
    "out": "foo"
}
# With the new evaluator. (0.038s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue export
[stderr]
res.out: undefined field: msg:
    ./input.cue:9:18
[exit status 1]
@mvdan mvdan added evaluator evalv3 issues affecting only the evaluator version 3 labels Jan 24, 2025
@mpvl
Copy link
Member

mpvl commented Jan 24, 2025

I think this is the core of the issue:

y: { if x.z { 1 } }
x: *{z: true} | {}

@myitcv
Copy link
Member

myitcv commented Jan 28, 2025

I think this is the core of the issue:

My understanding is that your reproduction is equivalent to:

if x.z {
	y: 1
}
x: *{z: true} | {}

Is this analogous to the following?

if x+1 == 1 {
	y: 1
}
x: *0 | "dummy"

cueckoo pushed a commit that referenced this issue Jan 28, 2025
Issue #3699

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I60360cbf702230e8d03a1675e02a2592336fddec
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207909
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Matthew Sackman <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
@mvdan mvdan added the unity-win bugs found thanks to projects added to Unity label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluator evalv3 issues affecting only the evaluator version 3 unity-win bugs found thanks to projects added to Unity
Projects
None yet
Development

No branches or pull requests

3 participants