From: Brendan Hansen Date: Sat, 21 May 2022 03:23:37 +0000 (-0500) Subject: bugfix with new package aliases X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=67ba6eaf545b4abd5acff1aafd22e67dc7b3afb7;p=onyx.git bugfix with new package aliases --- 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) {