summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse/infer.c3
-rw-r--r--test/pkgtrait.myr1
2 files changed, 2 insertions, 2 deletions
diff --git a/parse/infer.c b/parse/infer.c
index daa3727..77749de 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -895,8 +895,7 @@ tryconstrain(Type *base, Trait *tr)
if (tymatchrank(tm->filter[i], ty) >= 0)
return 1;
}
- assert(ty->nsub == 1);
- if (!ty->sub)
+ if (!ty->sub || ty->nsub != 1)
break;
ty = ty->sub[0];
tm = tm->sub[ty->type];
diff --git a/test/pkgtrait.myr b/test/pkgtrait.myr
index 7825937..40eb594 100644
--- a/test/pkgtrait.myr
+++ b/test/pkgtrait.myr
@@ -10,4 +10,5 @@ impl disposable regex.regex# =
const main = {
var auto r : regex.regex#
r = std.try(regex.compile(".*"))
+ std.exit(42)
}