Skip to content

Commit 8ebddc1

Browse files
committed
internal/core/adt: disable non-critical panic
This panic is not critical to enforce. Revisit it later, though. Fixes #3406 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I999467ddadb6b9106a30e71b11ec713eb731816d Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200586 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Matthew Sackman <[email protected]>
1 parent bb24c7c commit 8ebddc1

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed

cue/testdata/eval/disjunctions.txtar

+51-5
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,22 @@ issue641: {
132132
}
133133
}
134134
}
135+
-- issue3406.cue --
136+
issue3406: {
137+
out: d & { d }
138+
d: kind: "foo" | "bar"
139+
d: { kind: "foo" } | { kind: "bar" }
140+
}
135141
-- out/eval/stats --
136142
Leaks: 0
137-
Freed: 304
138-
Reused: 292
143+
Freed: 347
144+
Reused: 335
139145
Allocs: 12
140146
Retain: 0
141147

142-
Unifications: 147
143-
Conjuncts: 564
144-
Disjuncts: 304
148+
Unifications: 158
149+
Conjuncts: 633
150+
Disjuncts: 347
145151
-- out/evalalpha --
146152
Errors:
147153
f.name: conflicting values "int" and "str":
@@ -301,6 +307,18 @@ Result:
301307
}
302308
}
303309
}
310+
issue3406: (struct){
311+
out: (struct){ |((struct){
312+
kind: (string){ "foo" }
313+
}, (struct){
314+
kind: (string){ "bar" }
315+
}) }
316+
d: (struct){ |((struct){
317+
kind: (string){ "foo" }
318+
}, (struct){
319+
kind: (string){ "bar" }
320+
}) }
321+
}
304322
}
305323
-- diff/-out/evalalpha<==>+out/eval --
306324
diff old new
@@ -530,6 +548,18 @@ Result:
530548
}
531549
}
532550
}
551+
issue3406: (struct){
552+
out: (struct){ |((struct){
553+
kind: (string){ "foo" }
554+
}, (struct){
555+
kind: (string){ "bar" }
556+
}) }
557+
d: (struct){ |((struct){
558+
kind: (string){ "foo" }
559+
}, (struct){
560+
kind: (string){ "bar" }
561+
}) }
562+
}
533563
}
534564
-- out/compile --
535565
--- in.cue
@@ -716,3 +746,19 @@ Result:
716746
}
717747
}
718748
}
749+
--- issue3406.cue
750+
{
751+
issue3406: {
752+
out: (〈0;d〉 & {
753+
〈1;d〉
754+
})
755+
d: {
756+
kind: ("foo"|"bar")
757+
}
758+
d: ({
759+
kind: "foo"
760+
}|{
761+
kind: "bar"
762+
})
763+
}
764+
}

internal/core/adt/conjunct.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ func (n *nodeContext) scheduleConjunct(c Conjunct, id CloseInfo) {
9090
}
9191

9292
if id.cc.src != n.node {
93-
panic("inconsistent state: nodes differ")
93+
// TODO(#3406): raise a panic again.
94+
// out: d & { d }
95+
// d: {
96+
// kind: "foo" | "bar"
97+
// { kind: "foo" } | { kind: "bar" }
98+
// }
99+
// panic("inconsistent state: nodes differ")
94100
}
95101
default:
96102

0 commit comments

Comments
 (0)