this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: add test for evalv3 panic

This was a panic from Unity that is resolved
by the new closedness implementation.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ibba0a9b5dbd260570c8989fd4c0e0cd560242985
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1210974
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+151 -6
+151 -6
cue/testdata/disjunctions/edge.txtar
··· 76 76 y: 1 | {y: 1} 77 77 y 78 78 } 79 + -- panic.cue -- 80 + // This used to cause a panic with evalv3. 81 + panic1: { 82 + #TypeFoo: { 83 + name: "foo" 84 + // Make foo_field here optional and master panics too! 85 + foo_field: string 86 + } 87 + #TypeBar: { 88 + #TypeBar2 89 + bar_field?: string 90 + } 91 + 92 + #TypeBar2: name: "bar" 93 + 94 + objs: obj1: { 95 + type: #TypeFoo | #TypeBar 96 + type: *objs["missing"] | #TypeFoo | #TypeBar 97 + } 98 + 99 + out: #TypeFoo | #TypeBar 100 + out: objs["obj1"].type 101 + } 79 102 -- out/eval/stats -- 80 103 Leaks: 0 81 - Freed: 73 82 - Reused: 62 104 + Freed: 152 105 + Reused: 141 83 106 Allocs: 11 84 - Retain: 11 107 + Retain: 12 85 108 86 - Unifications: 49 87 - Conjuncts: 105 88 - Disjuncts: 74 109 + Unifications: 108 110 + Conjuncts: 237 111 + Disjuncts: 154 89 112 -- out/eval -- 90 113 (struct){ 91 114 cyclicalInsertInDisjunction: (struct){ ··· 160 183 }) } 161 184 } 162 185 } 186 + panic1: (struct){ 187 + #TypeFoo: (#struct){ 188 + name: (string){ "foo" } 189 + foo_field: (string){ string } 190 + } 191 + #TypeBar: (#struct){ 192 + name: (string){ "bar" } 193 + bar_field?: (string){ string } 194 + } 195 + #TypeBar2: (#struct){ 196 + name: (string){ "bar" } 197 + } 198 + objs: (struct){ 199 + obj1: (struct){ 200 + type: (#struct){ |((#struct){ 201 + name: (string){ "foo" } 202 + foo_field: (string){ string } 203 + }, (#struct){ 204 + name: (string){ "bar" } 205 + bar_field?: (string){ string } 206 + }) } 207 + } 208 + } 209 + out: (#struct){ |((#struct){ 210 + name: (string){ "foo" } 211 + foo_field: (string){ string } 212 + }, (#struct){ 213 + name: (string){ "bar" } 214 + bar_field?: (string){ string } 215 + }) } 216 + } 163 217 } 164 218 -- out/evalalpha -- 165 219 (struct){ ··· 227 281 y: (int){ 1 } 228 282 } 229 283 } 284 + panic1: (struct){ 285 + #TypeFoo: (#struct){ 286 + name: (string){ "foo" } 287 + foo_field: (string){ string } 288 + } 289 + #TypeBar: (#struct){ 290 + bar_field?: (string){ string } 291 + name: (string){ "bar" } 292 + } 293 + #TypeBar2: (#struct){ 294 + name: (string){ "bar" } 295 + } 296 + objs: (struct){ 297 + obj1: (struct){ 298 + type: (struct){ |((#struct){ 299 + name: (string){ "foo" } 300 + foo_field: (string){ string } 301 + }, (#struct){ 302 + bar_field?: (string){ string } 303 + name: (string){ "bar" } 304 + }) } 305 + } 306 + } 307 + out: (struct){ |((#struct){ 308 + name: (string){ "foo" } 309 + foo_field: (string){ string } 310 + }, (#struct){ 311 + bar_field?: (string){ string } 312 + name: (string){ "bar" } 313 + }) } 314 + } 230 315 } 231 316 -- diff/-out/evalalpha<==>+out/eval -- 232 317 diff old new ··· 259 344 + y: (int){ 1 } 260 345 } 261 346 } 347 + panic1: (struct){ 348 + @@ -77,8 +69,8 @@ 349 + foo_field: (string){ string } 350 + } 351 + #TypeBar: (#struct){ 352 + - name: (string){ "bar" } 353 + bar_field?: (string){ string } 354 + + name: (string){ "bar" } 355 + } 356 + #TypeBar2: (#struct){ 357 + name: (string){ "bar" } 358 + @@ -85,21 +77,21 @@ 359 + } 360 + objs: (struct){ 361 + obj1: (struct){ 362 + - type: (#struct){ |((#struct){ 363 + + type: (struct){ |((#struct){ 364 + name: (string){ "foo" } 365 + foo_field: (string){ string } 366 + }, (#struct){ 367 + - name: (string){ "bar" } 368 + bar_field?: (string){ string } 369 + + name: (string){ "bar" } 370 + }) } 371 + } 372 + } 373 + - out: (#struct){ |((#struct){ 374 + + out: (struct){ |((#struct){ 375 + name: (string){ "foo" } 376 + foo_field: (string){ string } 377 + }, (#struct){ 378 + - name: (string){ "bar" } 379 + bar_field?: (string){ string } 380 + + name: (string){ "bar" } 381 + }) } 382 + } 262 383 } 263 384 -- diff/todo/p2 -- 264 385 cyclicalInsertInDisjunction.maybe: discrepancy may be okay ··· 366 487 } 367 488 } 368 489 } 490 + --- panic.cue 491 + { 492 + panic1: { 493 + #TypeFoo: { 494 + name: "foo" 495 + foo_field: string 496 + } 497 + #TypeBar: { 498 + 〈1;#TypeBar2〉 499 + bar_field?: string 500 + } 501 + #TypeBar2: { 502 + name: "bar" 503 + } 504 + objs: { 505 + obj1: { 506 + type: (〈2;#TypeFoo〉|〈2;#TypeBar〉) 507 + type: (*〈2;objs〉["missing"]|〈2;#TypeFoo〉|〈2;#TypeBar〉) 508 + } 509 + } 510 + out: (〈0;#TypeFoo〉|〈0;#TypeBar〉) 511 + out: 〈0;objs〉["obj1"].type 512 + } 513 + }