| ... | ... | @@ -400,14 +400,21 @@ fn fmtPathFile( |
| 400 | 400 | defer operators_to_fix.deinit(gpa); |
| 401 | 401 | |
| 402 | 402 | // Gather ambiguous operator precedence error tokens for quick lookup later |
| 403 | var remaining_errors: usize = tree.errors.len; |
| 403 | 404 | for (tree.errors) |err| { |
| 404 | 405 | switch (err.tag) { |
| 405 | 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 | 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 | 418 | else => continue, |
| 412 | 419 | } |
| 413 | 420 | } |
| ... | ... | @@ -415,7 +422,7 @@ fn fmtPathFile( |
| 415 | 422 | if (operators_to_fix.count() == 0) break :fix; |
| 416 | 423 | |
| 417 | 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 | 426 | for (tree.errors) |err| { |
| 420 | 427 | switch (err.tag) { |
| 421 | 428 | .ambiguous_operator_precedence, |