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