cuelang.org/go@v0.13.0/cue/testdata/resolve/009_optional_field_unification.txtar (about) 1 #name: optional field unification 2 #evalPartial 3 -- in.cue -- 4 a: {foo?: string} 5 b: {foo: "foo"} 6 c: a & b 7 d: a & {"foo"?: "bar"} 8 9 g1: 1 10 "g\(1)"?: 1 11 "g\(2)"?: 2 12 -- out/def -- 13 a: { 14 foo?: string 15 } 16 b: { 17 foo: "foo" 18 } 19 c: a & b 20 d: a & { 21 foo?: "bar" 22 } 23 g1: 1 24 g2?: 2 25 -- out/export -- 26 a: {} 27 b: { 28 foo: "foo" 29 } 30 c: { 31 foo: "foo" 32 } 33 d: {} 34 g1: 1 35 -- out/yaml -- 36 a: {} 37 b: 38 foo: foo 39 c: 40 foo: foo 41 d: {} 42 g1: 1 43 -- out/json -- 44 {"a":{},"b":{"foo":"foo"},"c":{"foo":"foo"},"d":{},"g1":1} 45 -- out/legacy-debug -- 46 <0>{a: <1>{foo?: string}, b: <2>{foo: "foo"}, c: <3>{foo: "foo"}, d: <4>{foo?: "bar"}, g1: 1, g2?: 2} 47 -- out/compile -- 48 --- in.cue 49 { 50 a: { 51 foo?: string 52 } 53 b: { 54 foo: "foo" 55 } 56 c: (〈0;a〉 & 〈0;b〉) 57 d: (〈0;a〉 & { 58 foo?: "bar" 59 }) 60 g1: 1 61 "g\(1)"?: 1 62 "g\(2)"?: 2 63 } 64 -- out/eval/stats -- 65 Leaks: 0 66 Freed: 11 67 Reused: 8 68 Allocs: 3 69 Retain: 0 70 71 Unifications: 11 72 Conjuncts: 19 73 Disjuncts: 11 74 -- out/eval -- 75 (struct){ 76 a: (struct){ 77 foo?: (string){ string } 78 } 79 b: (struct){ 80 foo: (string){ "foo" } 81 } 82 c: (struct){ 83 foo: (string){ "foo" } 84 } 85 d: (struct){ 86 foo?: (string){ "bar" } 87 } 88 g1: (int){ 1 } 89 g2?: (int){ 2 } 90 }