-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/adt: do not require closeContext.group to be non-nil
In fields.go CloseInfo.spawnCloseContext creates a closeContext with a nil group field. That explodes closeContext.assignConjunct. closeContext.assignConject has been reworked so it can cope with a nil group field. I did also try changing CloseInfo.spawnCloseContext to make it always populate the group field, but that caused other tests to break via a "group misaligned" panic in overlayContext.allocCC. Added a test and verified it fails without this fix. Fixes #3301. Change-Id: Ifcfb4b8d38d6ccc84e47f2a9a5de36a1721548ba Signed-off-by: Matthew Sackman <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198356 Reviewed-by: Marcel van Lohuizen <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
1 parent
5de5b42
commit c8f3cad
Showing
2 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
-- in.cue -- | ||
object: #Leaf & {} | ||
|
||
#Base: { | ||
extra?: {...} | ||
} | ||
|
||
#Mid: { | ||
#Base | ||
} | ||
|
||
#Leaf: { | ||
#Mid | ||
extra?: {...} | ||
more?: int | ||
if extra.foo != _|_ { | ||
if more != _|_ { | ||
foo: "bar" | ||
} | ||
} | ||
} | ||
-- out/eval -- | ||
(struct){ | ||
object: (#struct){ | ||
extra?: (#struct){ | ||
} | ||
more?: (int){ int } | ||
} | ||
#Base: (#struct){ | ||
extra?: (#struct){ | ||
} | ||
} | ||
#Mid: (#struct){ | ||
extra?: (#struct){ | ||
} | ||
} | ||
#Leaf: (#struct){ | ||
extra?: (#struct){ | ||
} | ||
more?: (int){ int } | ||
} | ||
} | ||
-- out/eval/stats -- | ||
Leaks: 0 | ||
Freed: 11 | ||
Reused: 5 | ||
Allocs: 6 | ||
Retain: 7 | ||
|
||
Unifications: 11 | ||
Conjuncts: 25 | ||
Disjuncts: 18 | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
object: (〈0;#Leaf〉 & {}) | ||
#Base: { | ||
extra?: { | ||
... | ||
} | ||
} | ||
#Mid: { | ||
〈1;#Base〉 | ||
} | ||
#Leaf: { | ||
〈1;#Mid〉 | ||
extra?: { | ||
... | ||
} | ||
more?: int | ||
if (〈0;extra〉.foo != _|_(explicit error (_|_ literal) in source)) { | ||
if (〈1;more〉 != _|_(explicit error (_|_ literal) in source)) { | ||
foo: "bar" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters