Commit 7b490853 authored by gsamain's avatar gsamain Committed by Xavier Thompson

Correct type inference for cypclass new statements

parent 5e2f170b
......@@ -5477,7 +5477,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)
......@@ -5936,7 +5939,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