...

Text file src/cuelang.org/go/internal/core/export/testdata/selfcontained/ref.txtar

Documentation: cuelang.org/go/internal/core/export/testdata/selfcontained

     1#path: a.b
     2
     3TODO: some alternative behaviors to consider here:
     4- inline small values, even in expressions.
     5- fail if hoisting results in an impossible expression,
     6  such as: `foo[string]` or `{}.foo`.
     7- evaluate expressions to completion, if possible.
     8
     9-- in.cue --
    10x: map: {foo: int}
    11y: z: map: {bar: int}
    12
    13incomplete1: string
    14incomplete2: string
    15completeExist: "foo"
    16completeNotExist: "bar"
    17
    18a: b: {
    19	ref1: x.map
    20	ref2: x.map.foo
    21	ref3: x.map[incomplete1]      // always an error
    22	ref4: x.map[completeExist]    // can be simplified
    23	ref5: x.map[completeNotExist] // always an error
    24
    25	ref6: y.z.map[incomplete2] // inline the single-use map.
    26}
    27-- out/default --
    28ref1: MAP
    29ref2: MAP.foo
    30ref3: MAP[INCOMPLETE1]
    31ref4: MAP.foo
    32ref5: MAP["bar"]
    33ref6: MAP_1[INCOMPLETE2]
    34
    35//cue:path: x.map
    36let MAP = {
    37	foo: int
    38}
    39
    40//cue:path: incomplete1
    41let INCOMPLETE1 = string
    42
    43//cue:path: y.z.map
    44let MAP_1 = {
    45	bar: int
    46}
    47
    48//cue:path: incomplete2
    49let INCOMPLETE2 = string

View as plain text