cuelang.org/go@v0.13.0/cue/testdata/resolve/027_new-style_definitions.txtar (about) 1 #name: new-style definitions 2 #evalPartial 3 -- in.cue -- 4 #Foo: { 5 a: 1 6 b: int 7 } 8 "#Foo": #Foo & {b: 1} 9 10 bulk: {[string]: string} & { 11 #def: 4 // Different namespace, so bulk option does not apply. 12 _hid: 3 13 a: "foo" 14 } 15 -- out/def -- 16 "#Foo": #Foo & { 17 b: 1 18 } 19 #Foo: { 20 a: 1 21 b: int 22 } 23 bulk: { 24 {[string]: string} 25 a: "foo" 26 #def: 4 27 _hid: 3 28 } 29 -- out/export -- 30 "#Foo": { 31 a: 1 32 b: 1 33 } 34 bulk: { 35 a: "foo" 36 } 37 -- out/yaml -- 38 '#Foo': 39 a: 1 40 b: 1 41 bulk: 42 a: foo 43 -- out/json -- 44 {"#Foo":{"a":1,"b":1},"bulk":{"a":"foo"}} 45 -- out/legacy-debug -- 46 <0>{"#Foo": <1>C{a: 1, b: 1}, #Foo: <2>C{a: 1, b: int}, bulk: <3>{[]: <4>(_: string)->string, a: "foo", #def: 4, _hid: 3}} 47 -- out/compile -- 48 --- in.cue 49 { 50 #Foo: { 51 a: 1 52 b: int 53 } 54 "#Foo": (〈0;#Foo〉 & { 55 b: 1 56 }) 57 bulk: ({ 58 [string]: string 59 } & { 60 #def: 4 61 _hid: 3 62 a: "foo" 63 }) 64 } 65 -- out/eval/stats -- 66 Leaks: 0 67 Freed: 11 68 Reused: 8 69 Allocs: 3 70 Retain: 0 71 72 Unifications: 11 73 Conjuncts: 16 74 Disjuncts: 11 75 -- out/evalalpha -- 76 (struct){ 77 #Foo: (#struct){ 78 a: (int){ 1 } 79 b: (int){ int } 80 } 81 "#Foo": (#struct){ 82 b: (int){ 1 } 83 a: (int){ 1 } 84 } 85 bulk: (struct){ 86 #def: (int){ 4 } 87 _hid: (int){ 3 } 88 a: (string){ "foo" } 89 } 90 } 91 -- diff/-out/evalalpha<==>+out/eval -- 92 diff old new 93 --- old 94 +++ new 95 @@ -4,8 +4,8 @@ 96 b: (int){ int } 97 } 98 "#Foo": (#struct){ 99 - a: (int){ 1 } 100 b: (int){ 1 } 101 + a: (int){ 1 } 102 } 103 bulk: (struct){ 104 #def: (int){ 4 } 105 -- diff/todo/p3 -- 106 Reordering 107 -- out/eval -- 108 (struct){ 109 #Foo: (#struct){ 110 a: (int){ 1 } 111 b: (int){ int } 112 } 113 "#Foo": (#struct){ 114 a: (int){ 1 } 115 b: (int){ 1 } 116 } 117 bulk: (struct){ 118 #def: (int){ 4 } 119 _hid: (int){ 3 } 120 a: (string){ "foo" } 121 } 122 }