Skip to content

Commit 5a99880

Browse files
committed
cue/testdata: add a regression test for #3570
Those three lines of CUE would make evalv2 panic with a nil pointer dereference, but evalv3 correctly finishes with an evaluation error. Closes #3570. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I05dd9603a1c8133395150d4fb49d6f4fc4a20d7e Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1215441 Reviewed-by: Paul Jolly <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent a3db8b8 commit 5a99880

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

cue/testdata/cycle/issue3570.txtar

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This code caused a panic on evalv2.
2+
#skip-v2
3+
-- in.cue --
4+
foo: foo: 25 | 44
5+
foo
6+
foo: foo
7+
-- out/compile --
8+
--- in.cue
9+
{
10+
foo: {
11+
foo: (25|44)
12+
}
13+
〈0;foo〉
14+
foo: 〈0;foo〉
15+
}
16+
-- out/evalalpha --
17+
Errors:
18+
2 errors in empty disjunction:
19+
conflicting values 25 and {foo:(25|44)} (mismatched types int and struct):
20+
./in.cue:1:6
21+
./in.cue:1:11
22+
conflicting values 44 and {foo:(25|44)} (mismatched types int and struct):
23+
./in.cue:1:6
24+
./in.cue:1:16
25+
26+
Result:
27+
(_|_){
28+
// [eval] 2 errors in empty disjunction:
29+
// conflicting values 25 and {foo:(25|44)} (mismatched types int and struct):
30+
// ./in.cue:1:6
31+
// ./in.cue:1:11
32+
// conflicting values 44 and {foo:(25|44)} (mismatched types int and struct):
33+
// ./in.cue:1:6
34+
// ./in.cue:1:16
35+
foo: (struct){
36+
foo: (_){ _ }
37+
}
38+
}

0 commit comments

Comments
 (0)