-
Notifications
You must be signed in to change notification settings - Fork 219
Labels
bugSomething isn't workingSomething isn't workingserverRelated to the LSP serverRelated to the LSP server
Milestone
Description
Summary
Noticed this while messing around with astral-sh/ruff#22111. If you have a name from a different module also defined in the current module, inserting an inlay hint can cause a name collision.
https://play.ty.dev/9a2adb45-8117-49eb-9825-f659ed33ab32
module.py:
class A: ...main.py:
from dataclasses import dataclass
import module # Don't import A directly because there's also an A here
class A: ...
@dataclass
class B[T]:
x: T
b = B(module.A())
# After inserting, oops
# Object of type `B[module.A]` is not assignable to `B[main.A]`
b: B[A] = B(module.A())This is most common for me with Literal, since sometimes I do just want a Literal in my parser, but could happen with any name.
Version
playground 8a0426676
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingserverRelated to the LSP serverRelated to the LSP server