diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-09-17 22:30:49 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-09-17 22:30:49 -0400 |
| commit | 914ad1ec2eff4ea9061804ad0da9cde7dd6543b6 (patch) | |
| tree | 387ccac6981a2c0ab0ce4698ed3363cc4f49c082 /test | |
| parent | c6e77f248d3771070162d80341f9aeef89a49924 (diff) | |
| download | zig-914ad1ec2eff4ea9061804ad0da9cde7dd6543b6.tar.gz zig-914ad1ec2eff4ea9061804ad0da9cde7dd6543b6.zip | |
fix peer result location with typed parent, ...
...runtime condition, comptime prongs.
closes #3244
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/misc.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/stage1/behavior/misc.zig b/test/stage1/behavior/misc.zig index c122b18e0a..613bb9ac54 100644 --- a/test/stage1/behavior/misc.zig +++ b/test/stage1/behavior/misc.zig @@ -721,3 +721,23 @@ test "global variable assignment with optional unwrapping with var initialized t }; expect(global_foo.* == 1234); } + +test "peer result location with typed parent, runtime condition, comptime prongs" { + const S = struct { + fn doTheTest(arg: i32) i32 { + const st = Structy{ + .bleh = if (arg == 1) 1 else 1, + }; + + if (st.bleh == 1) + return 1234; + return 0; + } + + const Structy = struct { + bleh: i32, + }; + }; + expect(S.doTheTest(0) == 1234); + expect(S.doTheTest(1) == 1234); +} |
