Skip to content

Improve override error note for LSP violations#21309

Open
dhruvmal128 wants to merge 1 commit intopython:masterfrom
dhruvmal128:improve-lsp-override-note
Open

Improve override error note for LSP violations#21309
dhruvmal128 wants to merge 1 commit intopython:masterfrom
dhruvmal128:improve-lsp-override-note

Conversation

@dhruvmal128
Copy link
Copy Markdown

Fixes #7994.

Adds a note explaining that incompatible method overrides violate the Liskov substitution principle. The existing error is preserved; this change only adds an explanatory note.

Testing:

  • Ran python -m mypy /tmp/lsp_test.py before/after
  • python runtests.py self
  • python runtests.py lint

@github-actions

This comment has been minimized.

@dhruvmal128 dhruvmal128 force-pushed the improve-lsp-override-note branch from 80105a4 to ffc8b09 Compare April 24, 2026 02:04
@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/csgo/client.py:55: note: This violates the Liskov substitution principle
+ steam/ext/tf2/client.py:52: note: This violates the Liskov substitution principle

discord.py (https://github.com/Rapptz/discord.py)
+ discord/invite.py:518: note: This violates the Liskov substitution principle
+ discord/channel.py:392: note: This violates the Liskov substitution principle
+ discord/channel.py:1544: note: This violates the Liskov substitution principle
+ discord/channel.py:1810: note: This violates the Liskov substitution principle
+ discord/channel.py:2079: note: This violates the Liskov substitution principle
+ discord/channel.py:2508: note: This violates the Liskov substitution principle
+ discord/ui/select.py:492: note: This violates the Liskov substitution principle
+ discord/ui/select.py:666: note: This violates the Liskov substitution principle
+ discord/ui/select.py:774: note: This violates the Liskov substitution principle
+ discord/ui/select.py:878: note: This violates the Liskov substitution principle
+ discord/ui/select.py:1007: note: This violates the Liskov substitution principle

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/context/slash.py:1035: note: This violates the Liskov substitution principle
+ tanjun/context/message.py:134: note: This violates the Liskov substitution principle
+ tanjun/context/menu.py:102: note: This violates the Liskov substitution principle

jax (https://github.com/google/jax)
+ jax/_src/prng.py:348: note: This violates the Liskov substitution principle

apprise (https://github.com/caronc/apprise)
+ apprise/plugins/viber.py:181: note: This violates the Liskov substitution principle
+ apprise/plugins/mattermost.py:702: note: This violates the Liskov substitution principle
+ apprise/plugins/fluxer.py:857: note: This violates the Liskov substitution principle
+ apprise/plugins/discord.py:696: note: This violates the Liskov substitution principle
+ apprise/plugins/xmpp/base.py:296: note: This violates the Liskov substitution principle
+ apprise/plugins/xmpp/base.py:429: note: This violates the Liskov substitution principle
+ apprise/plugins/irc/base.py:392: note: This violates the Liskov substitution principle

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.

Better message if override violates Liskov substitution principle

1 participant