Commit a45374f2 authored by gsamain's avatar gsamain

Fix Binop c++ operators type inference

parent 1336b25e
...@@ -11131,7 +11131,8 @@ class BinopNode(ExprNode): ...@@ -11131,7 +11131,8 @@ class BinopNode(ExprNode):
or self.operand2.type.is_cpp_class) or self.operand2.type.is_cpp_class)
def analyse_cpp_operation(self, env): def analyse_cpp_operation(self, env):
entry = env.lookup_operator(self.operator, [self.operand1, self.operand2]) operator = self.operator if not self.inplace else self.operator+"="
entry = env.lookup_operator(operator, [self.operand1, self.operand2])
if not entry: if not entry:
self.type_error() self.type_error()
return return
...@@ -11330,7 +11331,14 @@ class NumBinopNode(BinopNode): ...@@ -11330,7 +11331,14 @@ class NumBinopNode(BinopNode):
widest_type, PyrexTypes.c_int_type) widest_type, PyrexTypes.c_int_type)
return widest_type return widest_type
else: else:
return None cpp_type = None
operator = self.operator if not self.inplace else self.operator+"="
if type1.is_cpp_class or type1.is_ptr:
cpp_type = type1.find_cpp_operation_type(operator, type2)
if cpp_type is None and (type2.is_cpp_class or type2.is_ptr):
cpp_type = type2.find_cpp_operation_type(operator, type1)
# FIXME: do we need to handle other cases here?
return cpp_type
def may_be_none(self): def may_be_none(self):
if self.type and self.type.is_builtin_type: if self.type and self.type.is_builtin_type:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment