Title: Arg/Kwarg rename passes liskov substitution rule · Issue #8314 · python/mypy · GitHub
Open Graph Title: Arg/Kwarg rename passes liskov substitution rule · Issue #8314 · python/mypy
X Title: Arg/Kwarg rename passes liskov substitution rule · Issue #8314 · python/mypy
Description: Are you reporting a bug, or opening a feature request? Reporting a bug from typing import * class Base(object): def fn(self, arg, kwarg=None): # type: (int, Optional[str]) -> None return # Adding a kwarg passes - I think this correct cla...
Open Graph Description: Are you reporting a bug, or opening a feature request? Reporting a bug from typing import * class Base(object): def fn(self, arg, kwarg=None): # type: (int, Optional[str]) -> None return # Adding a...
X Description: Are you reporting a bug, or opening a feature request? Reporting a bug from typing import * class Base(object): def fn(self, arg, kwarg=None): # type: (int, Optional[str]) -> None return # Addin...
Opengraph URL: https://github.com/python/mypy/issues/8314
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Arg/Kwarg rename passes liskov substitution rule","articleBody":"* Are you reporting a bug, or opening a feature request?\r\n\r\nReporting a bug\r\n\r\n```python\r\nfrom typing import *\r\n\r\n\r\nclass Base(object):\r\n\r\n def fn(self, arg, kwarg=None):\r\n # type: (int, Optional[str]) -> None\r\n return\r\n\r\n\r\n# Adding a kwarg passes - I think this correct\r\nclass Extension(Base):\r\n\r\n def fn(self, arg, kwarg=None, anotherKwarg=None):\r\n # type: (int, Optional[str], Optional[str]) -> None\r\n return\r\n\r\n\r\n# Removing a kwarg errors - I think this correct\r\nclass RemovedKwargsExtension(Base):\r\n\r\n def fn(self, arg):\r\n # type: (int) -> None\r\n return\r\n\r\n\r\n# Renaming args or kwargs passes - I expected this to error, at least for the kwarg rename.\r\nclass RenamedArgsExtension(Base):\r\n\r\n def fn(self, renamedArg, renamedKwarg=None):\r\n # type: (int, Optional[str]) -> None\r\n return\r\n```\r\n\r\n* What is the actual behavior/output?\r\n`RenamedArgsExtension` passes type checking\r\n\r\n* What is the behavior/output you expect?\r\nI think `RenamedArgsExtension` should throw an error as the kwarg name has changed which will break the runtime. To a lesser degree the rename of the arg could also be considered an error, but that depends on if you're allowing the implicit kwarg -> positional arg usage.\r\n\r\n* What are the versions of mypy and Python you are using?\r\nmypy 0.761 running on python 3.6.4\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n`mypy --strict /path/to/file.py`\r\n","author":{"url":"https://github.com/JasonGilholme","@type":"Person","name":"JasonGilholme"},"datePublished":"2020-01-22T23:42:51Z","url":"https://github.com/python/mypy/issues/8314"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2dab978a-e8f0-7f2c-8a78-0c3f3aa04c52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6C6:3E4AC7:23EEE60:30BAEB8:6B002C77 |
| html-safe-nonce | 72806bff50199c1127980d2aa458d939ace986669066dd74599e33941b8851bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkM2OjNFNEFDNzoyM0VFRTYwOjMwQkFFQjg6NkIwMDJDNzciLCJ2aXNpdG9yX2lkIjoiMjQzNDUxODUwMDMyNTIwNzE1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3b648e54598c1b8d7eb89ca6809b1d0afcd7a1782bf26f3d70676503f3938305 |
| hovercard-subject-tag | issue:553859145 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/8314/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e8caf6fa67832340432cd00e29b5796ab250ae331457264f8651be5965e8fbc/python/mypy/issues/8314 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e8caf6fa67832340432cd00e29b5796ab250ae331457264f8651be5965e8fbc/python/mypy/issues/8314 |
| og:image:alt | Are you reporting a bug, or opening a feature request? Reporting a bug from typing import * class Base(object): def fn(self, arg, kwarg=None): # type: (int, Optional[str]) -> None return # Adding a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JasonGilholme |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width