summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
Diffstat (limited to 'types.c')
-rw-r--r--types.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/types.c b/types.c
index 86247e8..5c1ed9d 100644
--- a/types.c
+++ b/types.c
@@ -389,6 +389,13 @@ static bool types_expr(Typer *tr, Expression *e) {
case EXPR_IDENT: {
if (!type_of_ident(tr, e->where, e->ident, t)) return false;
} break;
+ case EXPR_CAST: {
+ /* TODO: forbid certain casts */
+ CastExpr *c = &e->cast;
+ if (!types_expr(tr, c->expr))
+ return false;
+ *t = c->type;
+ } break;
case EXPR_IF: {
IfExpr *i = &e->if_;
IfExpr *curr = i;
@@ -741,6 +748,11 @@ static bool types_decl(Typer *tr, Declaration *d) {
}
}
d->flags |= DECL_FLAG_FOUND_TYPE;
+ if (d->type.kind == TYPE_TUPLE) {
+ /* TODO(eventually): Should this be allowed? */
+ err_print(d->where, "Declaring a tuple is not allowed.");
+ return false;
+ }
ret:
arr_remove_last(&tr->in_decls);
return success;