aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-29 12:30:27 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-30 00:18:08 +0300
commit4758752e5d64a3e36086483de569188f62519bac (patch)
tree02f7d749c89629a54847186f2be6e8ead61886ce /test/behavior
parent17622b9db14cb1d8dd600b21f60c8a1041e5b0e1 (diff)
downloadzig-4758752e5d64a3e36086483de569188f62519bac.tar.gz
zig-4758752e5d64a3e36086483de569188f62519bac.zip
Sema: implement coercion from tuples to tuples
Closes #12242
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/tuple.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 4c43ef6be6..14297bd61c 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -275,3 +275,18 @@ test "tuple in tuple passed to generic function" {
const x = comptime S.pair(1.5, 2.5);
try S.foo(.{x});
}
+
+test "coerce tuple to tuple" {
+ if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
+ const T = std.meta.Tuple(&.{u8});
+ const S = struct {
+ fn foo(x: T) !void {
+ try expect(x[0] == 123);
+ }
+ };
+ try S.foo(.{123});
+}