-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Wrong revealed type of float/int multiplied/divided by sum(Iterable[complex]). #6040
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
Comments
The |
This is another example of the situation where mypy is too eager about return/outer type context. Mypy uses the external context first, in particular, in this example Possible short term solution is to annotate See also #5971 |
This fixes some errors and warning when running mypy. `gem5/src/python/m5/ext> mypy pystats` There is one error that is ignored, which is a bug in mypy. See python/mypy#6040 Change-Id: I18b648c059da12bd30d612f0e265930b976f22b4 Signed-off-by: Jason Lowe-Power <[email protected]> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42644 Reviewed-by: Andreas Sandberg <[email protected]> Maintainer: Bobby R. Bruce <[email protected]> Tested-by: kokoro <[email protected]>
How would I go about annotating |
This issue can be closed. Everything about sum(...) works in the example above with the mypy 0.960 while a version 0.950 still was with same errors. The only reported error remains in the function f2() but it is an incorrectly typed function, because reveal_type(f2([1])) # Revealed type is "builtins.float" |
@hauntsaninja This issue can be closed similarly to #8814 that you closed yesterday. |
For the code below (Python 3.7.1) mypy 0.650 improperly reveals types of expressions: (float/int multiplied/divided by the sum(arg)), where arg is Iterable[complex] and generates false positive errors for the type of the first argument of the sum (they are in comments). Attempt to explicitly define 'start' parameter does not help. There are no problems with locally defined function f2 with similar signature.
Additional question is: what does mean '' in "Revealed type is 'builtins.complex'" in the line 13?
The text was updated successfully, but these errors were encountered: