summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-27 17:29:00 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-27 17:29:00 -0400
commit3f3e320908115c0b257040d187f07f494e16d30b (patch)
treeb22c4d6f7ae21acd45d75102a991298d15c7e564 /types.c
parentb22ad26be0f96df1a626742a6f6ebd1bfefcf56d (diff)
some fixes and starting to get type declarations
Diffstat (limited to 'types.c')
-rw-r--r--types.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/types.c b/types.c
index 2d4e702..0acc468 100644
--- a/types.c
+++ b/types.c
@@ -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) {