-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
(🐞) reveal_type
on a lambda parameter from an overloaded higher order function shows two results
#11953
Comments
reveal_type
on a lambda parameter shows two resultsreveal_type
on a lambda parameter from an overloaded higher order function shows two results
reveal_type
on a lambda parameter from an overloaded higher order function shows two resultsreveal_type
on a lambda parameter from an overloaded higher order function shows two results
For some reason reassigning the variable to another name suppresses this behaviour?! def foobar(data: int | str) -> None:
reveal_type(data)
if isinstance(data, int):
reveal_type(data)
data2 = data
filter(lambda element: element == reveal_type(data), [])
filter(lambda element: element == reveal_type(data2), [])
PS: And when adding a |
@septatrix Strange, but whats happening here is that I think this is probably a similar but separate issue. |
@AlexWaygood can you add topic-overloads , the reveal type is behaving strange here due to a deeper issue with the overload. |
From what I can tell, this is caused by arg_types = self.infer_arg_types_in_empty_context(args) Which is |
Here the type of
value
is an non-inferredint
, and there is only one usage ofreveal_type
, yet mypy is outputting two results (one of which is incorrect)reveal_locals()
shows two entries forvalue
, but one beingNone
notAny
.Without removing duplicate messages you get this:
The text was updated successfully, but these errors were encountered: