Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

PLS incorrectly reports error for self-assignment to local variable #513

Copy link
Copy link
@erictraut

Description

@erictraut
Issue body actions

The analyzer incorrectly flags the following (admittedly strange) code with a use-before-def error/warning.

screen shot 2018-12-26 at 10 45 46 am

The 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".

I 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.

See the following documentation in section 2.1 of the official Python docs.

screen shot 2018-12-26 at 10 59 02 am

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.