fixed: missing clone that could leading to big problems
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 4 Feb 2024 22:08:34 +0000 (16:08 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 4 Feb 2024 22:08:34 +0000 (16:08 -0600)
compiler/src/checker.c
compiler/src/parser.c

index fd3d9206963a0ec8e714bed4734e955cdc804524..b4d7ea9b83b0050befdc9e462907b1850dea7e53 100644 (file)
@@ -1,5 +1,6 @@
 #include "astnodes.h"
 #include "types.h"
+#undef BH_INTERNAL_ALLOCATOR
 #define BH_INTERNAL_ALLOCATOR (global_heap_allocator)
 #define BH_DEBUG
 #include "parser.h"
@@ -3731,7 +3732,7 @@ CheckStatus check_interface_constraint(AstConstraint *constraint) {
 
         AstTyped *sentinel = onyx_ast_node_new(context.ast_alloc, sizeof(AstTyped), Ast_Kind_Constraint_Sentinel);
         sentinel->token = is->name;
-        sentinel->type_node = is->type;
+        sentinel->type_node = (AstType *) ast_clone(context.ast_alloc, (AstNode *) is->type);
 
         symbol_introduce(constraint->scope, is->name, (AstNode *) sentinel);
     }
index 922003c026347e7ebda6b9fe94fa2461212f66a4..bd37b449e5e3797035db6dd07cd2b93a717c57f7 100644 (file)
@@ -4,6 +4,7 @@
 // and declarations to be introduced into scopes.
 
 #include "astnodes.h"
+#undef BH_INTERNAL_ALLOCATOR
 #define BH_INTERNAL_ALLOCATOR (global_heap_allocator)
 
 #include "parser.h"