mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 01:04:43 +01:00
change placeholder pattern in deduplicated type errors
This commit is contained in:
parent
5fa7f13082
commit
442592855c
4 changed files with 12 additions and 13 deletions
|
|
@ -4158,8 +4158,8 @@ fn shouldDedupeType(ty: Type, ctx: *Comparison, pt: Zcu.PerThread) error{OutOfMe
|
|||
|
||||
const type_len: i32 = @intCast(discarding.count);
|
||||
|
||||
const placeholder_len: i32 = 3;
|
||||
const min_saved_bytes: i32 = 10;
|
||||
const placeholder_len: i32 = 1;
|
||||
const min_saved_bytes: i32 = 20;
|
||||
|
||||
const saved_bytes = (type_len - placeholder_len) * (occ - 1);
|
||||
const max_placeholders = 7; // T to Z
|
||||
|
|
@ -4192,7 +4192,7 @@ pub const Comparison = struct {
|
|||
index: u8,
|
||||
|
||||
pub fn format(p: Placeholder, writer: *std.Io.Writer) error{WriteFailed}!void {
|
||||
return writer.print("<{c}>", .{p.index + 'T'});
|
||||
return writer.print("{c}", .{p.index + 'T'});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ comptime {
|
|||
//
|
||||
// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'
|
||||
// :2:29: note: cast discards const qualifier
|
||||
// :6:31: error: expected type '*<T>', found '*const <T>'
|
||||
// :6:31: note: <T> = [2][]const u8
|
||||
// :6:31: error: expected type '*[2][]const u8', found '*const [2][]const u8'
|
||||
// :6:31: note: cast discards const qualifier
|
||||
// :11:19: error: expected type '*tmp.S', found '*const tmp.S'
|
||||
// :11:19: note: cast discards const qualifier
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
const SomeVeryLongName = struct {};
|
||||
const SomeVeryVeryVeryLongName = struct {};
|
||||
|
||||
fn foo(a: *SomeVeryLongName) void {
|
||||
fn foo(a: *SomeVeryVeryVeryLongName) void {
|
||||
_ = a;
|
||||
}
|
||||
|
||||
export fn entry() void {
|
||||
const a: SomeVeryLongName = .{};
|
||||
const a: SomeVeryVeryVeryLongName = .{};
|
||||
|
||||
foo(a);
|
||||
}
|
||||
|
||||
// error
|
||||
//
|
||||
// :10:9: error: expected type '*<T>', found '<T>'
|
||||
// :10:9: note: <T> = tmp.SomeVeryLongName
|
||||
// :1:26: note: struct declared here
|
||||
// :10:9: error: expected type '*T', found 'T'
|
||||
// :10:9: note: T = tmp.SomeVeryVeryVeryLongName
|
||||
// :1:34: note: struct declared here
|
||||
// :3:11: note: parameter type declared here
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ export fn entry() void {
|
|||
|
||||
// error
|
||||
//
|
||||
// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime <T> = 1, comptime <T> = 2, comptime <T> = 3 }'
|
||||
// :3:11: note: <T> = comptime_int
|
||||
// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime T = 1, comptime T = 2, comptime T = 3 }'
|
||||
// :3:11: note: T = comptime_int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue