Fix wrong VarId of $in variable (#7893)

Fixes https://github.com/nushell/nushell/issues/7872
This commit is contained in:
Jakub Žádník 2023-01-28 19:55:29 +02:00 committed by GitHub
parent 2a9226a55c
commit 3c6b10c6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -5995,7 +5995,7 @@ fn wrap_expr_with_collect(working_set: &mut StateWorkingSet, expr: &Expression)
if let Some(decl_id) = working_set.find_decl(b"collect", &Type::Any) {
let mut output = vec![];
let var_id = working_set.next_var_id();
let var_id = IN_VARIABLE_ID;
let mut signature = Signature::new("");
signature.required_positional.push(PositionalArg {
var_id: Some(var_id),

View File

@ -365,3 +365,9 @@ fn better_operator_spans() -> TestResult {
fn range_right_exclusive() -> TestResult {
run_test(r#"[1, 4, 5, 8, 9] | range 1..<3 | math sum"#, "9")
}
/// Issue #7872
#[test]
fn assignment_to_in_var_no_panic() -> TestResult {
fail_test(r#"$in = 3"#, "needs to be a mutable variable")
}