fixed: bug with checking argument types to interface construction
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 8 Feb 2024 22:06:50 +0000 (16:06 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 8 Feb 2024 22:06:50 +0000 (16:06 -0600)
compiler/src/checker.c

index b4d7ea9b83b0050befdc9e462907b1850dea7e53..a9bece890894c7566f0a0443ad50e1107ad8b548 100644 (file)
@@ -3715,14 +3715,16 @@ CheckStatus check_interface_constraint(AstConstraint *constraint) {
     fori (i, 0, bh_arr_length(constraint->interface->params)) {
         InterfaceParam *ip = &constraint->interface->params[i];
 
-        AstTyped *arg = constraint->args[i];
-        TYPE_CHECK(&arg, ip->type) {
-            ERROR_(arg->token->pos, "Mismatched type in interface construction. Expected something of type '%s', but got something of type '%s'.", type_get_name(ip->type), type_get_name(arg->type));
+        AstTyped **arg = &constraint->args[i];
+        CHECK(expression, arg);
+
+        TYPE_CHECK(arg, ip->type) {
+            ERROR_((*arg)->token->pos, "Mismatched type in interface construction. Expected something of type '%s', but got something of type '%s'.", type_get_name(ip->type), type_get_name((*arg)->type));
         }
 
         AstAlias *type_alias = onyx_ast_node_new(context.ast_alloc, sizeof(AstAlias), Ast_Kind_Alias);
         type_alias->token = ip->value_token;
-        type_alias->alias = arg;
+        type_alias->alias = *arg;
 
         symbol_introduce(constraint->scope, ip->value_token, (AstNode *) type_alias);
     }