diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2025-05-26 19:48:28 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2025-05-26 19:48:28 +0200 |
| commit | 478c923e2cc6d4fc15ccf550b0c952495d8b81df (patch) | |
| tree | 2159f4fad8a3f3c25ce116808caf0cbef3f7758c /src/check_type.cpp | |
| parent | 229c734820f4cfa3deb84386e1613a982d92eede (diff) | |
fix another type alias issue with mini cycle
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 431698459..450b5e100 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -3805,7 +3805,11 @@ gb_internal Type *check_type_expr(CheckerContext *ctx, Ast *e, Type *named_type) #if 0 error(e, "Invalid type definition of '%.*s'", LIT(type->Named.name)); #endif - type->Named.base = t_invalid; + if (type->Named.type_name->TypeName.is_type_alias) { + // NOTE(laytan): keep it null, type declaration is a mini "cycle" to be filled later. + } else { + type->Named.base = t_invalid; + } } if (is_type_polymorphic(type)) { @@ -3823,7 +3827,7 @@ gb_internal Type *check_type_expr(CheckerContext *ctx, Ast *e, Type *named_type) } #endif - if (is_type_typed(type)) { + if (type->kind == Type_Named && type->Named.base == nullptr || is_type_typed(type)) { add_type_and_value(ctx, e, Addressing_Type, type, empty_exact_value); } else { gbString name = type_to_string(type); |