Skip to content

Conformance: Make "# E[tag]" exactly once, add support for at least once #1982

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

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

JelleZijlstra
Copy link
Member

Followup from #1981 (comment).

The documentation said # E[tag] meant the error must appear on exactly one of the tagged lines, but the implementation enforced at least one error instead. I think "exactly one" is usually the better choice, so I made it do that. However, in a few cases we do want "at least one". For example, with two mutually recursive type aliases, mypy errors on both and pyright only on the first. Both of those behaviors seem sensible, so I added a new syntax # E[tag+] that means an error must appear on at least one of the tagged lines.

Also added a section to the README explaining all the syntax.

@@ -70,28 +70,28 @@ def not_abstract(self, x: str) -> str: ...
class C:
@overload # E[func5]
@staticmethod
def func5(x: int) -> int: # E[func5]
def func5(x: int, /) -> int: # E[func5]
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to get rid of various unrelated errors detected by some type checkers so that this test case focuses on only the issue it's trying to test for.

Copy link
Collaborator

@erictraut erictraut left a comment

Choose a reason for hiding this comment

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

Good idea!

@JelleZijlstra JelleZijlstra merged commit ac67f79 into python:main Apr 22, 2025
4 checks passed
@JelleZijlstra JelleZijlstra deleted the exactly-one branch April 22, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants