Commit cd191856 authored by gsamain's avatar gsamain

Correct type inference for cypclass new statements

parent a9743c83
......@@ -5401,7 +5401,10 @@ class CallNode(ExprNode):
func_type = function.infer_type(env)
if isinstance(function, NewExprNode):
# note: needs call to infer_type() above
return PyrexTypes.CPtrType(function.class_type)
if function.class_type.is_cyp_class:
return function.class_type
else:
return PyrexTypes.CPtrType(function.class_type)
if func_type is py_object_type:
# function might have lied for safety => try to find better type
entry = getattr(function, 'entry', None)
......@@ -5849,7 +5852,10 @@ class SimpleCallNode(CallNode):
# Calc result type and code fragment
if isinstance(self.function, NewExprNode):
self.type = PyrexTypes.CPtrType(self.function.class_type)
if self.function.class_type.is_cyp_class:
self.type = self.function.class_type
else:
self.type = PyrexTypes.CPtrType(self.function.class_type)
else:
self.type = func_type.return_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