aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-05-07 11:51:06 +0100
committergingerBill <bill@gingerbill.org>2024-05-07 11:51:06 +0100
commit0cec2d7827a537557555bf6c92c2f090113806a4 (patch)
treee6e3c8775f0c00e2ca0eb36cd0c3ad402e99de68 /src/check_type.cpp
parent8d96c685288c1242900cc106258ffdb29a8d86e7 (diff)
Fix #3527
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 6efac54d6..ea249c293 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1430,6 +1430,10 @@ gb_internal bool check_type_specialization_to(CheckerContext *ctx, Type *special
bool can_convert = check_cast_internal(ctx, &o, specialization);
return can_convert;
} else if (t->kind == Type_Struct) {
+ if (t->Struct.polymorphic_parent == nullptr &&
+ t == s) {
+ return true;
+ }
if (t->Struct.polymorphic_parent == specialization) {
return true;
}
@@ -1479,6 +1483,10 @@ gb_internal bool check_type_specialization_to(CheckerContext *ctx, Type *special
return true;
}
} else if (t->kind == Type_Union) {
+ if (t->Union.polymorphic_parent == nullptr &&
+ t == s) {
+ return true;
+ }
if (t->Union.polymorphic_parent == specialization) {
return true;
}