| 1 | #update=initial version |
| 2 | #file=main.zig |
| 3 | //! The original repro here depends on re-analysis order, which depends on |
| 4 | //! declaration order, so this exact declaration order must be used. |
| 5 | const Foo = struct { x: u8 }; |
| 6 | pub fn main(init: std.process.Init) !void { |
| 7 | const c = bar('Z').x; |
| 8 | try std.Io.File.stdout().writeStreamingAll(init.io, &.{ c, '\n' }); |
| 9 | } |
| 10 | fn bar(comptime x: u8) @This().Foo { |
| 11 | return .{ .x = x }; |
| 12 | } |
| 13 | const std = @import("std"); |
| 14 | #expect_stdout="Z\n" |
| 15 | |
| 16 | #update=change generic signature to use non-existent member |
| 17 | #file=main.zig |
| 18 | //! The original repro here depends on re-analysis order, which depends on |
| 19 | //! declaration order, so this exact declaration order must be used. |
| 20 | const Foo = struct { x: u8 }; |
| 21 | pub fn main(init: std.process.Init) !void { |
| 22 | const c = bar('Z').x; |
| 23 | try std.Io.File.stdout().writeStreamingAll(init.io, &.{ c, '\n' }); |
| 24 | } |
| 25 | fn bar(comptime x: u8) @This().FooAlias { |
| 26 | return .{ .x = x }; |
| 27 | } |
| 28 | const std = @import("std"); |
| 29 | #expect_error=main.zig:8:31: error: root source file struct 'main' has no member named 'FooAlias' |
| 30 | #expect_error=main.zig:1:1: note: struct declared here |
| 31 | |
| 32 | #update=add that member, fixing the error |
| 33 | #file=main.zig |
| 34 | //! The original repro here depends on re-analysis order, which depends on |
| 35 | //! declaration order, so this exact declaration order must be used. |
| 36 | const Foo = struct { x: u8 }; |
| 37 | const FooAlias = Foo; |
| 38 | pub fn main(init: std.process.Init) !void { |
| 39 | const c = bar('Z').x; |
| 40 | try std.Io.File.stdout().writeStreamingAll(init.io, &.{ c, '\n' }); |
| 41 | } |
| 42 | fn bar(comptime x: u8) @This().FooAlias { |
| 43 | return .{ .x = x }; |
| 44 | } |
| 45 | const std = @import("std"); |
| 46 | #expect_stdout="Z\n" |