Allow int/float to coerce in type checker (#679)

This commit is contained in:
JT
2022-01-06 07:58:58 +11:00
committed by GitHub
parent 3c2a336ef9
commit cc1ae969fe
2 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,8 @@ use nu_protocol::{
pub fn type_compatible(lhs: &Type, rhs: &Type) -> bool {
match (lhs, rhs) {
(Type::List(c), Type::List(d)) => type_compatible(c, d),
(Type::Number, Type::Int) => true,
(Type::Number, Type::Float) => true,
(Type::Unknown, _) => true,
(_, Type::Unknown) => true,
(lhs, rhs) => lhs == rhs,