github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/references/value.txtar (about) 1 -- in.cue -- 2 structShorthand: X={b: 3, c: X.b} 3 4 // Note that X and Y are subtly different, as they have different bindings: 5 // one binds to the field, the other to the value. In this case, that does not 6 // make a difference. 7 fieldAndValue: X=foo: Y={3, #sum: X + Y} 8 9 valueCycle: b: X=3 + X 10 11 // Issue #1003 12 listValueAlias: X = [1, 2, X[0]] 13 -- out/eval -- 14 (struct){ 15 structShorthand: (struct){ 16 b: (int){ 3 } 17 c: (int){ 3 } 18 } 19 fieldAndValue: (struct){ 20 foo: (int){ 21 3 22 #sum: (int){ 6 } 23 } 24 } 25 valueCycle: (struct){ 26 b: (_|_){ 27 // [cycle] cycle error: 28 // ./in.cue:8:18 29 } 30 } 31 listValueAlias: (#list){ 32 0: (int){ 1 } 33 1: (int){ 2 } 34 2: (int){ 1 } 35 } 36 } 37 -- out/compile -- 38 --- in.cue 39 { 40 structShorthand: { 41 b: 3 42 c: 〈1〉.b 43 } 44 fieldAndValue: { 45 foo: { 46 3 47 #sum: (〈1;foo〉 + 〈1〉) 48 } 49 } 50 valueCycle: { 51 b: (3 + 〈0〉) 52 } 53 listValueAlias: [ 54 1, 55 2, 56 〈1〉[0], 57 ] 58 }