cuelang.org/go@v0.13.0/cue/testdata/references/optional.txtar (about) 1 -- in.cue -- 2 t1: a: { 3 foo?: int 4 5 b: foo 6 } 7 t2: a: { 8 b: foo 9 10 foo?: int 11 } 12 -- out/eval/stats -- 13 Leaks: 0 14 Freed: 9 15 Reused: 4 16 Allocs: 5 17 Retain: 1 18 19 Unifications: 9 20 Conjuncts: 9 21 Disjuncts: 10 22 -- out/eval -- 23 (struct){ 24 t1: (struct){ 25 a: (struct){ 26 foo?: (int){ int } 27 b: (_|_){ 28 // [incomplete] t1.a.b: cannot reference optional field: foo: 29 // ./in.cue:4:5 30 } 31 } 32 } 33 t2: (struct){ 34 a: (struct){ 35 b: (_|_){ 36 // [incomplete] t2.a.b: cannot reference optional field: foo: 37 // ./in.cue:7:5 38 } 39 foo?: (int){ int } 40 } 41 } 42 } 43 -- out/compile -- 44 --- in.cue 45 { 46 t1: { 47 a: { 48 foo?: int 49 b: 〈0;foo〉 50 } 51 } 52 t2: { 53 a: { 54 b: 〈0;foo〉 55 foo?: int 56 } 57 } 58 }