| ... | @@ -375,3 +375,14 @@ test "sentinel of opaque pointer type" { | ... | @@ -375,3 +375,14 @@ test "sentinel of opaque pointer type" { |
| 375 | const c_void_info = @typeInfo(*c_void); | 375 | const c_void_info = @typeInfo(*c_void); |
| 376 | expect(c_void_info.Pointer.sentinel == null); | 376 | expect(c_void_info.Pointer.sentinel == null); |
| 377 | } | 377 | } |
| | 378 | |
| | 379 | test "@typeInfo does not force declarations into existence" { |
| | 380 | const S = struct { |
| | 381 | x: i32, |
| | 382 | |
| | 383 | fn doNotReferenceMe() void { |
| | 384 | @compileError("test failed"); |
| | 385 | } |
| | 386 | }; |
| | 387 | comptime expect(@typeInfo(S).Struct.fields.len == 1); |
| | 388 | } |