pyrefly
pyrefly copied to clipboard
Constrained typevar cannot be attribute-accessed
Describe the Bug
Minimal repro:
class A:
x: int
class B:
x: int
class Foo[T: (A, B)]:
y: T
def foo(self) -> None:
self.y.__class__
Expected: No error Actual: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeVar[T] (trying to access class)
Sandbox Link
https://pyrefly.org/sandbox/?code=MYGwhgzhAECCBcAoaLoA97QJYDsAuiiokMAQkquprgUeFNAGID2zA2gCqYAUsANNFIBKALoVUAT0wdkqACYBTAGbQlrbhAUglQ6AFoAfNAByzHAvGUUm7QDoJtgPqPiUZ4iA
(Only applicable for extension issues) IDE Information
No response
similar to the first issue from https://github.com/facebook/pyrefly/issues/150