-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Reassigned @property
is typed as Callable
#13975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
mypy got something wrong
Comments
@property
alias is typed as Callable
@property
is typed as Callable
@property
is typed as Callable
@property
is typed as Callable
Same behavior on $ mypy --version
mypy 0.991 (compiled: no)
$ python --version
Python 3.10.9 without config. Result: class Foo:
@property
def bar(self):
return 42
baz = bar
x: int = Foo().bar # works
# x: int = Foo().baz # error: Incompatible types in assignment (expression has type "Callable[[], Any]", variable has type "int") [assignment] |
Closed
Issue is confirmed to affect both 1.8 and master. |
This might be the same as #6700. |
You are right. Closing as duplicate |
Avasam
added a commit
to python/typeshed
that referenced
this issue
Jan 26, 2024
hauntsaninja
pushed a commit
to python/typeshed
that referenced
this issue
Jan 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Mypy seems to forget about the
@property
decorator if the property is aliased.To Reproduce
Expected Behavior
prop_alias
should be usable as a boolean, just likeprop
Actual Behavior
prop_alias
is seen as aCallable
Your Environment
mypy.ini
(and other config files):I'm not sure if this is related to #2563 and #11619
The text was updated successfully, but these errors were encountered: