diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index c592b4e479..4f8159b970 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -6176,7 +6176,7 @@ fn wrap_expr_with_collect(working_set: &mut StateWorkingSet, expr: &Expression) parser_info: HashMap::new(), })), span, - ty: Type::String, + ty: Type::Any, custom_completion: None, } } else { diff --git a/src/tests/test_parser.rs b/src/tests/test_parser.rs index 7d0b678fd0..65cf35d385 100644 --- a/src/tests/test_parser.rs +++ b/src/tests/test_parser.rs @@ -673,3 +673,8 @@ fn properly_typecheck_rest_param() -> TestResult { "3", ) } + +#[test] +fn implied_collect_has_compatible_type() -> TestResult { + run_test(r#"let idx = 3 | $in; $idx < 1"#, "false") +}