Fix parapoly related bugs #370

This commit is contained in:
gingerBill
2019-05-04 13:11:56 +01:00
parent a46a1f5f34
commit a5ff983266
2 changed files with 37 additions and 10 deletions
+14
View File
@@ -1554,6 +1554,13 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is
success = false;
type = t_invalid;
}
if (is_type_untyped(default_type(type))) {
gbString str = type_to_string(type);
error(o.expr, "Cannot determine type from the parameter, got '%s'", str);
gb_string_free(str);
success = false;
type = t_invalid;
}
bool modify_type = !ctx->no_polymorphic_errors;
if (specialization != nullptr && !check_type_specialization_to(ctx, specialization, type, false, modify_type)) {
@@ -1604,6 +1611,13 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is
success = false;
}
}
if (is_type_untyped(default_type(type))) {
gbString str = type_to_string(type);
error(op.expr, "Cannot determine type from the parameter, got '%s'", str);
gb_string_free(str);
success = false;
type = t_invalid;
}
}
if (p->flags&FieldFlag_no_alias) {