Commit e09e0c6a authored by gsamain's avatar gsamain

Correct type inference for CallNode

parent ee42a193
...@@ -5416,9 +5416,18 @@ class CallNode(ExprNode): ...@@ -5416,9 +5416,18 @@ class CallNode(ExprNode):
func_type = entry.type or func_type func_type = entry.type or func_type
if func_type.is_ptr: if func_type.is_ptr:
func_type = func_type.base_type func_type = func_type.base_type
if func_type.is_cfunction: if func_type.is_cfunction or func_type.is_cyp_class:
if getattr(self.function, 'entry', None) and hasattr(self, 'args'): alternatives = None
alternatives = self.function.entry.all_alternatives() cypclass_wrapper_entry = None
if func_type.is_cyp_class:
cypclass_wrapper_entry = func_type.scope.lookup_here("<constructor>")
func_type = cypclass_wrapper_entry.type
if hasattr(self, 'args'):
if cypclass_wrapper_entry:
alternatives = cypclass_wrapper_entry.all_alternatives()
elif getattr(self.function, 'entry', None):
alternatives = self.function.entry.all_alternatives()
if alternatives:
arg_types = [arg.infer_type(env) for arg in self.args] arg_types = [arg.infer_type(env) for arg in self.args]
func_entry = PyrexTypes.best_match(arg_types, alternatives) func_entry = PyrexTypes.best_match(arg_types, alternatives)
if func_entry: if func_entry:
......
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