-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.9.3
-
None
Hi, I hit a pretty big problem that seems easily fixable - the Property object/decorator should have templated hinting where getter/setter annotations actually reflect the property type. Currently what I see in the header is:
class Property: def __init__(self, type: type, /, fget: collections.abc.Callable[[typing.Any], typing.Any] | None = ..., fset: collections.abc.Callable[[typing.Any, typing.Any], None] | None = ..., freset: collections.abc.Callable[[typing.Any, typing.Any], None] | None = ..., doc: str | None = ..., notify: PySide6.QtCore.Signal | None = ..., designable: bool = ..., scriptable: bool = ..., stored: bool = ..., user: bool = ..., constant: bool = ..., final: bool = ...) -> None: ... def __call__(self, func: collections.abc.Callable[..., typing.Any], /) -> PySide6.QtCore.Property: ... def deleter(self, fdel: collections.abc.Callable[[typing.Any], None], /) -> PySide6.QtCore.Property: ... def getter(self, fget: collections.abc.Callable[[typing.Any], typing.Any], /) -> PySide6.QtCore.Property: ... def read(self, fget: collections.abc.Callable[[typing.Any], typing.Any], /) -> PySide6.QtCore.Property: ... def setter(self, fset: collections.abc.Callable[[typing.Any, typing.Any], None], /) -> PySide6.QtCore.Property: ... def write(self, fset: collections.abc.Callable[[typing.Any, typing.Any], None], /) -> PySide6.QtCore.Property: ...
And I this error when trying to assign a value (42) to a property
Cannot assign to attribute "foo" for class "MyObject"
"Literal[42]" is not assignable to "Property"
and when using Property as a decorator i get redeclaration errors:
Method declaration "foo" is obscured by a declaration of the same namePylancereportRedeclaration