From 16bd958838c37cd9940f3c34c4425d3fc418613b Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 4 Jan 2023 20:24:56 -0600 Subject: [PATCH] fixed #47 --- compiler/src/checker.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/src/checker.c b/compiler/src/checker.c index b3d8a51e..27c6893d 100644 --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@ -2333,7 +2333,17 @@ CheckStatus check_statement(AstNode** pstmt) { CHECK(type, &typed_stmt->type_node); if (!node_is_type((AstNode *) typed_stmt->type_node)) { - ERROR(stmt->token->pos, "Local's type is not a type."); + if (typed_stmt->type_node->type == &basic_types[Basic_Kind_Type_Index]) { + onyx_report_error(stmt->token->pos, Error_Critical, "The type of this local variable is a runtime-known type, not a compile-time known type."); + + if (typed_stmt->type_node->kind == Ast_Kind_Param) { + onyx_report_error(stmt->token->pos, Error_Critical, "Try adding a '$' to the parameter name to make this a compile-time known type."); + } + + return Check_Error; + } else { + ERROR(stmt->token->pos, "The type of this local is not a type."); + } } YIELD(typed_stmt->token->pos, "Waiting for local variable's type."); -- 2.25.1