Commit bfb25060 authored by gsamain's avatar gsamain

Correct type inference for cypclass new statements

parent 0b9833fb
...@@ -5410,7 +5410,10 @@ class CallNode(ExprNode): ...@@ -5410,7 +5410,10 @@ class CallNode(ExprNode):
func_type = function.infer_type(env) func_type = function.infer_type(env)
if isinstance(function, NewExprNode): if isinstance(function, NewExprNode):
# note: needs call to infer_type() above # 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: if func_type is py_object_type:
# function might have lied for safety => try to find better type # function might have lied for safety => try to find better type
entry = getattr(function, 'entry', None) entry = getattr(function, 'entry', None)
...@@ -5858,7 +5861,10 @@ class SimpleCallNode(CallNode): ...@@ -5858,7 +5861,10 @@ class SimpleCallNode(CallNode):
# Calc result type and code fragment # Calc result type and code fragment
if isinstance(self.function, NewExprNode): 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: else:
self.type = func_type.return_type 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