aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorLaytan <laytanlaats@hotmail.com>2025-04-16 22:55:25 +0200
committerLaytan <laytanlaats@hotmail.com>2025-04-16 22:55:25 +0200
commit8efeaef40bfc939efe5308bb70ca6d7f5387d697 (patch)
treeb82407d17b91dca2df9005eb96545e92e7b847b3 /src/check_decl.cpp
parent3ba9b9b14ebdfbc1ce2b21dfc701117f4ce51e27 (diff)
fix not resolving to alias in a recursive declaration
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 250e8b854..ba6445ea4 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -468,6 +468,10 @@ gb_internal void check_type_decl(CheckerContext *ctx, Entity *e, Ast *init_expr,
}
e->type = named;
+ if (!is_distinct) {
+ e->TypeName.is_type_alias = true;
+ }
+
check_type_path_push(ctx, e);
Type *bt = check_type_expr(ctx, te, named);
check_type_path_pop(ctx);
@@ -502,9 +506,9 @@ gb_internal void check_type_decl(CheckerContext *ctx, Entity *e, Ast *init_expr,
if (!is_distinct) {
e->type = bt;
named->Named.base = bt;
- e->TypeName.is_type_alias = true;
}
+ e->TypeName.is_type_alias = !is_distinct;
if (decl->type_expr != nullptr) {
Type *t = check_type(ctx, decl->type_expr);