diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-04-29 21:07:18 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-04-29 21:11:44 -0700 |
commit | 404f711755c8dbe4104eedbae62cddfbba6bbfa8 (patch) | |
tree | 2fbf49c9a06c26c65837068a3fdec4e2118aef68 | |
parent | 6f47640f945d79281b65e0ea514d4da9cfa8596c (diff) | |
download | mc-404f711755c8dbe4104eedbae62cddfbba6bbfa8.tar.gz |
Resolve the type on array indexes.
If we never used the type, we never resolved it, which means
we never set the type on the literal. This can cause some
potential type errors.
This resolves the type when doing the substitutions, in case
we didn't already get to it.
-rw-r--r-- | parse/gram.y | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/parse/gram.y b/parse/gram.y index 8190e9c..74f24c6 100644 --- a/parse/gram.y +++ b/parse/gram.y @@ -467,7 +467,10 @@ typaramlist compoundtype : functype {$$ = $1;} | type Tosqbrac Tcolon Tcsqbrac {$$ = mktyslice($2->loc, $1);} - | type Tosqbrac expr Tcsqbrac {$$ = mktyarray($2->loc, $1, $3);} + | type Tosqbrac expr Tcsqbrac { + $3->expr.type = mktype($3->loc, Tyuint32); + $$ = mktyarray($2->loc, $1, $3); + } | type Tosqbrac Tellipsis Tcsqbrac {$$ = mktyarray($2->loc, $1, NULL);} | type Tderef {$$ = mktyptr($2->loc, $1);} | Tat Tident {$$ = mktyparam($1->loc, $2->id);} |