From: Brendan Hansen Date: Mon, 30 Aug 2021 16:00:50 +0000 (-0500) Subject: bugfix with return type being an alias X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=bd55a2be92e93e931c688637336496c8ec5330b0;p=onyx.git bugfix with return type being an alias --- diff --git a/bin/onyx b/bin/onyx index 646b0024..8d2601d3 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/include/onyxastnodes.h b/include/onyxastnodes.h index e2ee4d54..a4f5f556 100644 --- a/include/onyxastnodes.h +++ b/include/onyxastnodes.h @@ -1417,7 +1417,7 @@ static inline b32 binop_is_compare(BinaryOp binop) { } static inline b32 node_is_type(AstNode* node) { - if (node->kind == Ast_Kind_Alias) return node_is_type((AstNode *) ((AstAlias *) node)->alias); + node = strip_aliases(node); return (node->kind > Ast_Kind_Type_Start) && (node->kind < Ast_Kind_Type_End); } diff --git a/src/onyxsymres.c b/src/onyxsymres.c index d853a4d3..0992b0ed 100644 --- a/src/onyxsymres.c +++ b/src/onyxsymres.c @@ -879,6 +879,9 @@ SymresStatus symres_function_header(AstFunction* func) { SYMRES(type, &func->return_type); if (!node_is_type((AstNode *) func->return_type)) { + AstType* return_type = (AstType *) strip_aliases((AstNode *) func->return_type); + if (return_type->kind == Ast_Kind_Symbol) return Symres_Yield_Macro; + onyx_report_error(func->token->pos, "Return type is not a type."); }