Fix polymorph invalid resolved_decl in call
This commit is contained in:
@@ -317,6 +317,7 @@ Ast_Decl *get_or_instantiate_polymorph_type(Token *pos, Ast_Decl *poly, Array<As
|
|||||||
|
|
||||||
assert(result->di != poly->di);
|
assert(result->di != poly->di);
|
||||||
result->name = get_unique_name_for_decl(result);
|
result->name = get_unique_name_for_decl(result);
|
||||||
|
result->unique_name = result->name;
|
||||||
|
|
||||||
poly->polymorphs.allocator = pctx->heap;
|
poly->polymorphs.allocator = pctx->heap;
|
||||||
poly->polymorphs.add(result);
|
poly->polymorphs.add(result);
|
||||||
|
|||||||
@@ -1705,6 +1705,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
Ast_Decl *poly = name.resolved_decl;
|
Ast_Decl *poly = name.resolved_decl;
|
||||||
assert(replacements.len == poly->polymorph_parameters.len);
|
assert(replacements.len == poly->polymorph_parameters.len);
|
||||||
Ast_Decl *instance = get_or_instantiate_polymorph_type(node->pos, poly, replacements, field_access_scope);
|
Ast_Decl *instance = get_or_instantiate_polymorph_type(node->pos, poly, replacements, field_access_scope);
|
||||||
|
node->resolved_decl = instance;
|
||||||
lambda = instance->lambda;
|
lambda = instance->lambda;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1723,8 +1724,8 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
}
|
}
|
||||||
node->exprs = items.tight_copy(pctx->perm);
|
node->exprs = items.tight_copy(pctx->perm);
|
||||||
|
|
||||||
node->resolved_type = lambda->resolved_type->func.ret;
|
node->resolved_type = lambda->resolved_type;
|
||||||
return operand_rvalue(node->resolved_type);
|
return operand_rvalue(node->resolved_type->func.ret);
|
||||||
//
|
//
|
||||||
// CALL End
|
// CALL End
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user