| ... | @@ -400,14 +400,21 @@ fn fmtPathFile( | ... | @@ -400,14 +400,21 @@ fn fmtPathFile( |
| 400 | defer operators_to_fix.deinit(gpa); | 400 | defer operators_to_fix.deinit(gpa); |
| 401 | | 401 | |
| 402 | // Gather ambiguous operator precedence error tokens for quick lookup later | 402 | // Gather ambiguous operator precedence error tokens for quick lookup later |
| | 403 | var remaining_errors: usize = tree.errors.len; |
| 403 | for (tree.errors) |err| { | 404 | for (tree.errors) |err| { |
| 404 | switch (err.tag) { | 405 | switch (err.tag) { |
| 405 | .hint_operator_precedence_left => { | 406 | .hint_operator_precedence_left => { |
| 406 | try operators_to_fix.putNoClobber(gpa, err.token - @as(u32, @intCast(err.extra.offset)), {}); | 407 | try operators_to_fix.put(gpa, err.token - @as(u32, @intCast(err.extra.offset)), {}); |
| | 408 | remaining_errors -= 1; |
| 407 | }, | 409 | }, |
| 408 | .hint_operator_precedence_right => { | 410 | .hint_operator_precedence_right => { |
| 409 | try operators_to_fix.putNoClobber(gpa, err.token, {}); | 411 | try operators_to_fix.put(gpa, err.token, {}); |
| | 412 | remaining_errors -= 1; |
| 410 | }, | 413 | }, |
| | 414 | .ambiguous_operator_precedence, |
| | 415 | .illegal_chained_operators, |
| | 416 | .previous_ambiguous_operator, |
| | 417 | => remaining_errors -= 1, |
| 411 | else => continue, | 418 | else => continue, |
| 412 | } | 419 | } |
| 413 | } | 420 | } |
| ... | @@ -415,7 +422,7 @@ fn fmtPathFile( | ... | @@ -415,7 +422,7 @@ fn fmtPathFile( |
| 415 | if (operators_to_fix.count() == 0) break :fix; | 422 | if (operators_to_fix.count() == 0) break :fix; |
| 416 | | 423 | |
| 417 | // Build a new error list without the ambiguous operator precedence errors/notes | 424 | // Build a new error list without the ambiguous operator precedence errors/notes |
| 418 | var fixed_errors: std.ArrayList(std.zig.Ast.Error) = try .initCapacity(gpa, tree.errors.len - (operators_to_fix.count() * 3)); | 425 | var fixed_errors: std.ArrayList(std.zig.Ast.Error) = try .initCapacity(gpa, remaining_errors); |
| 419 | for (tree.errors) |err| { | 426 | for (tree.errors) |err| { |
| 420 | switch (err.tag) { | 427 | switch (err.tag) { |
| 421 | .ambiguous_operator_precedence, | 428 | .ambiguous_operator_precedence, |