ruff/crates/red_knot_python_semantic/resources/mdtest/shadowing/class.md
Andrew Gallant 6dc2d29966 red_knot_python_semantic: migrate INVALID_ASSIGNMENT for shadowing
We mostly keep things the same here, but the message has been moved from
the annotation to the diagnostic's top-line message. I think this is
perhaps a little worse, but some bigger improvements could be made here.
Indeed, we could perhaps even add a "fix" here.
2025-04-22 12:08:03 -04:00

223 B

Classes shadowing

Implicit error

class C: ...

C = 1  # error: "Implicit shadowing of class `C`"

Explicit

No diagnostic is raised in the case of explicit shadowing:

class C: ...

C: int = 1