Fixed demo

This commit is contained in:
Ginger Bill
2017-06-27 15:58:53 +01:00
parent 260089431e
commit 5df854fcef
4 changed files with 65 additions and 39 deletions
+5 -10
View File
@@ -1448,19 +1448,10 @@ void check_procedure_overloading(Checker *c, Entity *e) {
TokenPos pos = q->token.pos;
if (q->type == NULL) {
if (q->type == NULL || q->type == t_invalid) {
continue;
}
if (is_type_proc(q->type)) {
TypeProc *ptq = &base_type(q->type)->Proc;
if (ptq->is_generic) {
q->type = t_invalid;
error(q->token, "Polymorphic procedure `%.*s` cannot be overloaded", LIT(name));
continue;
}
}
ProcTypeOverloadKind kind = are_proc_types_overload_safe(p->type, q->type);
switch (kind) {
case ProcOverload_Identical:
@@ -1480,6 +1471,10 @@ void check_procedure_overloading(Checker *c, Entity *e) {
error(p->token, "Overloaded procedure `%.*s` as the same parameters but different results in this scope", LIT(name));
is_invalid = true;
break;
case ProcOverload_Polymorphic:
error(p->token, "Overloaded procedure `%.*s` has a polymorphic counterpart in this scope which is not allowed", LIT(name));
is_invalid = true;
break;
case ProcOverload_ParamCount:
case ProcOverload_ParamTypes:
// This is okay :)