authorgravatar for prokop@rdck.devProkop Randáček <prokop@rdck.dev> 2025-11-21 08:24:16+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-20 08:06:59+01:00
log442592855c655f20b8b51db9ac75e17485c4e685
tree486b7f9f565bfb399fc41fad3225536bb3ffbf56
parent5fa7f13082145c10d0b536cc894f60323ffacd61

change placeholder pattern in deduplicated type errors


4 files changed, 12 insertions(+), 13 deletions(-)

src/Type.zig+3-3
...@@ -4158,8 +4158,8 @@ fn shouldDedupeType(ty: Type, ctx: *Comparison, pt: Zcu.PerThread) error{OutOfMe...@@ -4158,8 +4158,8 @@ fn shouldDedupeType(ty: Type, ctx: *Comparison, pt: Zcu.PerThread) error{OutOfMe
41584158
4159 const type_len: i32 = @intCast(discarding.count);4159 const type_len: i32 = @intCast(discarding.count);
41604160
4161 const placeholder_len: i32 = 3;4161 const placeholder_len: i32 = 1;
4162 const min_saved_bytes: i32 = 10;4162 const min_saved_bytes: i32 = 20;
41634163
4164 const saved_bytes = (type_len - placeholder_len) * (occ - 1);4164 const saved_bytes = (type_len - placeholder_len) * (occ - 1);
4165 const max_placeholders = 7; // T to Z4165 const max_placeholders = 7; // T to Z
...@@ -4192,7 +4192,7 @@ pub const Comparison = struct {...@@ -4192,7 +4192,7 @@ pub const Comparison = struct {
4192 index: u8,4192 index: u8,
41934193
4194 pub fn format(p: Placeholder, writer: *std.Io.Writer) error{WriteFailed}!void {4194 pub fn format(p: Placeholder, writer: *std.Io.Writer) error{WriteFailed}!void {
4195 return writer.print("<{c}>", .{p.index + 'T'});4195 return writer.print("{c}", .{p.index + 'T'});
4196 }4196 }
4197 };4197 };
41984198
test/cases/compile_errors/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig+1-2
...@@ -16,8 +16,7 @@ comptime {...@@ -16,8 +16,7 @@ comptime {
16//16//
17// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'17// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'
18// :2:29: note: cast discards const qualifier18// :2:29: note: cast discards const qualifier
19// :6:31: error: expected type '*<T>', found '*const <T>'19// :6:31: error: expected type '*[2][]const u8', found '*const [2][]const u8'
20// :6:31: note: <T> = [2][]const u8
21// :6:31: note: cast discards const qualifier20// :6:31: note: cast discards const qualifier
22// :11:19: error: expected type '*tmp.S', found '*const tmp.S'21// :11:19: error: expected type '*tmp.S', found '*const tmp.S'
23// :11:19: note: cast discards const qualifier22// :11:19: note: cast discards const qualifier
test/cases/compile_errors/type_dedupe.zig+6-6
...@@ -1,18 +1,18 @@...@@ -1,18 +1,18 @@
1const SomeVeryLongName = struct {};1const SomeVeryVeryVeryLongName = struct {};
22
3fn foo(a: *SomeVeryLongName) void {3fn foo(a: *SomeVeryVeryVeryLongName) void {
4 _ = a;4 _ = a;
5}5}
66
7export fn entry() void {7export fn entry() void {
8 const a: SomeVeryLongName = .{};8 const a: SomeVeryVeryVeryLongName = .{};
99
10 foo(a);10 foo(a);
11}11}
1212
13// error13// error
14//14//
15// :10:9: error: expected type '*<T>', found '<T>'15// :10:9: error: expected type '*T', found 'T'
16// :10:9: note: <T> = tmp.SomeVeryLongName16// :10:9: note: T = tmp.SomeVeryVeryVeryLongName
17// :1:26: note: struct declared here17// :1:34: note: struct declared here
18// :3:11: note: parameter type declared here18// :3:11: note: parameter type declared here
test/cases/compile_errors/type_mismatch_with_tuple_concatenation.zig+2-2
...@@ -5,5 +5,5 @@ export fn entry() void {...@@ -5,5 +5,5 @@ export fn entry() void {
55
6// error6// error
7//7//
8// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime <T> = 1, comptime <T> = 2, comptime <T> = 3 }'8// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime T = 1, comptime T = 2, comptime T = 3 }'
9// :3:11: note: <T> = comptime_int9// :3:11: note: T = comptime_int