From a5ff983266f0a5e0717fcffb0cd1d3449b68b3a7 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 4 May 2019 13:11:56 +0100 Subject: Fix parapoly related bugs #370 --- src/check_type.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index f9f45361e..bd3271dcf 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -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) { -- cgit v1.2.3