Title: Detect if required string literal escapes are missing from a type · Issue #948 · python/mypy · GitHub
Open Graph Title: Detect if required string literal escapes are missing from a type · Issue #948 · python/mypy
X Title: Detect if required string literal escapes are missing from a type · Issue #948 · python/mypy
Description: Mypy should complain about code that isn't using string literal escaped when they are required: class A: def (self) -> A: ... # Should be an error; string literal escape required Initially we could only detect these cases within a single...
Open Graph Description: Mypy should complain about code that isn't using string literal escaped when they are required: class A: def (self) -> A: ... # Should be an error; string literal escape required Initially we could...
X Description: Mypy should complain about code that isn't using string literal escaped when they are required: class A: def (self) -> A: ... # Should be an error; string literal escape required Initially w...
Opengraph URL: https://github.com/python/mypy/issues/948
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Detect if required string literal escapes are missing from a type","articleBody":"Mypy should complain about code that isn't using string literal escaped when they are required:\n\n```\nclass A:\n def (self) -> A: ... # Should be an error; string literal escape required\n```\n\nInitially we could only detect these cases within a single module. A more general solution would also detect string literal types needed due to cyclic imports.\n\nA simple implementation idea:\n- Tag each instance type with information on whether the type is quoted or not.\n- During semantic analysis, if a type is unquoted but the definition line for the type/class is in the current file but at a later line number, complain. \n- The definition line for a class is actually the line after the end of the class definition. Alternatively, treat classes that are currently being analyzed specially.\n\nWe also need deal with type aliases, but this isn't needed for the first iteration.\n\nI think that somebody started working on this a while back, but I can't remember the details. Maybe there is an existing issue as well?\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2015-10-17T20:42:25Z","url":"https://github.com/python/mypy/issues/948"}
| 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:aa85142f-76fd-0db5-f9c4-cbd0927e98e0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA68:2D8919:2321DC:2F1E78:6B0022FC |
| html-safe-nonce | d89185698dcac686084e6eeee9b8360f777f4c968163d067cf4f049daf1b1930 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTY4OjJEODkxOToyMzIxREM6MkYxRTc4OjZCMDAyMkZDIiwidmlzaXRvcl9pZCI6Ijc2NzkxMTIwOTc3ODcwMjgyMjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 08ea802465c5106a7784fa64485dbd422600ea0a309472a004da31cfbf02fe17 |
| hovercard-subject-tag | issue:111983708 |
| 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/948/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5cce90ef96cb6dc48f1da23c309c9b84155d237f8f9ff5ea55064d7136ce62ca/python/mypy/issues/948 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5cce90ef96cb6dc48f1da23c309c9b84155d237f8f9ff5ea55064d7136ce62ca/python/mypy/issues/948 |
| og:image:alt | Mypy should complain about code that isn't using string literal escaped when they are required: class A: def (self) -> A: ... # Should be an error; string literal escape required Initially we could... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width