diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-27 17:29:00 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-10-27 17:29:00 -0400 |
commit | 3f3e320908115c0b257040d187f07f494e16d30b (patch) | |
tree | b22c4d6f7ae21acd45d75102a991298d15c7e564 /types.c | |
parent | b22ad26be0f96df1a626742a6f6ebd1bfefcf56d (diff) |
some fixes and starting to get type declarations
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1139,6 +1139,19 @@ static bool types_decl(Typer *tr, Declaration *d) { d->flags |= DECL_FLAG_FOUND_VAL; } } + if (d->type.kind == TYPE_TUPLE) { + arr_foreach(d->type.tuple, Type, t) { + if (t->kind == TYPE_TYPE && !(d->flags & DECL_FLAG_CONST)) { + err_print(d->where, "Cannot declare non-constant type."); + return false; + } + } + } else { + if (d->type.kind == TYPE_TYPE && !(d->flags & DECL_FLAG_CONST)) { + err_print(d->where, "Cannot declare non-constant type."); + return false; + } + } } size_t n_idents = arr_len(d->idents); if (d->type.kind == TYPE_TUPLE) { |