summaryrefslogtreecommitdiff
path: root/src/compiler/ast-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/ast-tree.c')
-rw-r--r--src/compiler/ast-tree.c6
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;
}