aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-07 10:20:34 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-14 22:07:25 -0700
commitce88c43a4ee94d82a64e7580885dc6693cc6120c (patch)
tree2ec2dd9966ff2f96186d13872031c074a81e50bc /src/type.zig
parent610b02c432072c85f079f3ddf315cb864aa5dbf5 (diff)
downloadzig-ce88c43a4ee94d82a64e7580885dc6693cc6120c.tar.gz
zig-ce88c43a4ee94d82a64e7580885dc6693cc6120c.zip
Sema: allow indexing tuple and vector pointers
Resolves: #13852 Resolves: #14705
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig
index 4269ee56d3..22523a7141 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2832,7 +2832,11 @@ pub const Type = struct {
.Array, .Vector => true,
.Pointer => switch (ty.ptrSize(mod)) {
.Slice, .Many, .C => true,
- .One => ty.childType(mod).zigTypeTag(mod) == .Array,
+ .One => switch (ty.childType(mod).zigTypeTag(mod)) {
+ .Array, .Vector => true,
+ .Struct => ty.childType(mod).isTuple(mod),
+ else => false,
+ },
},
.Struct => ty.isTuple(mod),
else => false,
@@ -2845,7 +2849,11 @@ pub const Type = struct {
.Pointer => switch (ty.ptrSize(mod)) {
.Many, .C => false,
.Slice => true,
- .One => ty.childType(mod).zigTypeTag(mod) == .Array,
+ .One => switch (ty.childType(mod).zigTypeTag(mod)) {
+ .Array, .Vector => true,
+ .Struct => ty.childType(mod).isTuple(mod),
+ else => false,
+ },
},
.Struct => ty.isTuple(mod),
else => false,