Skip to content

evaluator: aliases not tolerated on top level of list items #2194

@seh

Description

@seh

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

v0.5.0-beta.2.0.20221216062120-45aa5c093e71

Does this issue reproduce with the latest release?

Version 0.4.3 behaves the same way.

What did you do?

Attempt to use an alias on a struct value, so as to refer to sibling fields within the struct using the alias. In this example, we wish for our "together" field to refer to the sibling "_suffix" field that's introduced by way of unification.

let prelude = {
    _suffix: "art"
}

outside: V=(prelude & {
    together: "st\(V._suffix)"
})

inside: [
    V=(prelude & {
        together: "st\(V._suffix)"
    })
]

This example is available in the CUE Playground.

Note that the top-level "outside" field's value works as expected: it winds up with the following value:

{
  "together": "start"
}

However, the "inside" field's value is a list, and when we attempt to use the same expression to define the first item in the list, CUE rejects our attempted use of the the alias, reporting the following complaint:

inside: alias values not allowed in this position:
-:10:5

What did you expect to see?

CUE should export the following struct:

outside: {
	together: "start"
}
inside: [{
	together: "start"
}]

What did you see instead?

CUE refuses to evaluate the source code, complaining about the alias inside the list literal:

inside: alias values not allowed in this position:
-:10:5

Metadata

Metadata

Assignees

Labels

NeedsFixspec-deviationBugs where the implementation does not follow the spec.

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions