Skip to content

Commit

Permalink
internal/core/adt: disable non-critical panic
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mpvl committed Sep 5, 2024
1 parent bb24c7c commit 8ebddc1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
56 changes: 51 additions & 5 deletions cue/testdata/eval/disjunctions.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,22 @@ issue641: {
}
}
}
-- issue3406.cue --
issue3406: {
out: d & { d }
d: kind: "foo" | "bar"
d: { kind: "foo" } | { kind: "bar" }
}
-- out/eval/stats --
Leaks: 0
Freed: 304
Reused: 292
Freed: 347
Reused: 335
Allocs: 12
Retain: 0

Unifications: 147
Conjuncts: 564
Disjuncts: 304
Unifications: 158
Conjuncts: 633
Disjuncts: 347
-- out/evalalpha --
Errors:
f.name: conflicting values "int" and "str":
Expand Down Expand Up @@ -301,6 +307,18 @@ Result:
}
}
}
issue3406: (struct){
out: (struct){ |((struct){
kind: (string){ "foo" }
}, (struct){
kind: (string){ "bar" }
}) }
d: (struct){ |((struct){
kind: (string){ "foo" }
}, (struct){
kind: (string){ "bar" }
}) }
}
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
Expand Down Expand Up @@ -530,6 +548,18 @@ Result:
}
}
}
issue3406: (struct){
out: (struct){ |((struct){
kind: (string){ "foo" }
}, (struct){
kind: (string){ "bar" }
}) }
d: (struct){ |((struct){
kind: (string){ "foo" }
}, (struct){
kind: (string){ "bar" }
}) }
}
}
-- out/compile --
--- in.cue
Expand Down Expand Up @@ -716,3 +746,19 @@ Result:
}
}
}
--- issue3406.cue
{
issue3406: {
out: (〈0;d〉 & {
〈1;d〉
})
d: {
kind: ("foo"|"bar")
}
d: ({
kind: "foo"
}|{
kind: "bar"
})
}
}
8 changes: 7 additions & 1 deletion internal/core/adt/conjunct.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ func (n *nodeContext) scheduleConjunct(c Conjunct, id CloseInfo) {
}

if id.cc.src != n.node {
panic("inconsistent state: nodes differ")
// TODO(#3406): raise a panic again.
// out: d & { d }
// d: {
// kind: "foo" | "bar"
// { kind: "foo" } | { kind: "bar" }
// }
// panic("inconsistent state: nodes differ")
}
default:

Expand Down

0 comments on commit 8ebddc1

Please sign in to comment.