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