Skip to content

~? annotation type is special #2403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/tests/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ They have several forms, but generally are a comment with the diagnostic level
to write out the entire message, just make sure to include the important part of
the message to make it self-documenting.

The error annotation needs to match with the line of the diagnostic. There are
Most error annotations need to match with the line of the diagnostic. There are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need this change; ~? actually matches the line not having the following message.
Emphasizing "not" would be enough for me if it's unclear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that does not sound right... ~? is about errors without line information, while this group is about annotations tied to lines in the source code

Copy link
Member

@jieyouxu jieyouxu May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, //~? is used to match diagnostics without line information in the main test file. Possible cases:

  • Simply no line info at all.
  • Line info beyond main test file (w/ annotations), e.g. from auxiliaries or sources that we have no control over.

several ways to match the message with the line (see the examples below):

* `~`: Associates the error level and message with the *current* line
Expand All @@ -205,9 +205,6 @@ several ways to match the message with the line (see the examples below):
* `~v`: Associates the error level and message with the *next* error
annotation line. Each symbol (`v`) that you add adds a line to this, so `~vvv`
is three lines below the error annotation line.
* `~?`: Used to match error levels and messages with errors not having line
information. These can be placed on any line in the test file, but are
conventionally placed at the end.

Example:

Expand All @@ -222,6 +219,10 @@ The space character between `//~` (or other variants) and the subsequent text is
negligible (i.e. there is no semantic difference between `//~ ERROR` and
`//~ERROR` although the former is more common in the codebase).

`~? <diagnostic kind>` (example being `~? ERROR`)
is used to match diagnostics without line information.
These can be placed on any line in the test file, but are conventionally placed at the end.

### Error annotation examples

Here are examples of error annotations on different lines of UI test source.
Expand Down