cue icon indicating copy to clipboard operation
cue copied to clipboard

syntax: selector with string literal doesn't support interpolation

Open rogpeppe opened this issue 3 years ago • 0 comments

commit 00c5ddf5e4ed1781cbf07b9b941a1c7c36a62d87

The spec says of selectors that the field selector "must be an identifier or a string literal identifying any definition or regular non-optional field".

A string literal containing an interpolation is still a string literal, so I'd expect that to work, but it doesn't.

Here's a testscript reproducer:

exec cue export x.cue
cmp stdout expect.json

-- x.cue --
x: a: 10
y: x."\("a")"
-- expect.json --
{
    "x": {
        "a": 10
    },
    "y": 10
}

I see this error:

expected selector, found 'INTERPOLATION' "\(:
    ./x.cue:2:6

but I'd expect to see the output in the expect.json file above.

rogpeppe avatar Apr 28 '22 15:04 rogpeppe