Skip to content

Commit

Permalink
Fix issue #419: suppress duplicate error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
johncbowman committed Jan 18, 2024
1 parent dd4b63c commit b96786e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions dec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ void dimensions::prettyprint(ostream &out, Int indent)
out << "dimensions (" << depth << ")\n";
}

types::array *dimensions::truetype(types::ty *base)
types::array *dimensions::truetype(types::ty *base, bool tacit)
{
if (base->kind == ty_void) {
if (!tacit && base->kind == ty_void) {
em.error(getPos());
em << "cannot declare array of type void";
}
Expand Down Expand Up @@ -109,7 +109,7 @@ types::ty *arrayTy::trans(coenv &e, bool tacit)
if (ct->kind == types::ty_error)
return ct;

types::array *t = dims->truetype(ct);
types::array *t = dims->truetype(ct,tacit);
assert(t);

return t;
Expand Down Expand Up @@ -386,9 +386,10 @@ trans::tyEntry *decidstart::getTyEntry(trans::tyEntry *base, coenv &e,
void decidstart::addOps(types::ty *base, coenv &e, record *r)
{
if (dims) {
e.e.addArrayOps(dims->truetype(base));
array *a=dims->truetype(base);
e.e.addArrayOps(a);
if (r)
r->e.addArrayOps(dims->truetype(base));
r->e.addArrayOps(a);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class dimensions : public absyn {
return depth;
}

types::array *truetype(types::ty *base);
types::array *truetype(types::ty *base, bool tacit=false);
};

class arrayTy : public ty {
Expand Down

0 comments on commit b96786e

Please sign in to comment.