Commit d8a06e2a authored by gsamain's avatar gsamain

Correct type inference for CallNode

parent db15895f
......@@ -5407,9 +5407,18 @@ class CallNode(ExprNode):
func_type = entry.type or func_type
if func_type.is_ptr:
func_type = func_type.base_type
if func_type.is_cfunction:
if getattr(self.function, 'entry', None) and hasattr(self, 'args'):
if func_type.is_cfunction or func_type.is_cyp_class:
alternatives = None
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]
func_entry = PyrexTypes.best_match(arg_types, alternatives)
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