-
Notifications
You must be signed in to change notification settings - Fork 767
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
Confusing/incorrect error message when using max(iterator, key = <func>) on an iterator of NamedTuples #1982
Comments
Thanks for the enhancement request. I agree that the error message for a "no overloads available" condition is not as clear as it could be. I'll look at ways to improve it. I've created a tracking bug in the pyright issue tracker. |
I made the following changes that improve the readability of error messages for call expressions that involve overloads. Previously, if an argument list didn't match any overload for any reason, pylance would emit an error message The new logic does the following:
In the code sample above, the message was previously:
It is now much more understandable:
|
I assume you meant "it is now" ? I definitely think it's a huge improvement - thanks a lot for this. |
Yes, I meant "now". I fixed my typo above for clarity. |
fixed in 2021.11.0 |
Issue Type: Bug
Minimal code to reproduce:
After a while (my code is much more complex), I figured out that the problem is that Test.val might be None in which case comparison fails - but Pylance says
"No overloads for "max" match the provided arguments Argument types: (List[Test], (x: Unknown) -> Unknown)"
. But here the type ofx
should be known, and the error should be something like "unsupported operation for type int | None".Extension version: 2021.10.3-pre.1
VS Code version: Code 1.61.1 (c13f1abb110fc756f9b3a6f16670df9cd9d4cf63, 2021-10-14T01:15:35.620Z)
OS version: Linux x64 5.14.6-zen1-1-zen
Restricted Mode: No
Remote OS version: Linux x64 5.10.72-1-lts
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: