mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
prevent panic when parsing incomplete multi-expr (|
) matches (#15230)
Fixes #14971, fixes #15229 # User-Facing Changes Fixes a panic when variable data is accessed after invalid usage of the `|` separator, which made it impossible to type certain match arms: ```nushell > match $in { 1 | Error: x Main thread panicked. |-> at crates/nu-protocol/src/engine/state_delta.rs💯14 `-> internal error: missing required scope frame ``` # Description Removes duplicative calls to `exit_scope` from an inner loop when `|` parse errors are encountered. The outer loop creates and exits scopes for each match arm.
This commit is contained in:
@ -4680,8 +4680,6 @@ pub fn parse_match_block_expression(working_set: &mut StateWorkingSet, span: Spa
|
||||
"end of input".into(),
|
||||
Span::new(output[position - 1].span.end, output[position - 1].span.end),
|
||||
));
|
||||
|
||||
working_set.exit_scope();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4695,8 +4693,6 @@ pub fn parse_match_block_expression(working_set: &mut StateWorkingSet, span: Spa
|
||||
"end of input".into(),
|
||||
Span::new(output[position - 1].span.end, output[position - 1].span.end),
|
||||
));
|
||||
|
||||
working_set.exit_scope();
|
||||
break;
|
||||
} else {
|
||||
connector = working_set.get_span_contents(output[position].span);
|
||||
|
Reference in New Issue
Block a user