diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-04-30 19:40:20 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-04-30 19:40:20 -0700 |
commit | 4780d158d3ea0b958262d2da00b8272aca39f985 (patch) | |
tree | c253bcbcece4ec6ab9de6215ce781f6f9729c512 | |
parent | 40f9f70619263cdced4f0c1d0aaced9fd31bf386 (diff) | |
download | mc-4780d158d3ea0b958262d2da00b8272aca39f985.tar.gz |
Don't stop inferring structs early.
We were erroring where we should have been leaving things alone.
-rw-r--r-- | parse/infer.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/parse/infer.c b/parse/infer.c index 581f64f..69fcd2d 100644 --- a/parse/infer.c +++ b/parse/infer.c @@ -1815,8 +1815,16 @@ static void checkstruct(Inferstate *st, Node *n) size_t i, j; t = tybase(tf(st, n->lit.type)); - if (t->type != Tystruct) - fatal(n, "type %s for struct literal is not struct near %s", tystr(t), ctxstr(st, n)); + if (t->type != Tystruct) { + /* + * If we haven't inferred the type, and it's inside another struct, + * we'll eventually get to it. + * + * If, on the other hand, it is genuinely underspecified, we'll give + * a better error on it later. + */ + return; + } for (i = 0; i < n->expr.nargs; i++) { val = n->expr.args[i]; |