bugfix with return type being an alias
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 30 Aug 2021 16:00:50 +0000 (11:00 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 30 Aug 2021 16:00:50 +0000 (11:00 -0500)
bin/onyx
include/onyxastnodes.h
src/onyxsymres.c

index 646b002479b5c76b2a210c46fd03c872c505f6f2..8d2601d3a4178de4a47c25e8e4d05277a248a06e 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index e2ee4d541da2f440133bb3eedf6b3708a0fb9da9..a4f5f5566efb1da320eb5e54fa16ae463625456d 100644 (file)
@@ -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);
 }
index d853a4d30e74ecb71c641eb1dc8c7b7647a06289..0992b0edb67812ae9b9164a6cd9720f33184948d 100644 (file)
@@ -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.");
     }