aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-14 15:45:14 +0000
committergingerBill <bill@gingerbill.org>2018-12-14 15:45:14 +0000
commit57d4333ed3a36778a034f144a6998587d61ed831 (patch)
treec4e8ca307f5ff4fc3ae45822d748df4744f476a9 /src/check_expr.cpp
parent26f11f12aba9176b567fac2bb809e1b821a4ef93 (diff)
Fix polymorphic procedure generation with debug information
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index cb7be9b74..6e4bf05e6 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -265,7 +265,6 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
}
- bool generate_type_again = nctx.no_polymorphic_errors;
auto *pt = &src->Proc;
@@ -293,8 +292,12 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
}
}
-
+#if 0
+ bool generate_type_again = nctx.no_polymorphic_errors;
if (generate_type_again) {
+#else
+ {
+#endif
// LEAK TODO(bill): This is technically a memory leak as it has to generate the type twice
bool prev_no_polymorphic_errors = nctx.no_polymorphic_errors;
defer (nctx.no_polymorphic_errors = prev_no_polymorphic_errors);
@@ -5004,7 +5007,11 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
}
} else {
i64 s = 0;
- if (!check_is_assignable_to_with_score(c, o, e->type, &s)) {
+ if (is_type_generic(o->type)) {
+ // Polymorphic name!
+ score += assign_score_function(0);
+ continue;
+ } else if (!check_is_assignable_to_with_score(c, o, e->type, &s)) {
if (show_error) {
check_assignment(c, o, e->type, str_lit("polymorphic type argument"));
}