summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2023-01-30 11:39:11 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2023-01-30 11:39:11 +0100
commitdc5ab21052f1f0507d9aa70879a7c58e9fb241a7 (patch)
tree41da9af22ce01e01af9916eef5d5f90a262d93a3 /vala
parent79b6b149219d54fa8b7bf2c3ad367aac4d487cd8 (diff)
downloadvala-dc5ab21052f1f0507d9aa70879a7c58e9fb241a7.tar.gz
vala: Improve compatibility type checks of array elements in assignments
Diffstat (limited to 'vala')
-rw-r--r--vala/valaarraytype.vala6
1 files changed, 6 insertions, 0 deletions
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index a10bce502..59323331f 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -256,6 +256,12 @@ public class Vala.ArrayType : ReferenceType {
if (element_type.compatible (target_array_type.element_type)
&& target_array_type.element_type.compatible (element_type)) {
return true;
+ } else if (element_type.type_symbol is Class) {
+ unowned Class cl = (Class) element_type.type_symbol;
+ if ((!cl.is_compact || cl == context.analyzer.string_type.type_symbol)
+ && element_type.compatible (target_array_type.element_type)) {
+ return true;
+ }
}
return false;