diff options
| author | gingerBill <bill@gingerbill.org> | 2020-12-14 22:47:21 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-12-14 22:47:21 +0000 |
| commit | 089eccb2457fcbec1e8488c003e1b006513541f4 (patch) | |
| tree | efa934ab6d57949d16ddcf49f1d7250b0641d8f6 | |
| parent | cbd4aa5392a71126c4c1be70bd1a1b9574b84216 (diff) | |
Fix minor constant value declaration bug
| -rw-r--r-- | src/check_decl.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 5234955fb..9f8f460ba 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -168,18 +168,6 @@ void check_init_constant(CheckerContext *ctx, Entity *e, Operand *operand) { return; } -#if 0 - if (!is_type_constant_type(operand->type)) { - gbString type_str = type_to_string(operand->type); - error(operand->expr, "Invalid constant type: '%s'", type_str); - gb_string_free(type_str); - if (e->type == nullptr) { - e->type = t_invalid; - } - return; - } -#endif - if (e->type == nullptr) { // NOTE(bill): type inference e->type = operand->type; } @@ -388,15 +376,7 @@ void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init, e->flags |= EntityFlag_Visited; if (type_expr) { - Type *t = check_type(ctx, type_expr); - if (!is_type_constant_type(t) && !is_type_proc(t)) { - gbString str = type_to_string(t); - error(type_expr, "Invalid constant type '%s'", str); - gb_string_free(str); - e->type = t_invalid; - return; - } - e->type = t; + e->type = check_type(ctx, type_expr); } Operand operand = {}; |