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

Correct type inference for cypclass new statements

parent 5e2f170b
...@@ -5477,6 +5477,9 @@ class CallNode(ExprNode): ...@@ -5477,6 +5477,9 @@ 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
if function.class_type.is_cyp_class:
return function.class_type
else:
return PyrexTypes.CPtrType(function.class_type) 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
...@@ -5936,6 +5939,9 @@ class SimpleCallNode(CallNode): ...@@ -5936,6 +5939,9 @@ 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):
if self.function.class_type.is_cyp_class:
self.type = self.function.class_type
else:
self.type = PyrexTypes.CPtrType(self.function.class_type) 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