From 575c7ff031f67ec4c479fa1cd6e22491e2b7a79e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 26 Feb 2021 15:09:32 +0000 Subject: Patch issue with minimum dependency system and how it interacts with para poly procedures --- src/check_type.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 6377f4e6e..604dfd420 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1674,6 +1674,25 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is } } } + if (type != t_invalid && !check_is_assignable_to(ctx, &op, type)) { + bool ok = true; + if (p->flags&FieldFlag_auto_cast) { + if (!check_is_castable_to(ctx, &op, type)) { + ok = false; + } + } + if (!ok) { + if (false) { + gbString got = type_to_string(op.type); + gbString expected = type_to_string(type); + error(op.expr, "Cannot assigned type to parameter, got type '%s', expected '%s'", got, expected); + gb_string_free(expected); + gb_string_free(got); + } + 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); -- cgit v1.2.3