Commit 8b4b461f authored by Xavier Thompson's avatar Xavier Thompson

Fix type inference for comparison operations with cpp types

parent 868a2607
......@@ -13198,11 +13198,20 @@ class PrimaryCmpNode(ExprNode, CmpNode):
def infer_type(self, env):
type1 = self.operand1.infer_type(env)
type2 = self.operand2.infer_type(env)
operator = self.operator
if is_pythran_expr(type1) or is_pythran_expr(type2):
if is_pythran_supported_type(type1) and is_pythran_supported_type(type2):
return PythranExpr(pythran_binop_type(self.operator, type1, type2))
cpp_type = None
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)
if cpp_type is not None:
return cpp_type
# TODO: implement this for other types.
return py_object_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