From c028ac411d3fb14f4e2848057b448d6158ea59e2 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Thu, 8 Feb 2024 16:06:50 -0600 Subject: [PATCH] fixed: bug with checking argument types to interface construction --- compiler/src/checker.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/src/checker.c b/compiler/src/checker.c index b4d7ea9b..a9bece89 100644 --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@ -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); } -- 2.25.1