cuelang.org/go@v0.10.1/cue/testdata/definitions/032_definitions_with_embedding.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: definitions with embedding 4 #evalPartial 5 -- in.cue -- 6 #E: { 7 a: {b: int} 8 } 9 10 #S: { 11 #E 12 a: {c: int} 13 b: 3 14 } 15 16 // adding a field to a nested struct that is closed. 17 #e1: #S & {a: d: 4} 18 19 // literal struct not closed until after unification. 20 #v1: #S & {a: c: 4} 21 -- out/def -- 22 #E: { 23 a: { 24 b: int 25 } 26 } 27 #S: { 28 a: { 29 c: int 30 } 31 b: 3 32 #E 33 } 34 35 // adding a field to a nested struct that is closed. 36 #e1: #S & { 37 a: { 38 d: 4 39 } 40 } 41 42 // literal struct not closed until after unification. 43 #v1: #S & { 44 a: { 45 c: 4 46 } 47 } 48 -- out/export -- 49 50 -- out/yaml -- 51 {} 52 -- out/json -- 53 {} 54 -- out/legacy-debug -- 55 <0>{#E: <1>C{a: <2>C{b: int}}, #S: <3>C{a: <4>C{b: int, c: int}, b: 3}, #e1: <5>C{a: _|_(4:field "d" not allowed in closed struct), b: 3}, #v1: <6>C{a: <7>C{b: int, c: 4}, b: 3}} 56 -- out/compile -- 57 --- in.cue 58 { 59 #E: { 60 a: { 61 b: int 62 } 63 } 64 #S: { 65 〈1;#E〉 66 a: { 67 c: int 68 } 69 b: 3 70 } 71 #e1: (〈0;#S〉 & { 72 a: { 73 d: 4 74 } 75 }) 76 #v1: (〈0;#S〉 & { 77 a: { 78 c: 4 79 } 80 }) 81 } 82 -- out/eval/stats -- 83 Leaks: 0 84 Freed: 20 85 Reused: 16 86 Allocs: 4 87 Retain: 0 88 89 Unifications: 20 90 Conjuncts: 36 91 Disjuncts: 20 92 -- out/evalalpha -- 93 Errors: 94 #e1.a.d: field not allowed: 95 ./in.cue:12:15 96 97 Result: 98 (_|_){ 99 // [eval] 100 #E: (#struct){ 101 a: (#struct){ 102 b: (int){ int } 103 } 104 } 105 #S: (#struct){ 106 a: (#struct){ 107 c: (int){ int } 108 b: (int){ int } 109 } 110 b: (int){ 3 } 111 } 112 #e1: (_|_){ 113 // [eval] 114 a: (_|_){ 115 // [eval] 116 d: (_|_){ 117 // [eval] #e1.a.d: field not allowed: 118 // ./in.cue:12:15 119 } 120 c: (int){ int } 121 b: (int){ int } 122 } 123 b: (int){ 3 } 124 } 125 #v1: (#struct){ 126 a: (#struct){ 127 c: (int){ 4 } 128 b: (int){ int } 129 } 130 b: (int){ 3 } 131 } 132 } 133 -- diff/-out/evalalpha<==>+out/eval -- 134 diff old new 135 --- old 136 +++ new 137 @@ -1,9 +1,5 @@ 138 Errors: 139 #e1.a.d: field not allowed: 140 - ./in.cue:2:5 141 - ./in.cue:6:2 142 - ./in.cue:7:5 143 - ./in.cue:12:6 144 ./in.cue:12:15 145 146 Result: 147 @@ -16,8 +12,8 @@ 148 } 149 #S: (#struct){ 150 a: (#struct){ 151 - b: (int){ int } 152 - c: (int){ int } 153 + c: (int){ int } 154 + b: (int){ int } 155 } 156 b: (int){ 3 } 157 } 158 @@ -25,23 +21,19 @@ 159 // [eval] 160 a: (_|_){ 161 // [eval] 162 - b: (int){ int } 163 - c: (int){ int } 164 d: (_|_){ 165 // [eval] #e1.a.d: field not allowed: 166 - // ./in.cue:2:5 167 - // ./in.cue:6:2 168 - // ./in.cue:7:5 169 - // ./in.cue:12:6 170 // ./in.cue:12:15 171 } 172 + c: (int){ int } 173 + b: (int){ int } 174 } 175 b: (int){ 3 } 176 } 177 #v1: (#struct){ 178 a: (#struct){ 179 - b: (int){ int } 180 c: (int){ 4 } 181 + b: (int){ int } 182 } 183 b: (int){ 3 } 184 } 185 -- diff/todo/p2 -- 186 Reordering / missing positions. 187 -- out/eval -- 188 Errors: 189 #e1.a.d: field not allowed: 190 ./in.cue:2:5 191 ./in.cue:6:2 192 ./in.cue:7:5 193 ./in.cue:12:6 194 ./in.cue:12:15 195 196 Result: 197 (_|_){ 198 // [eval] 199 #E: (#struct){ 200 a: (#struct){ 201 b: (int){ int } 202 } 203 } 204 #S: (#struct){ 205 a: (#struct){ 206 b: (int){ int } 207 c: (int){ int } 208 } 209 b: (int){ 3 } 210 } 211 #e1: (_|_){ 212 // [eval] 213 a: (_|_){ 214 // [eval] 215 b: (int){ int } 216 c: (int){ int } 217 d: (_|_){ 218 // [eval] #e1.a.d: field not allowed: 219 // ./in.cue:2:5 220 // ./in.cue:6:2 221 // ./in.cue:7:5 222 // ./in.cue:12:6 223 // ./in.cue:12:15 224 } 225 } 226 b: (int){ 3 } 227 } 228 #v1: (#struct){ 229 a: (#struct){ 230 b: (int){ int } 231 c: (int){ 4 } 232 } 233 b: (int){ 3 } 234 } 235 }