| 1 | #update=initial version |
| 2 | #file=main.zig |
| 3 | const std = @import("std"); |
| 4 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 5 | |
| 6 | const A = enum(u32) { |
| 7 | zero, |
| 8 | one, |
| 9 | }; |
| 10 | |
| 11 | fn foo() !void { |
| 12 | try bar(.zero); |
| 13 | } |
| 14 | |
| 15 | fn bar(a: A) !void { |
| 16 | const msg = switch (a) { |
| 17 | .zero => "0", |
| 18 | .one => "1", |
| 19 | }; |
| 20 | try std.Io.File.stdout().writeStreamingAll(io, msg); |
| 21 | } |
| 22 | |
| 23 | pub fn main() !void { |
| 24 | try foo(); |
| 25 | } |
| 26 | #expect_stdout="0" |
| 27 | #update=remove foo and change bar wasm function type |
| 28 | #file=main.zig |
| 29 | //! This update must preserve `bar` `InternPool.Index` value, while changing its wasm function type. |
| 30 | //! If `foo` code is preserved in the binary without any changes, wasm type checking will fail. |
| 31 | const std = @import("std"); |
| 32 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 33 | |
| 34 | const A = enum(u64) { |
| 35 | zero, |
| 36 | one, |
| 37 | }; |
| 38 | |
| 39 | fn bar(a: A) !void { |
| 40 | const msg = switch (a) { |
| 41 | .zero => "0", |
| 42 | .one => "1", |
| 43 | }; |
| 44 | try std.Io.File.stdout().writeStreamingAll(io, msg); |
| 45 | } |
| 46 | |
| 47 | pub fn main() !void { |
| 48 | try bar(.one); |
| 49 | } |
| 50 | #expect_stdout="1" |