Commit 7dfa5d63 authored by Robert Bradshaw's avatar Robert Bradshaw

Better error for bad template parameter.

Fixed #1647
parent 55af254c
...@@ -3562,6 +3562,9 @@ class IndexNode(_IndexingBaseNode): ...@@ -3562,6 +3562,9 @@ class IndexNode(_IndexingBaseNode):
if base_type.templates is None: if base_type.templates is None:
error(self.pos, "Can only parameterize template functions.") error(self.pos, "Can only parameterize template functions.")
self.type = error_type self.type = error_type
elif self.type_indices is None:
# Error recorded earlier.
self.type = error_type
elif len(base_type.templates) != len(self.type_indices): elif len(base_type.templates) != len(self.type_indices):
error(self.pos, "Wrong number of template arguments: expected %s, got %s" % ( error(self.pos, "Wrong number of template arguments: expected %s, got %s" % (
(len(base_type.templates), len(self.type_indices)))) (len(base_type.templates), len(self.type_indices))))
......
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