cuelang / cue

CUE has moved to https://github.com/cue-lang/cue
https://cuelang.org
Apache License 2.0
3.09k stars 171 forks source link

internal/core/eval: value alias does not work with list value #1003

Closed myitcv closed 3 years ago

myitcv commented 3 years ago

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

$ cue version
cue version +37bf801b linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

exec cue export x.cue

-- x.cue --
package x

y: X = [1, 2, X[0]]

What did you expect to see?

{
    "y": [
        1,
        2,
        1
    ]
}

What did you see instead?

y.2: index out of range [0] with length 0:
    ./x.cue:3:17

My understanding from the spec is that this should work, because only the value alias before a list element is not yet implemented: this is before the list itself.

mpvl commented 3 years ago

It is correct that this should be supported. At the present it is not, though.

cueckoo commented 3 years ago

This issue has been migrated to https://github.com/cue-lang/cue/issues/1003.

For more details about CUE's migration to a new home, please see https://github.com/cue-lang/cue/issues/1078.