From a239d8d4e2c0e5a7f3eb4b9973f869afdb3bbe05 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sun, 18 Aug 2024 16:01:29 +0100 Subject: [PATCH] test: add incremental case --- test/incremental/type_becomes_comptime_only | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/incremental/type_becomes_comptime_only diff --git a/test/incremental/type_becomes_comptime_only b/test/incremental/type_becomes_comptime_only new file mode 100644 index 0000000000..2dfa556e87 --- /dev/null +++ b/test/incremental/type_becomes_comptime_only @@ -0,0 +1,39 @@ +#target=x86_64-linux +#update=initial version +#file=main.zig +const SomeType = u32; +const S = struct { + x: SomeType, + fn foo(_: S) void {} +}; +pub fn main() void { + const s: S = .{ .x = 456 }; + s.foo(); +} +#expect_stdout="" + +#update=make S comptime-only +#file=main.zig +const SomeType = comptime_int; +const S = struct { + x: SomeType, + fn foo(_: S) void {} +}; +pub fn main() void { + const s: S = .{ .x = 456 }; + s.foo(); +} +#expect_stdout="" + +#update=make S runtime again +#file=main.zig +const SomeType = u16; +const S = struct { + x: SomeType, + fn foo(_: S) void {} +}; +pub fn main() void { + const s: S = .{ .x = 456 }; + s.foo(); +} +#expect_stdout=""