Files
Michael Gottesman e2df34f0e2 [Utils] update-verify-tests: support several expected-* directives per line
The diagnostic verifier locates directives by scanning the buffer for
`expected-`, so one line can carry several of them: either sharing a single
comment (`// expected-error{{a}} expected-note{{b}}`) or each opening its
own (`// expected-error{{a}} // expected-note{{b}}`). update-verify-tests
assumed one directive per line and mishandled both forms. The second form
bailed out with "multiple diags on line"; the first parsed only the leading
directive, since the regex requires a `//`, and then attributed every error
reported on that line to it. That either drove its count below zero (an
AssertionError traceback out of decrement_count) or silently rewrote the
wrong directive, leaving the stale one in place.

A Line now holds a list of directives with one `{{DIAG}}` placeholder each,
and directives packed onto an already-open comment are matched by a
continuation regex anchored right after the preceding directive, so a bare
`expected-` in code or a string literal is never mistaken for one. Those
carry no `//` of their own, so render hands the comment's `//` to the
surviving directive when the one that owned it is removed. Each directive
also records the column range it occupies, fix-it run included: every error
the verifier reports against a directive points inside that range, which is
what tells siblings on one line apart when routing not-produced errors,
fix-it mismatches and child notes. Dead directives are now retired
individually, and a line is dropped only once nothing renders on it.

decrement_count raises KnownException instead of asserting, so any future
mis-attribution surfaces as a readable lit message rather than a traceback.
2026-08-03 17:23:19 -07:00
..