Commit cacb4b8
committed
internal/core/adt: fix panic on reinserted pattern constraint conjunct
When insertConstraint finds that a conjunct was already added to a
pattern constraint, it records a defID replacement. The existing
conjunct may have been inserted under a previous OpContext, for
instance when "cue eval -e" evaluates an expression against an
already evaluated instance whose pattern constraints it re-triggers.
Its defID then indexes the previous context's containments table and
may be out of range for the current one, panicking in addReplacement.
Skip the replacement unless both conjuncts got their defIDs from the
current context, matching the other opID misalignment guards.
Fixes #4449
Assisted-by: Claude Code (claude-fable-5)
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I15b8775d0f56a85070a36183d3104a54517275d0
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1244341
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>1 parent d57c348 commit cacb4b8
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
0 commit comments