summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-01-25 00:32:57 -0800
committerOri Bernstein <ori@eigenstate.org>2015-01-25 00:34:48 -0800
commit40e25ffab9e67040ad007679293ddcb0006889b6 (patch)
tree76fee56ec548d209be7a8c02059a20b6a9d93783 /parse
parent6d3a69d36ec8c7722af1769b493a3bd6712adc63 (diff)
downloadmc-40e25ffab9e67040ad007679293ddcb0006889b6.tar.gz
Error out with invalid specializations.
type t(a, b) = ... var x : t(a) will now error correctly.
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 900fb27..842da18 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -434,6 +434,10 @@ static Type *tf(Inferstate *st, Type *orig)
/* If this is an instantiation of a generic type, we want the params to
* match the instantiation */
if (orig->type == Tyunres && isgeneric(t)) {
+ if (t->nparam != orig->narg) {
+ lfatal(orig->loc, "%s incompatibly specialized with %s, declared on %s:%d",
+ tystr(orig), tystr(t), file->file.files[t->loc.file], t->loc.line);
+ }
t = tyfreshen(st, t);
for (i = 0; i < t->narg; i++) {
unify(st, NULL, t->arg[i], orig->arg[i]);