Fix bug in chained boolean typecheck (#490)

This commit is contained in:
JT 2021-12-14 16:19:16 +11:00 committed by GitHub
parent 673fe2b56a
commit 04a9c8f3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -3018,7 +3018,6 @@ pub fn parse_math_expression(
ty: result_ty,
custom_completion: None,
});
// }
}
expr_stack.push(op);
expr_stack.push(rhs);

View File

@ -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),

View File

@ -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")
}