Skip to content
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

fix: Mismatched signature between checker plugin API and implementation #17343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bzoracler
Copy link
Contributor

This PR changes the fail method's signature to be positional-only for the first two parameters, due to a mismatch between the CheckerPluginInterface signature and the implementation class (TypeChecker).

class CheckerPluginInterface:
    ...
    @abstractmethod
    def fail(
        self, msg: str | ErrorMessage, ctx: Context, *, code: ErrorCode | None = None
    ) -> None: ...
class TypeChecker(NodeVisitor[None], CheckerPluginInterface):
    ...
    def fail(
        self, msg: str | ErrorMessage, context: Context, *, code: ErrorCode | None = None
    ) -> None:

An alternative fix would be to change TypeChecker.fail's parameter name to ctx, but that has a greater disruption potential.

Copy link
Contributor

github-actions bot commented Jun 7, 2024

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@bzoracler
Copy link
Contributor Author

Fixes #17442

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.

None yet

1 participant