Inconsistency in `reveal_type(some_type)`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Consider this example:
t1 = int
t2: type[int] = t1
reveal_type(int) # huge overload
reveal_type(t1) # huge overload
reveal_type(t2) # Type[builtins.int]
I expect get the same result in all three reveal_type's, but in two cases i get huge overload: Overload(def (Union[builtins.str, builtins.bytes, array.array[Any], mmap.mmap, ctypes._CData, pickle.PickleBuffer, typing.SupportsInt,
typing_extensions.SupportsIndex, _typeshed.SupportsTrunc] =) -> builtins.int, def (Union[builtins.str, builtins.bytes], base: typing_extensions.SupportsIndex) ->
builtins.int), and in one case i get Type[builtins.int]
My Environment
mypy 0.961 (compiled: no)- no command-line flags, no config file
CPython 3.10.4- Windows 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied example with mypy 0.961 and compare the three reveal_type outputs. Trace how the checker handles int, the alias t1, and the annotated type t2; done means the behavior is consistent with the issue's expected result and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100