| author | |
| committer | |
| log | a7cac5fc8ed2d49badc6a07ee2e4e77f4ac6e6ae |
| tree | 04db91090ca45afd02b3f41b5e28e7c946a444e9 |
| parent | 2c4ac44f25743f5b7ae9db6bc570ab71f15fd83b |
| signature |
3 files changed, 30 insertions(+), 13 deletions(-)
test/behavior/generics.zig+6-2| ... | @@ -371,8 +371,12 @@ test "extern function used as generic parameter" { | ... | @@ -371,8 +371,12 @@ test "extern function used as generic parameter" { |
| 371 | const S = struct { | 371 | const S = struct { |
| 372 | extern fn usedAsGenericParameterFoo() void; | 372 | extern fn usedAsGenericParameterFoo() void; |
| 373 | extern fn usedAsGenericParameterBar() void; | 373 | extern fn usedAsGenericParameterBar() void; |
| 374 | inline fn usedAsGenericParameterBaz(comptime _: anytype) type { | 374 | inline fn usedAsGenericParameterBaz(comptime token: anytype) type { |
| 375 | return struct {}; | 375 | return struct { |
| 376 | comptime { | ||
| 377 | _ = token; | ||
| 378 | } | ||
| 379 | }; | ||
| 376 | } | 380 | } |
| 377 | }; | 381 | }; |
| 378 | try expect(S.usedAsGenericParameterBaz(S.usedAsGenericParameterFoo) != | 382 | try expect(S.usedAsGenericParameterBaz(S.usedAsGenericParameterFoo) != |
test/behavior/src.zig+6-2| ... | @@ -23,8 +23,12 @@ test "@src" { | ... | @@ -23,8 +23,12 @@ test "@src" { |
| 23 | 23 | ||
| 24 | test "@src used as a comptime parameter" { | 24 | test "@src used as a comptime parameter" { |
| 25 | const S = struct { | 25 | const S = struct { |
| 26 | fn Foo(comptime _: std.builtin.SourceLocation) type { | 26 | fn Foo(comptime src: std.builtin.SourceLocation) type { |
| 27 | return struct {}; | 27 | return struct { |
| 28 | comptime { | ||
| 29 | _ = src; | ||
| 30 | } | ||
| 31 | }; | ||
| 28 | } | 32 | } |
| 29 | }; | 33 | }; |
| 30 | const T1 = S.Foo(@src()); | 34 | const T1 = S.Foo(@src()); |
test/behavior/typename.zig+18-9| ... | @@ -164,21 +164,30 @@ test "fn param" { | ... | @@ -164,21 +164,30 @@ test "fn param" { |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | fn TypeFromFn(comptime T: type) type { | 166 | fn TypeFromFn(comptime T: type) type { |
| 167 | _ = T; | 167 | return struct { |
| 168 | return struct {}; | 168 | comptime { |
| 169 | _ = T; | ||
| 170 | } | ||
| 171 | }; | ||
| 169 | } | 172 | } |
| 170 | 173 | ||
| 171 | fn TypeFromFn2(comptime T1: type, comptime T2: type) type { | 174 | fn TypeFromFn2(comptime T1: type, comptime T2: type) type { |
| 172 | _ = T1; | 175 | return struct { |
| 173 | _ = T2; | 176 | comptime { |
| 174 | return struct {}; | 177 | _ = T1; |
| 178 | _ = T2; | ||
| 179 | } | ||
| 180 | }; | ||
| 175 | } | 181 | } |
| 176 | 182 | ||
| 177 | fn TypeFromFnB(comptime T1: type, comptime T2: type, comptime T3: type) type { | 183 | fn TypeFromFnB(comptime T1: type, comptime T2: type, comptime T3: type) type { |
| 178 | _ = T1; | 184 | return struct { |
| 179 | _ = T2; | 185 | comptime { |
| 180 | _ = T3; | 186 | _ = T1; |
| 181 | return struct {}; | 187 | _ = T2; |
| 188 | _ = T3; | ||
| 189 | } | ||
| 190 | }; | ||
| 182 | } | 191 | } |
| 183 | 192 | ||
| 184 | /// Replaces integers in `actual` with '0' before doing the test. | 193 | /// Replaces integers in `actual` with '0' before doing the test. |