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

Check for name capture syntax errors #7128

Copy link
Copy link
@BioBox

Description

@BioBox
Issue body actions

Current problem

The match keyword is prone to the following misunderstanding that pylint fails to catch:

a = 'a'
b = 'b'
s = 'a'

match s:
    case a:
        pass
    case b:
        pass

It's easy to see this as a correct case statement construct, but Python will actually interpret this as a capture pattern instead of the desired value pattern and respond with SyntaxError: name capture 'a' makes remaining patterns unreachable. Pylint fails to catch this.

Desired solution

There should be an error reported on the 6th line.

Additional context

I'm new to pylint so please correct me if this case is already handled.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    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.