mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Fix a crash when checking a nested tuple-pattern (#7716)
Adds a virtual node to `DefaultValuePattern` to end the `ExprRegionForPattern` before checking the expression for the default value. When checking the default value expression, the context was still configured to interpret expressions as patterns, which caused some corruption of state with tuple-pattern subpatterns. Corrects an assertion failure I found while working on feedback from #7665.
This commit is contained in:
@@ -175,6 +175,10 @@ auto HandlePatternListElementCheckForDefaultValue(Context& context) -> void {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the first virtual node surrounding the value expr node, to facilitate
|
||||
// handling in check.
|
||||
context.AddLeafNode(NodeKind::DefaultValueExprStart, *equals_token);
|
||||
|
||||
state.token = *equals_token;
|
||||
state.kind = StateKind::PatternListElementFinishDefaultValue;
|
||||
context.PushState(state);
|
||||
|
||||
Reference in New Issue
Block a user