Title: PLS incorrectly reports error for self-assignment to local variable · Issue #513 · microsoft/python-language-server · GitHub
Open Graph Title: PLS incorrectly reports error for self-assignment to local variable · Issue #513 · microsoft/python-language-server
X Title: PLS incorrectly reports error for self-assignment to local variable · Issue #513 · microsoft/python-language-server
Description: The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning. The problem is due to a somewhat hacky piece of code in DDG.Walk(AssignmentStatement node) that attempts to detect the case "fob ...
Open Graph Description: The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning. The problem is due to a somewhat hacky piece of code in DDG.Walk(AssignmentStatement node...
X Description: The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning. The problem is due to a somewhat hacky piece of code in DDG.Walk(AssignmentStatement node...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/513
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PLS incorrectly reports error for self-assignment to local variable","articleBody":"The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning.\r\n\r\n\r\n\r\nThe problem is due to a somewhat hacky piece of code in `DDG.Walk(AssignmentStatement node)` that attempts to detect the case \"fob = fob\" and temporarily manipulate the scope before evaluating the RHS of the assignment. This hack is problematic for a number of reasons. For example, it doesn't properly handle other more complex expressions like \"fob = fob + 1\".\r\n\r\nI think the preferable solution is to remove the hack but modify the logic to allow _reading_ of symbols in outer scopes even if `VisibleToChildren` is false. This property should probably be renamed `WritableByChildren` since Python allows reading of symbols from outer scopes.\r\n\r\nSee the following documentation in [section 2.1 of the official Python docs](https://docs.python.org/3.7/tutorial/classes.html).\r\n\r\n","author":{"url":"https://github.com/erictraut","@type":"Person","name":"erictraut"},"datePublished":"2018-12-26T19:02:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/513/python-language-server/issues/513"}
| 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:53d68d13-65ae-712f-f101-67c8e6406849 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC52:2F0FE8:22CC240:2ED63C8:6A538A1E |
| html-safe-nonce | 50ee45b9e116171a86b469d51bc5aec4638e9c1d09046cbea001f8804145eae3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzUyOjJGMEZFODoyMkNDMjQwOjJFRDYzQzg6NkE1MzhBMUUiLCJ2aXNpdG9yX2lkIjoiNjg2NjM5MzkyMTg5Mjg3ODg3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 74bb10b1475fb6c3551931c4fe11e403d1863cd612adab90f439ec310ff35d77 |
| hovercard-subject-tag | issue:394223708 |
| 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/microsoft/python-language-server/513/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c69be5728db82364ecf67ffe76859e5598095ff31eda7f96b29c95324e5d64b2/microsoft/python-language-server/issues/513 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c69be5728db82364ecf67ffe76859e5598095ff31eda7f96b29c95324e5d64b2/microsoft/python-language-server/issues/513 |
| og:image:alt | The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning. The problem is due to a somewhat hacky piece of code in DDG.Walk(AssignmentStatement node... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | erictraut |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width