Commit 0a3154c3 authored by Stefan Behnel's avatar Stefan Behnel

fix compilation failure when trying to analyse non-trivial non-type strings as types

parent 23c2bbf5
......@@ -1182,9 +1182,13 @@ def _analyse_name_as_type(name, pos, env):
hold_errors()
from TreeFragment import TreeFragment
pos = (pos[0], pos[1], pos[2]-7)
declaration = TreeFragment(u"sizeof(%s)" % name, name=pos[0].filename, initial_pos=pos)
sizeof_node = declaration.root.stats[0].expr
sizeof_node = sizeof_node.analyse_types(env)
try:
declaration = TreeFragment(u"sizeof(%s)" % name, name=pos[0].filename, initial_pos=pos)
except CompileError:
sizeof_node = None
else:
sizeof_node = declaration.root.stats[0].expr
sizeof_node = sizeof_node.analyse_types(env)
release_errors(ignore=True)
if isinstance(sizeof_node, SizeofTypeNode):
return sizeof_node.arg_type
......
......@@ -437,7 +437,7 @@ def int_literals():
print(cython.typeof(1UL))
print(cython.typeof(10000000000000UL))
def annotation_syntax(a : "test", b : "other" = 2) -> "ret":
def annotation_syntax(a : "test new test", b : "other" = 2) -> "ret":
"""
>>> annotation_syntax(1)
3
......
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