Possibly fix binop type inferrence
This commit is contained in:
parent
a680064b0f
commit
bb7347c97b
@ -415,6 +415,7 @@ impl Expression {
|
||||
// First find unfiltered parameters to binop
|
||||
let lhs_res = lhs.typecheck(state, &typerefs, HintKind::None);
|
||||
let rhs_res = rhs.typecheck(state, &typerefs, HintKind::None);
|
||||
dbg!(&lhs_res, &rhs_res, &ret_ty);
|
||||
let lhs_type = state.or_else(lhs_res, TypeKind::Vague(Vague::Unknown), lhs.1);
|
||||
let rhs_type = state.or_else(rhs_res, TypeKind::Vague(Vague::Unknown), rhs.1);
|
||||
|
||||
@ -431,6 +432,8 @@ impl Expression {
|
||||
params: (lhs_type.clone(), rhs_type.clone()),
|
||||
operator: *op,
|
||||
});
|
||||
|
||||
dbg!(&binops);
|
||||
// dbg!(&lhs_type, &rhs_type, &binops, &ret_ty, &expected_return_ty);
|
||||
if let Some(binop) = binops
|
||||
.iter()
|
||||
|
@ -356,6 +356,12 @@ impl<'outer> ScopeTypeRefs<'outer> {
|
||||
rhs_ref.narrow(&self.from_type(&rhs_widened).unwrap());
|
||||
}
|
||||
}
|
||||
(TypeRefKind::BinOp(_, lhs1, rhs1), TypeRefKind::BinOp(_, lhs2, rhs2)) => {
|
||||
let mut lhs_ref = self.from_type(&lhs1).unwrap();
|
||||
let mut rhs_ref = self.from_type(&rhs1).unwrap();
|
||||
lhs_ref.narrow(&self.from_type(&lhs2).unwrap());
|
||||
rhs_ref.narrow(&self.from_type(&rhs2).unwrap());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user