Commit dd58278dbe

Andrew Kelley <andrew@ziglang.org>
2020-02-18 21:28:14
add behavior test for previous commit
1 parent 7560fc7
Changed files (1)
test
stage1
behavior
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);
+}