-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-overloadstopic-reveal-typereveal_type() and reveal_locals()reveal_type() and reveal_locals()
Description
Here the type of value
is an non-inferred int
, and there is only one usage of reveal_type
, yet mypy is outputting two results (one of which is incorrect)
reveal_locals()
shows two entries for value
, but one being None
not Any
.
from typing import overload, Callable
@overload
def bar() -> None: ...
@overload
def bar(fn: Callable[[int], object]) -> None: ...
def bar(fn: object=1) -> None: ...
bar(lambda value: reveal_type(value))
bar(lambda value: reveal_locals())
main.py:11: note: Revealed type is "Any"
main.py:11: note: Revealed type is "builtins.int"
main.py:12: note: Revealed local types are:
main.py:12: note: value: None
main.py:12: note: value: builtins.int
Success: no issues found in 1 source file
Without removing duplicate messages you get this:
test.py:12: note: Revealed local types are:
test.py:12: note: value: None
test.py:12: note: Revealed local types are:
test.py:12: note: value: builtings.int
DetachHead, KotlinIsland, u5184407 and septatrix
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-overloadstopic-reveal-typereveal_type() and reveal_locals()reveal_type() and reveal_locals()