| ... | ... | @@ -711,3 +711,20 @@ test "inline call propagates comptime-known argument to generic parameter and re |
| 711 | 711 | try expect(a1 == 12340); |
| 712 | 712 | try expect(b1 == 12340); |
| 713 | 713 | } |
| 714 | |
| 715 | test "inline function return type is evaluated at comptime" { |
| 716 | const S = struct { |
| 717 | inline fn assertComptimeAndRet(x: anytype) @TypeOf(x) { |
| 718 | if (!@inComptime()) comptime unreachable; |
| 719 | return x; |
| 720 | } |
| 721 | |
| 722 | inline fn foo(val: anytype) assertComptimeAndRet(u16) { |
| 723 | return val; |
| 724 | } |
| 725 | }; |
| 726 | |
| 727 | const result = S.foo(123); |
| 728 | comptime assert(@TypeOf(result) == u16); |
| 729 | try expect(result == 123); |
| 730 | } |