Summary
Examples: https://play.ty.dev/e6628610-7be6-4090-82ca-d1cadf92e85f
Beginning with the alpha.28 release (and still happening as of alpha.30), ty emits invalid-type-form for valid types that happen to share a name with an instance method.
Example involving the set builtin:
class Foo:
def set(self) -> None:
pass
def bar(self) -> set[int]: # invalid-type-form
return {1, 2, 3}
def baz(self) -> set: # invalid-type-form
return {"hello", "world"}
Invalid subscript of object of type `def set(self) -> None` in type expression
Variable of type `def set(self) -> None` is not allowed in a type expression
Example using a non-builtin type:
from datetime import datetime
class Foo:
def datetime(self) -> None:
pass
def maybe_return_date(self) -> datetime | None: # invalid-type-form
return None
Variable of type `def datetime(self) -> None` is not allowed
Version
ty 0.0.1-alpha.28, ty 0.0.1-alpha.29, ty 0.0.1-alpha.30
Summary
Examples: https://play.ty.dev/e6628610-7be6-4090-82ca-d1cadf92e85f
Beginning with the
alpha.28release (and still happening as ofalpha.30), ty emitsinvalid-type-formfor valid types that happen to share a name with an instance method.Example involving the
setbuiltin:Example using a non-builtin type:
Version
ty 0.0.1-alpha.28, ty 0.0.1-alpha.29, ty 0.0.1-alpha.30