cuelang.org/go@v0.10.1/internal/core/export/testdata/selfcontained/ref.txtar (about) 1 #path: a.b 2 3 TODO: 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 -- 10 x: map: {foo: int} 11 y: z: map: {bar: int} 12 13 incomplete1: string 14 incomplete2: string 15 completeExist: "foo" 16 completeNotExist: "bar" 17 18 a: 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/self/default -- 28 ref1: MAP 29 ref2: MAP.foo 30 ref3: MAP[INCOMPLETE1] 31 ref4: MAP.foo 32 ref5: MAP["bar"] 33 ref6: MAP_1[INCOMPLETE2] 34 35 //cue:path: x.map 36 let MAP = { 37 foo: int 38 } 39 40 //cue:path: incomplete1 41 let INCOMPLETE1 = string 42 43 //cue:path: y.z.map 44 let MAP_1 = { 45 bar: int 46 } 47 48 //cue:path: incomplete2 49 let INCOMPLETE2 = string