diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-04 13:17:48 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-04 13:17:48 +0330 |
commit | 2a03e1e42906605be5ea093bcaca212c41acb62f (patch) | |
tree | b00b4b792ed7e76c5d3526e8152d568a90f0fdc7 /src/compiler/ast-tree.c | |
parent | f570c63542bc644d829aff8c470db2385a3c5180 (diff) |
returning functions now work
Diffstat (limited to 'src/compiler/ast-tree.c')
-rw-r--r-- | src/compiler/ast-tree.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c index 77b93d6..4c6d36d 100644 --- a/src/compiler/ast-tree.c +++ b/src/compiler/ast-tree.c @@ -2897,7 +2897,11 @@ bool setTypesReturn(AstTree *tree, AstTreeSetTypesHelper _helper, }; if (!setAllTypes(metadata->value, helper, NULL)) { return false; - } else if (!typeIsEqual(metadata->value->type, function->returnType)) { + } + if (helper.lookingType != function->returnType) { + astTreeDelete(helper.lookingType); // TODO: change plan + } + if (!typeIsEqual(metadata->value->type, function->returnType)) { printError(tree->str_begin, tree->str_end, "Type mismatch"); return false; } |