From 3c70b45be4178e136dea5643fb8cfa5080ea76d0 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 1 Apr 2023 20:36:36 +0200 Subject: [PATCH] Fix matches list --- core_polymorph.cpp | 2 +- core_typechecking.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core_polymorph.cpp b/core_polymorph.cpp index c97d6c7..3d6ea7c 100644 --- a/core_polymorph.cpp +++ b/core_polymorph.cpp @@ -356,7 +356,7 @@ Ast_Decl *get_or_instantiate_polymorph_lambda(Token *pos, Ast_Decl *poly, Array< result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, ¶ms); For(result->lambda->args) { if (it->flags & AST_IDENT_POLYMORPH) { - result->lambda->args.ordered_remove(it); + result->lambda->args.ordered_remove(it); //@verify: this does not fuck ordereding } } diff --git a/core_typechecking.cpp b/core_typechecking.cpp index 78adfb9..774527f 100644 --- a/core_typechecking.cpp +++ b/core_typechecking.cpp @@ -1699,7 +1699,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str For(matches) { if (it.lambda_arg->flags & AST_POLYMORPH) { replacements.add(it.call_arg); - matches.ordered_remove(it); + matches.ordered_remove(it); //@verify: this does not fuck ordereding } } @@ -1710,7 +1710,13 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str // We know need to fix the matches list CAUSE ITS FUCKED // Thanks polymorphism - For(matches) { + For_Named(matches, match_it) { + For_Named(lambda->args, lambda_it) { + if (match_it.lambda_arg->name == lambda_it->name) { + match_it.lambda_arg = lambda_it; + break; + } + } } }