aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-02-26 15:09:32 +0000
committergingerBill <bill@gingerbill.org>2021-02-26 15:09:32 +0000
commit575c7ff031f67ec4c479fa1cd6e22491e2b7a79e (patch)
treed30c6d1dc0c141937d86f4385161b79f06af30a8 /src/check_type.cpp
parentac155d90368214e2625230055573fdd17578c6e6 (diff)
Patch issue with minimum dependency system and how it interacts with para poly procedures
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp19
1 files changed, 19 insertions, 0 deletions
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);