| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | const Foo = @Struct(.auto, null, &.{"reified_field"}, &.{void}, &.{.{}}); |
| 7 | pub fn main(init: std.process.Init) !void { |
| 8 | const field_name = @typeInfo(Foo).@"struct".field_names[0]; |
| 9 | try std.Io.File.stdout().writeStreamingAll(init.io, field_name ++ "\n"); |
| 10 | } |
| 11 | const std = @import("std"); |
| 12 | #} |
| 13 | #update |
| 14 | #check stdout { |
| 15 | reified_field |
| 16 | #} |
| 17 | |
| 18 | #write main.zig { |
| 19 | const Foo = @TypeOf(.{ .anon_field = 123 }); |
| 20 | pub fn main(init: std.process.Init) !void { |
| 21 | const field_name = @typeInfo(Foo).@"struct".field_names[0]; |
| 22 | try std.Io.File.stdout().writeStreamingAll(init.io, field_name ++ "\n"); |
| 23 | } |
| 24 | const std = @import("std"); |
| 25 | #} |
| 26 | #update "change to `@TypeOf` anonymous init" |
| 27 | #check stdout { |
| 28 | anon_field |
| 29 | #} |