Commit bfb25060 authored by gsamain's avatar gsamain

Correct type inference for cypclass new statements

parent 0b9833fb
......@@ -5410,6 +5410,9 @@ class CallNode(ExprNode):
func_type = function.infer_type(env)
if isinstance(function, NewExprNode):
# note: needs call to infer_type() above
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
......@@ -5858,6 +5861,9 @@ class SimpleCallNode(CallNode):
# Calc result type and code fragment
if isinstance(self.function, NewExprNode):
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