You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect out.in to be "explicit", not "default". It starts working if you simplify the definitions a bit, such as making the second definition a string rather than a struct: https://cuelang.org/play/?id=wp1TUDMikIK#cue@export@json
At least this is not a recent regression; I see the same behavior with v0.4.3.
mvdan
changed the title
Values aren't passed to list comprehensions correctly
disjunction with default value behind two definitions doesn't work as expected
May 31, 2023
I completely missed that you were using #Other & {name: name}. Note that the second name refers to the name: field in the same line, not the original one near the top at #Main.name. Similar to Go, you are shadowing the original name declaration with another one.
An alternative would be to try to avoid repeating field names in types which will be nested like this, to prevent issues with shadowing.
#466 tracks doing something to warn about this kind of shadowing. It almost never makes sense to declare a field like foo: foo, especially not if the parent scope already has a foo that the user likely meant to reference.
What version of CUE are you using (
cue version
)?Also happens when built from HEAD.
Does this issue reproduce with the latest stable release?
Yes.
What did you do?
https://cuelang.org/play/?id=Sgruw0xqHao#cue@export@json
What did you expect to see?
What did you see instead?
Strangely, this issue is resolved if an alias is used...
https://cuelang.org/play/?id=J3sMaBR5eJ2#cue@export@json
The text was updated successfully, but these errors were encountered: