From dd58278dbe8ac89a9e685a966b5f05f80f463798 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 18 Feb 2020 15:28:14 -0500 Subject: [PATCH] add behavior test for previous commit --- test/stage1/behavior/type_info.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig index 9d577ec0b4a95d0b1062065964910606df174ade..a3988cba6d4de766642fca7d477e6a8325e1af66 100644 --- a/test/stage1/behavior/type_info.zig +++ b/test/stage1/behavior/type_info.zig @@ -375,3 +375,14 @@ test "sentinel of opaque pointer type" { const c_void_info = @typeInfo(*c_void); expect(c_void_info.Pointer.sentinel == null); } + +test "@typeInfo does not force declarations into existence" { + const S = struct { + x: i32, + + fn doNotReferenceMe() void { + @compileError("test failed"); + } + }; + comptime expect(@typeInfo(S).Struct.fields.len == 1); +} -- 2.54.0