aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-07-10 11:27:38 +0100
committergingerBill <bill@gingerbill.org>2021-07-10 11:27:38 +0100
commit8b1bfc80fbc51e84e3b10bc284243457731e4929 (patch)
treee42d468d9c27ce97d9d3bdf59d1455e2b7c87ff5 /src/check_expr.cpp
parent366227511912bf6aec670f187437c48ddb09293b (diff)
Fix #1051
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 68909acaa..be9b311d1 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -3826,7 +3826,9 @@ Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *typ
Type *swizzle_array_type = nullptr;
Type *bth = base_type(type_hint);
- if (bth != nullptr && bth->kind == Type_Array && bth->Array.count == index_count) {
+ if (bth != nullptr && bth->kind == Type_Array &&
+ bth->Array.count == index_count &&
+ are_types_identical(bth->Array.elem, array_type->Array.elem)) {
swizzle_array_type = type_hint;
} else {
swizzle_array_type = alloc_type_array(array_type->Array.elem, index_count);