-
Notifications
You must be signed in to change notification settings - Fork 768
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
The inferred argument type is confusing in subclass of logging.FileHandler #3381
Comments
Thanks for the bug report. This will be fixed in an upcoming release. Pyright, the type checker that underlies pylance, uses different techniques to infer method parameter types when they are unannotated.
class Foo:
def __init__(self, a, b):
self.a = a
self.b = b
f = Foo(1, "hi")
reveal_type(f.a) # int
reveal_type(f.b) # str In the case of parameter This is addressed in this commit. |
@heejaechang, that is unexpected behavior. Should be investigated to see if it's a bug in the hover provider or type evaluator. I recommend opening a new bug since it's not the same issues as the one in this bug report. |
This issue has been fixed in prerelease version 2022.9.41, which was released yesterday. You can find the changelog here: CHANGELOG.md |
Environment data
Code Snippet
Repro Steps
Paste code snippets above in VSCode and see the revealed types.
Expected behavior
In snippet 1, since
encoding
anderrors
are inferred to bestr | None
(instead ofUnknown | None
), I expectfilename
inferredStrPath
(instead ofUnknown
).In snippet 2,
filename
is expected to be inferredint
(instead ofStrPath
)Actual behavior
The text was updated successfully, but these errors were encountered: