summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test.toc2
-rw-r--r--types.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/test.toc b/test.toc
index ba3ef1b..286e83a 100644
--- a/test.toc
+++ b/test.toc
@@ -7,5 +7,5 @@ foo ::= struct(t::Type) {
};
main ::= fn() {
-
+
}; \ No newline at end of file
diff --git a/types.c b/types.c
index 0f89af7..42e32da 100644
--- a/types.c
+++ b/types.c
@@ -598,6 +598,11 @@ static bool type_resolve_(Typer *tr, Type *t, Location where, bool is_reference)
if (!eval_expr(tr->evalr, t->expr, &typeval))
return false;
*t = *typeval.type;
+ if (t->kind == TYPE_STRUCT && !t->struc.args && t->struc.def->params) {
+ err_print(where, "Expected arguments to structure, but you didn't provide any.");
+ info_print(t->struc.def->where, "Structure was declared here.");
+ return false;
+ }
t->was_expr = expr;
assert(t->flags & TYPE_IS_RESOLVED);
} break;