From: Brendan Hansen Date: Tue, 1 Jun 2021 17:34:11 +0000 (-0500) Subject: fixed overloaded procedures with baked value polymorphism X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=c63fa82389f06ab7520e6bb11fa825c8bd6204a2;p=onyx.git fixed overloaded procedures with baked value polymorphism --- diff --git a/bin/onyx b/bin/onyx index b330d5c7..dc3d2288 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/src/onyxutils.c b/src/onyxutils.c index 64a44ff1..a2d2fb45 100644 --- a/src/onyxutils.c +++ b/src/onyxutils.c @@ -667,7 +667,10 @@ static void solve_for_polymorphic_param_value(PolySolveResult* resolved, AstPoly // HACK: Storing the original value because if this was an AstArgument, we need to flag // it as baked if it is determined that the argument is of the correct kind and type. AstTyped* orig_value = value; - if (value->kind == Ast_Kind_Argument) value = ((AstArgument *) value)->value; + if (value->kind == Ast_Kind_Argument) { + ((AstArgument *) orig_value)->is_baked = 0; + value = ((AstArgument *) value)->value; + } if (param->type_expr == (AstType *) &type_expr_symbol) { if (!node_is_type((AstNode *) value)) { @@ -1024,7 +1027,10 @@ AstTyped* find_matching_overload_by_arguments(bh_arr(AstTyped *) overloads, Argu AstTyped** value = &args.values[i]; if (type_to_match->kind == Type_Kind_VarArgs) type_to_match = type_to_match->VarArgs.ptr_to_data->Pointer.elem; - if ((*value)->kind == Ast_Kind_Argument) value = &((AstArgument *) *value)->value; + if ((*value)->kind == Ast_Kind_Argument) { + if (((AstArgument *) (*value))->is_baked) continue; + value = &((AstArgument *) *value)->value; + } if (!type_check_or_auto_cast(value, type_to_match)) { all_arguments_work = 0;