You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...:5: error: Incompatible return value type (got "Optional[T]", expected "T")
But returner(None) is not Optional; it should just populate T as None in that case and carry on. I don't want it to be Optional for other types since that just complicates passing through T.
If I change the None to, say, 0, I get instead:
...:4: error: Incompatibledefaultforargument"x" (defaulthas type "int", argumenthas type "T")
I assume the way to work around this for now is with overrides, but I don't understand if there's some type-theoretic underpinning to this behavior or it's just a bug.
Your Environment
Mypy version used: 0.782
Mypy command-line flags: (None)
Mypy configuration options from mypy.ini (and other config files): (None)
Python version used: 3.8.5
Operating system and version:
ProductName: Mac OS X
ProductVersion: 10.15.6
BuildVersion: 19G2021
The text was updated successfully, but these errors were encountered:
Bug Report
This program
produces this error
...:5: error: Incompatible return value type (got "Optional[T]", expected "T")
But
returner(None)
is notOptional
; it should just populateT
asNone
in that case and carry on. I don't want it to beOptional
for other types since that just complicates passing throughT
.If I change the
None
to, say,0
, I get instead:I assume the way to work around this for now is with overrides, but I don't understand if there's some type-theoretic underpinning to this behavior or it's just a bug.
Your Environment
mypy.ini
(and other config files): (None)The text was updated successfully, but these errors were encountered: