mirror of
https://github.com/nushell/nushell.git
synced 2025-06-05 17:46:44 +02:00
Fix match running closures as block (#15032)
# Description This PR makes `match` no longer run closures as if they were blocks. This also allows returning closures from `match` without needing to wrap in an outer subexpression or block. Before PR: ```nushell match 1 { _ => {|| print hi} } # => hi ``` After PR: ```nushell match 1 { _ => {|| print hi} } # => closure_1090 ``` # User-Facing Changes * `match` no longer runs closures as if they were blocks # Tests + Formatting N/A # After Submitting N/A
This commit is contained in:
parent
781c4bd1d7
commit
553c951a60
@ -255,7 +255,7 @@ pub(crate) fn compile_match(
|
||||
builder.drop_reg(match_reg)?;
|
||||
|
||||
// Execute match right hand side expression
|
||||
if let Some(block_id) = expr.as_block() {
|
||||
if let Expr::Block(block_id) = expr.expr {
|
||||
let block = working_set.get_block(block_id);
|
||||
compile_block(
|
||||
working_set,
|
||||
|
Loading…
x
Reference in New Issue
Block a user