1#update=initial version
2#file=main.zig
3const std = @import("std");
4const io = std.Io.Threaded.global_single_threaded.io();
5
6const A = enum(u32) {
7 zero,
8 one,
9};
10
11fn foo() !void {
12 try bar(.zero);
13}
14
15fn 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
23pub 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.
31const std = @import("std");
32const io = std.Io.Threaded.global_single_threaded.io();
33
34const A = enum(u64) {
35 zero,
36 one,
37};
38
39fn 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
47pub fn main() !void {
48 try bar(.one);
49}
50#expect_stdout="1"