Browse Source

Show error message when something like this is done `test: proc() : {}`

gingerBill 3 years ago
parent
commit
7681c43b14
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/check_decl.cpp

+ 4 - 0
src/check_decl.cpp

@@ -174,6 +174,10 @@ void check_init_constant(CheckerContext *ctx, Entity *e, Operand *operand) {
 		return;
 	}
 
+	if (is_type_proc(e->type)) {
+		error(e->token, "Illegal declaration of a constant procedure value");
+	}
+
 	e->parent_proc_decl = ctx->curr_proc_decl;
 
 	e->Constant.value = operand->value;