cue-lang/cue

spec: optional fields aliases are visible to other fields

nicuveo opened this issue · 1 comments

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

The playground (v0.5.1-0.20230413144408-f681271a38ec and v0.6.0-alpha.1.0.20230428121230-80d6ea032057).

What did you do?

x = a?: 0
b: x

What did you expect to see?

As per https://cuelang.org/docs/references/spec/#aliases:

for optional fields (foo?: bar and [foo]: bar), the bound identifier is only visible within the field value (bar).

I would therefore expect to see b: reference "x" not found.

What did you see instead?

b: a. The alias works just fine. I do not know if that's an error in the implementation or an error in the specification?

myitcv commented

This appears to be a straight bug in the spec. Marking as v0.6.0, because this is a low hanging fruit.