aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index dc0e5aaf30..a69df862c1 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1074,3 +1074,15 @@ test "switch inside @as gets correct type" {
else => 0,
});
}
+
+test "inline call of function with a switch inside the return statement" {
+ const S = struct {
+ inline fn foo(x: anytype) @TypeOf(x) {
+ return switch (x) {
+ 1 => 1,
+ else => unreachable,
+ };
+ }
+ };
+ try expect(S.foo(1) == 1);
+}