Commit 52eaf5ce authored by Robert Bradshaw's avatar Robert Bradshaw

Fix declaration error test.

parent 6837c510
...@@ -535,9 +535,10 @@ class CArrayDeclaratorNode(CDeclaratorNode): ...@@ -535,9 +535,10 @@ class CArrayDeclaratorNode(CDeclaratorNode):
values = [v.analyse_as_type(env) for v in args] values = [v.analyse_as_type(env) for v in args]
if None in values: if None in values:
ix = values.index(None) ix = values.index(None)
error(args[ix].pos, "Template parameter not a type.") error(args[ix].pos, "Template parameter not a type")
return error_type base_type = error_type
base_type = base_type.specialize_here(self.pos, values) else:
base_type = base_type.specialize_here(self.pos, values)
return self.base.analyse(base_type, env, nonempty = nonempty) return self.base.analyse(base_type, env, nonempty = nonempty)
if self.dimension: if self.dimension:
self.dimension = self.dimension.analyse_const_expression(env) self.dimension = self.dimension.analyse_const_expression(env)
...@@ -591,6 +592,7 @@ class CFuncDeclaratorNode(CDeclaratorNode): ...@@ -591,6 +592,7 @@ class CFuncDeclaratorNode(CDeclaratorNode):
template_nodes = [template_node] template_nodes = [template_node]
else: else:
error(template_node.pos, "Template arguments must be a list of names") error(template_node.pos, "Template arguments must be a list of names")
return None
self.templates = [] self.templates = []
for template in template_nodes: for template in template_nodes:
if isinstance(template, NameNode): if isinstance(template, NameNode):
......
...@@ -12,7 +12,8 @@ cdef void f(): ...@@ -12,7 +12,8 @@ cdef void f():
_ERRORS = u""" _ERRORS = u"""
3:19: Array element cannot be a function 3:20: Template arguments must be a list of names
3:20: Template parameter not a type
5:18: Function cannot return a function 5:18: Function cannot return a function
10:10: Function cannot return a function 10:10: Function cannot return a function
10:5: Cannot cast to a function type 10:5: Cannot cast to a function 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