From 2e3154428501d745f3f6e6e67231420cadb43bb4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 7 Jun 2025 12:42:03 -0700 Subject: [PATCH] seriously don't put internpool indexes in test cases --- .../compile_errors/@import_zon_bad_type.zig | 125 ------------------ .../anytype_param_requires_comptime.zig | 20 --- .../bogus_method_call_on_slice.zig | 20 --- .../compile_errors/coerce_anon_struct.zig | 11 -- test/cases/compile_errors/redundant_try.zig | 52 -------- 5 files changed, 228 deletions(-) delete mode 100644 test/cases/compile_errors/@import_zon_bad_type.zig delete mode 100644 test/cases/compile_errors/anytype_param_requires_comptime.zig delete mode 100644 test/cases/compile_errors/bogus_method_call_on_slice.zig delete mode 100644 test/cases/compile_errors/coerce_anon_struct.zig delete mode 100644 test/cases/compile_errors/redundant_try.zig diff --git a/test/cases/compile_errors/@import_zon_bad_type.zig b/test/cases/compile_errors/@import_zon_bad_type.zig deleted file mode 100644 index 88bf6205dd..0000000000 --- a/test/cases/compile_errors/@import_zon_bad_type.zig +++ /dev/null @@ -1,125 +0,0 @@ -export fn testVoid() void { - const f: void = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testInStruct() void { - const f: struct { f: [*]const u8 } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testError() void { - const f: struct { error{foo} } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testInUnion() void { - const f: union(enum) { a: void, b: [*c]const u8 } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testInVector() void { - const f: @Vector(0, [*c]const u8) = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testInOpt() void { - const f: *const ?[*c]const u8 = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testComptimeField() void { - const f: struct { comptime foo: ??u8 = null } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testEnumLiteral() void { - const f: @TypeOf(.foo) = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testNestedOpt1() void { - const f: ??u8 = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testNestedOpt2() void { - const f: ?*const ?u8 = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testNestedOpt3() void { - const f: *const ?*const ?*const u8 = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testOpt() void { - const f: ?u8 = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testNonExhaustiveEnum() void { - const f: enum(u8) { _ } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testUntaggedUnion() void { - const f: union { foo: void } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testTaggedUnionVoid() void { - const f: union(enum) { foo: void } = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testVisited() void { - const V = struct { - ?f32, // Adds `?f32` to the visited list - ??f32, // `?f32` is already visited, we need to detect the nested opt anyway - f32, - }; - const f: V = @import("zon/neg_inf.zon"); - _ = f; -} - -export fn testMutablePointer() void { - const f: *i32 = @import("zon/neg_inf.zon"); - _ = f; -} - -// error -// imports=zon/neg_inf.zon -// -// tmp.zig:2:29: error: type 'void' is not available in ZON -// tmp.zig:7:50: error: type '[*]const u8' is not available in ZON -// tmp.zig:7:50: note: ZON does not allow many-pointers -// tmp.zig:12:46: error: type 'error{foo}' is not available in ZON -// tmp.zig:17:65: error: type '[*c]const u8' is not available in ZON -// tmp.zig:17:65: note: ZON does not allow C pointers -// tmp.zig:22:49: error: type '[*c]const u8' is not available in ZON -// tmp.zig:22:49: note: ZON does not allow C pointers -// tmp.zig:27:45: error: type '[*c]const u8' is not available in ZON -// tmp.zig:27:45: note: ZON does not allow C pointers -// tmp.zig:32:61: error: type '??u8' is not available in ZON -// tmp.zig:32:61: note: ZON does not allow nested optionals -// tmp.zig:42:29: error: type '??u8' is not available in ZON -// tmp.zig:42:29: note: ZON does not allow nested optionals -// tmp.zig:47:36: error: type '?*const ?u8' is not available in ZON -// tmp.zig:47:36: note: ZON does not allow nested optionals -// tmp.zig:52:50: error: type '?*const ?*const u8' is not available in ZON -// tmp.zig:52:50: note: ZON does not allow nested optionals -// tmp.zig:82:26: error: type '??f32' is not available in ZON -// tmp.zig:82:26: note: ZON does not allow nested optionals -// tmp.zig:87:29: error: type '*i32' is not available in ZON -// tmp.zig:87:29: note: ZON does not allow mutable pointers -// neg_inf.zon:1:1: error: expected type '@Type(.enum_literal)' -// tmp.zig:37:38: note: imported here -// neg_inf.zon:1:1: error: expected type '?u8' -// tmp.zig:57:28: note: imported here -// neg_inf.zon:1:1: error: expected type 'tmp.testNonExhaustiveEnum__enum_525' -// tmp.zig:62:39: note: imported here -// neg_inf.zon:1:1: error: expected type 'tmp.testUntaggedUnion__union_527' -// tmp.zig:67:44: note: imported here -// neg_inf.zon:1:1: error: expected type 'tmp.testTaggedUnionVoid__union_530' -// tmp.zig:72:50: note: imported here diff --git a/test/cases/compile_errors/anytype_param_requires_comptime.zig b/test/cases/compile_errors/anytype_param_requires_comptime.zig deleted file mode 100644 index 7bbb1d3c6e..0000000000 --- a/test/cases/compile_errors/anytype_param_requires_comptime.zig +++ /dev/null @@ -1,20 +0,0 @@ -const S = struct { - fn foo(b: u32, c: anytype) void { - const C = struct { - c: @TypeOf(c), - b: u32, - }; - bar(C{ .c = c, .b = b }); - } - fn bar(_: anytype) void {} -}; -pub export fn entry() void { - S.foo(0, u32); -} - -// error -// -// :7:25: error: unable to resolve comptime value -// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_499.C' must be comptime-known -// :4:16: note: struct requires comptime because of this field -// :4:16: note: types are not available at runtime diff --git a/test/cases/compile_errors/bogus_method_call_on_slice.zig b/test/cases/compile_errors/bogus_method_call_on_slice.zig deleted file mode 100644 index b5ffe15549..0000000000 --- a/test/cases/compile_errors/bogus_method_call_on_slice.zig +++ /dev/null @@ -1,20 +0,0 @@ -var self = "aoeu"; -fn f(m: []const u8) void { - m.copy(u8, self[0..], m); -} -export fn entry() usize { - return @sizeOf(@TypeOf(&f)); -} -pub export fn entry1() void { - .{}.bar(); -} -pub export fn entry2() void { - .{ .foo = 1 }.bar(); -} - -// error -// -// :3:6: error: no field or member function named 'copy' in '[]const u8' -// :9:8: error: no field or member function named 'bar' in '@TypeOf(.{})' -// :12:18: error: no field or member function named 'bar' in 'tmp.entry2__struct_503' -// :12:6: note: struct declared here diff --git a/test/cases/compile_errors/coerce_anon_struct.zig b/test/cases/compile_errors/coerce_anon_struct.zig deleted file mode 100644 index 2de29e8aae..0000000000 --- a/test/cases/compile_errors/coerce_anon_struct.zig +++ /dev/null @@ -1,11 +0,0 @@ -const T = struct { x: u32 }; -export fn foo() void { - const a = .{ .x = 123 }; - _ = @as(T, a); -} - -// error -// -// :4:16: error: expected type 'tmp.T', found 'tmp.foo__struct_492' -// :3:16: note: struct declared here -// :1:11: note: struct declared here diff --git a/test/cases/compile_errors/redundant_try.zig b/test/cases/compile_errors/redundant_try.zig deleted file mode 100644 index 19d8070f80..0000000000 --- a/test/cases/compile_errors/redundant_try.zig +++ /dev/null @@ -1,52 +0,0 @@ -const S = struct { x: u32 = 0 }; -const T = struct { []const u8 }; - -fn test0() !void { - const x: u8 = try 1; - _ = x; -} - -fn test1() !void { - const x: S = try .{}; - _ = x; -} - -fn test2() !void { - const x: S = try .{ .x = 123 }; - _ = x; -} - -fn test3() !void { - const x: S = try try .{ .x = 123 }; - _ = x; -} - -fn test4() !void { - const x: T = try .{"hello"}; - _ = x; -} - -fn test5() !void { - const x: error{Foo}!u32 = 123; - _ = try try x; -} - -comptime { - _ = &test0; - _ = &test1; - _ = &test2; - _ = &test3; - _ = &test4; - _ = &test5; -} - -// error -// -// :5:23: error: expected error union type, found 'comptime_int' -// :10:23: error: expected error union type, found '@TypeOf(.{})' -// :15:23: error: expected error union type, found 'tmp.test2__struct_529' -// :15:23: note: struct declared here -// :20:27: error: expected error union type, found 'tmp.test3__struct_531' -// :20:27: note: struct declared here -// :25:23: error: expected error union type, found 'struct { comptime *const [5:0]u8 = "hello" }' -// :31:13: error: expected error union type, found 'u32'