From 3c930ae9ab866ea289b61d68c0b671272366ea61 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 20 Sep 2021 15:50:38 +0800 Subject: [PATCH] fixed #12 --- nac3core/src/typecheck/type_inferencer/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nac3core/src/typecheck/type_inferencer/mod.rs b/nac3core/src/typecheck/type_inferencer/mod.rs index 6959b700..8e32922e 100644 --- a/nac3core/src/typecheck/type_inferencer/mod.rs +++ b/nac3core/src/typecheck/type_inferencer/mod.rs @@ -180,7 +180,7 @@ impl<'a> fold::Fold<()> for Inferencer<'a> { Some(self.infer_attribute(value, attr)?) } ast::ExprKind::BoolOp { values, .. } => Some(self.infer_bool_ops(values)?), - ast::ExprKind::BinOp { left, op, right } => Some(self.infer_bin_ops(left, op, right)?), + ast::ExprKind::BinOp { left, op, right } => Some(self.infer_bin_ops(expr.location, left, op, right)?), ast::ExprKind::UnaryOp { op, operand } => Some(self.infer_unary_ops(op, operand)?), ast::ExprKind::Compare { left, ops, comparators } => { Some(self.infer_compare(left, ops, comparators)?) @@ -547,6 +547,7 @@ impl<'a> Inferencer<'a> { fn infer_bin_ops( &mut self, + location: Location, left: &ast::Expr>, op: &ast::Operator, right: &ast::Expr>, @@ -554,7 +555,7 @@ impl<'a> Inferencer<'a> { let method = binop_name(op); let ret = self.unifier.get_fresh_var().0; self.build_method_call( - left.location, + location, method.to_string(), left.custom.unwrap(), vec![right.custom.unwrap()],