cuelang.org/go@v0.10.1/cue/testdata/disjunctions/errors.txtar (about) 1 -- in.cue -- 2 issue570: { 3 results: #DecodeOutput 4 results: result: "hello" 5 6 #Output: { 7 result: _ 8 } | { 9 error: string 10 } 11 12 #DecodeOutput: #Output & { 13 result?: [... string] 14 ... 15 } 16 } 17 18 issue516: { 19 #Def: { 20 match: metrics: string: {} 21 } | {} 22 23 x: #Def 24 x: match: metrics: "foo": {} 25 } 26 27 // issue #465 28 explicitDefaultError: { 29 a: string | *_|_ 30 31 if a != "" { 32 } 33 } 34 -- out/eval/stats -- 35 Leaks: 0 36 Freed: 40 37 Reused: 32 38 Allocs: 8 39 Retain: 0 40 41 Unifications: 28 42 Conjuncts: 56 43 Disjuncts: 40 44 -- out/evalalpha -- 45 Errors: 46 issue516.x.match: field not allowed: 47 ./in.cue:23:5 48 issue516.x.match.metrics.foo: field not allowed: 49 ./in.cue:23:21 50 issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 51 ./in.cue:3:19 52 ./in.cue:12:12 53 54 Result: 55 (_|_){ 56 // [eval] 57 issue570: (_|_){ 58 // [eval] 59 results: (_|_){ 60 // [eval] issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 61 // ./in.cue:3:19 62 // ./in.cue:12:12 63 result: (string){ "hello" } 64 } 65 #Output: (#struct){ |((#struct){ 66 result: (_){ _ } 67 }, (#struct){ 68 error: (string){ string } 69 }) } 70 #DecodeOutput: (#struct){ |((#struct){ 71 result: (list){ 72 } 73 }, (#struct){ 74 result?: (list){ 75 } 76 error: (string){ string } 77 }) } 78 } 79 issue516: (_|_){ 80 // [eval] 81 #Def: (#struct){ |((#struct){ 82 match: (#struct){ 83 metrics: (#struct){ 84 string: (#struct){ 85 } 86 } 87 } 88 }, (#struct){ 89 }) } 90 x: (_|_){ 91 // [eval] issue516.x.match: field not allowed: 92 // ./in.cue:23:5 93 // issue516.x.match.metrics.foo: field not allowed: 94 // ./in.cue:23:21 95 match: (struct){ 96 metrics: (struct){ 97 foo: (struct){ 98 } 99 } 100 } 101 } 102 } 103 explicitDefaultError: (_|_){ 104 // [incomplete] explicitDefaultError: non-concrete value string in operand to !=: 105 // ./in.cue:30:5 106 // ./in.cue:28:5 107 a: (string){ string } 108 } 109 } 110 -- diff/-out/evalalpha<==>+out/eval -- 111 diff old new 112 --- old 113 +++ new 114 @@ -1,15 +1,9 @@ 115 Errors: 116 -issue516.x: 2 errors in empty disjunction: 117 issue516.x.match: field not allowed: 118 - ./in.cue:20:6 119 - ./in.cue:22:5 120 ./in.cue:23:5 121 issue516.x.match.metrics.foo: field not allowed: 122 - ./in.cue:19:19 123 - ./in.cue:22:5 124 ./in.cue:23:21 125 issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 126 - ./in.cue:2:11 127 ./in.cue:3:19 128 ./in.cue:12:12 129 130 @@ -20,16 +14,9 @@ 131 // [eval] 132 results: (_|_){ 133 // [eval] issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 134 - // ./in.cue:2:11 135 // ./in.cue:3:19 136 // ./in.cue:12:12 137 - result: (_|_){ 138 - // [eval] issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 139 - // ./in.cue:2:11 140 - // ./in.cue:3:19 141 - // ./in.cue:12:12 142 - } 143 - error: (string){ string } 144 + result: (string){ "hello" } 145 } 146 #Output: (#struct){ |((#struct){ 147 result: (_){ _ } 148 @@ -57,20 +44,11 @@ 149 }, (#struct){ 150 }) } 151 x: (_|_){ 152 - // [eval] issue516.x: 2 errors in empty disjunction: 153 - // issue516.x.match: field not allowed: 154 - // ./in.cue:20:6 155 - // ./in.cue:22:5 156 + // [eval] issue516.x.match: field not allowed: 157 // ./in.cue:23:5 158 // issue516.x.match.metrics.foo: field not allowed: 159 - // ./in.cue:19:19 160 - // ./in.cue:22:5 161 // ./in.cue:23:21 162 - match: (_|_){ 163 - // [eval] issue516.x.match: field not allowed: 164 - // ./in.cue:20:6 165 - // ./in.cue:22:5 166 - // ./in.cue:23:5 167 + match: (struct){ 168 metrics: (struct){ 169 foo: (struct){ 170 } 171 -- diff/todo/p1 -- 172 issue570.results.result: Spurious error: field not allowed 173 -- diff/todo/p3 -- 174 Missing empty disjunction message. 175 Missing error positions. 176 -- diff/explanation -- 177 The additional "field not allowed" error is correct and a message corresponding 178 to one of the conjuncts failing. 179 issue516.x.match: changes are okay and arguably better. 180 -- out/eval -- 181 Errors: 182 issue516.x: 2 errors in empty disjunction: 183 issue516.x.match: field not allowed: 184 ./in.cue:20:6 185 ./in.cue:22:5 186 ./in.cue:23:5 187 issue516.x.match.metrics.foo: field not allowed: 188 ./in.cue:19:19 189 ./in.cue:22:5 190 ./in.cue:23:21 191 issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 192 ./in.cue:2:11 193 ./in.cue:3:19 194 ./in.cue:12:12 195 196 Result: 197 (_|_){ 198 // [eval] 199 issue570: (_|_){ 200 // [eval] 201 results: (_|_){ 202 // [eval] issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 203 // ./in.cue:2:11 204 // ./in.cue:3:19 205 // ./in.cue:12:12 206 result: (_|_){ 207 // [eval] issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 208 // ./in.cue:2:11 209 // ./in.cue:3:19 210 // ./in.cue:12:12 211 } 212 error: (string){ string } 213 } 214 #Output: (#struct){ |((#struct){ 215 result: (_){ _ } 216 }, (#struct){ 217 error: (string){ string } 218 }) } 219 #DecodeOutput: (#struct){ |((#struct){ 220 result: (list){ 221 } 222 }, (#struct){ 223 result?: (list){ 224 } 225 error: (string){ string } 226 }) } 227 } 228 issue516: (_|_){ 229 // [eval] 230 #Def: (#struct){ |((#struct){ 231 match: (#struct){ 232 metrics: (#struct){ 233 string: (#struct){ 234 } 235 } 236 } 237 }, (#struct){ 238 }) } 239 x: (_|_){ 240 // [eval] issue516.x: 2 errors in empty disjunction: 241 // issue516.x.match: field not allowed: 242 // ./in.cue:20:6 243 // ./in.cue:22:5 244 // ./in.cue:23:5 245 // issue516.x.match.metrics.foo: field not allowed: 246 // ./in.cue:19:19 247 // ./in.cue:22:5 248 // ./in.cue:23:21 249 match: (_|_){ 250 // [eval] issue516.x.match: field not allowed: 251 // ./in.cue:20:6 252 // ./in.cue:22:5 253 // ./in.cue:23:5 254 metrics: (struct){ 255 foo: (struct){ 256 } 257 } 258 } 259 } 260 } 261 explicitDefaultError: (_|_){ 262 // [incomplete] explicitDefaultError: non-concrete value string in operand to !=: 263 // ./in.cue:30:5 264 // ./in.cue:28:5 265 a: (string){ string } 266 } 267 } 268 -- out/compile -- 269 --- in.cue 270 { 271 issue570: { 272 results: 〈0;#DecodeOutput〉 273 results: { 274 result: "hello" 275 } 276 #Output: ({ 277 result: _ 278 }|{ 279 error: string 280 }) 281 #DecodeOutput: (〈0;#Output〉 & { 282 result?: [ 283 ...string, 284 ] 285 ... 286 }) 287 } 288 issue516: { 289 #Def: ({ 290 match: { 291 metrics: { 292 string: {} 293 } 294 } 295 }|{}) 296 x: 〈0;#Def〉 297 x: { 298 match: { 299 metrics: { 300 foo: {} 301 } 302 } 303 } 304 } 305 explicitDefaultError: { 306 a: (string|*_|_(explicit error (_|_ literal) in source)) 307 if (〈0;a〉 != "") {} 308 } 309 }