Commit 97fb42ee authored by Stefan Behnel's avatar Stefan Behnel

run expression analysis on function signature annotations (was missing before)

--HG--
extra : amend_source : fe959a1a34b1e190fbe051c7058fcf51c50a2fa8
parent 2a6780c7
......@@ -1583,6 +1583,11 @@ class FuncDefNode(StatNode, BlockNode):
elif default_seen:
error(arg.pos, "Non-default argument following default argument")
def analyse_annotations(self, env):
for arg in self.args:
if arg.annotation:
arg.annotation = arg.annotation.analyse_types(env)
def align_argument_type(self, env, arg):
# @cython.locals()
directive_locals = self.directive_locals
......@@ -2380,6 +2385,7 @@ class CFuncDefNode(FuncDefNode):
self.py_func = self.py_func.analyse_expressions(env)
else:
self.analyse_default_values(env)
self.analyse_annotations(env)
self.acquire_gil = self.need_gil_acquisition(self.local_scope)
return self
......@@ -2580,7 +2586,7 @@ class DefNode(FuncDefNode):
#
# decorator_indirection IndirectionNode Used to remove __Pyx_Method_ClassMethod for fused functions
child_attrs = ["args", "star_arg", "starstar_arg", "body", "decorators"]
child_attrs = ["args", "star_arg", "starstar_arg", "body", "decorators", "return_type_annotation"]
lambda_name = None
reqd_kw_flags_cname = "0"
......@@ -2941,6 +2947,9 @@ class DefNode(FuncDefNode):
def analyse_expressions(self, env):
self.local_scope.directives = env.directives
self.analyse_default_values(env)
self.analyse_annotations(env)
if self.return_type_annotation:
self.return_type_annotation = self.return_type_annotation.analyse_types(env)
if not self.needs_assignment_synthesis(env) and self.decorators:
for decorator in self.decorators[::-1]:
......
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