diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index a82d9d621d..d7fe34a6f8 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -3018,7 +3018,6 @@ pub fn parse_math_expression( ty: result_ty, custom_completion: None, }); - // } } expr_stack.push(op); expr_stack.push(rhs); diff --git a/crates/nu-parser/src/type_check.rs b/crates/nu-parser/src/type_check.rs index 64aa8f0432..80fdc15058 100644 --- a/crates/nu-parser/src/type_check.rs +++ b/crates/nu-parser/src/type_check.rs @@ -131,7 +131,7 @@ pub fn math_result_type( } }, Operator::And | Operator::Or => match (&lhs.ty, &rhs.ty) { - (Type::Bool, Type::Bool) => (Type::Int, None), + (Type::Bool, Type::Bool) => (Type::Bool, None), (Type::Unknown, _) => (Type::Unknown, None), (_, Type::Unknown) => (Type::Unknown, None), diff --git a/src/tests.rs b/src/tests.rs index eaffa9bcf5..17b8d274ea 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1232,3 +1232,8 @@ fn command_filter_reject_3() -> TestResult { ]"#, ) } + +#[test] +fn chained_operator_typecheck() -> TestResult { + run_test("1 != 2 && 3 != 4 && 5 != 6", "true") +}