Skip to content

[red-knot] Strange error emitted on variable annotated with type[EllipsisType] #15271

@AlexWaygood

Description

@AlexWaygood

I feel like this should be fine:

from types import EllipsisType

some_variable: type[EllipsisType] = type(...)

But if I run cargo run -p red_knot --project ../experiment --python-version="3.10", red-knot complains:

error[lint:invalid-assignment] /Users/alexw/dev/experiment/foo.py:3:1 Implicit shadowing of class `EllipsisType`; annotate to make it explicit if this is intentional

I'm not sure what exactly red-knot thinks I'm shadowing here 😄 The variable must be explicitly annotated for the error to occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtyMulti-file analysis & type inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions