From 67ba6eaf545b4abd5acff1aafd22e67dc7b3afb7 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 20 May 2022 22:23:37 -0500 Subject: [PATCH] bugfix with new package aliases --- src/symres.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/symres.c b/src/symres.c index 01a86c16..5b3ea1bb 100644 --- a/src/symres.c +++ b/src/symres.c @@ -309,10 +309,23 @@ static SymresStatus symres_field_access(AstFieldAccess** fa) { AstTyped* expr = (AstTyped *) strip_aliases((AstNode *) (*fa)->expr); b32 force_a_lookup = 0; + if (expr->kind == Ast_Kind_Enum_Type || expr->kind == Ast_Kind_Type_Raw_Alias) { force_a_lookup = 1; } + // + // If we are trying to access a field on an alias, we have to make sure + // the alias is "ready" to have a symbol looked up inside of it. This means + // the alias should have passed symbol resolution. If not, force a lookup + // and yield if the alias was not ready. + if ((*fa)->expr->kind == Ast_Kind_Alias) { + assert((*fa)->expr->entity); + if ((*fa)->expr->entity->state < Entity_State_Check_Types) { + force_a_lookup = 1; + } + } + AstNode* resolution = try_symbol_resolve_from_node((AstNode *) expr, (*fa)->token); if (resolution) *((AstNode **) fa) = resolution; else if (expr->kind == Ast_Kind_Package) { -- 2.25.1