wrongly inferred type builtins.object
#15295
Labels
bug
mypy got something wrong
topic-join-v-union
Using join vs. using unions
topic-paramspec
PEP 612, ParamSpec, Concatenate
Bug Report
In a rather convoluted nesting, I found that a
Union
was turned intobuiltins.object
.To Reproduce
Gist URL: https://gist.github.com/mypy-play/f932b06f9d8638c2b0c711f8e4048348
Playground URL: https://mypy-play.net/?mypy=latest&python=3.11&gist=f932b06f9d8638c2b0c711f8e4048348
In the example you can see two example functions
works
andfails
which are the exact same except forint
inworks
was replaced withUnion[int, str]
infails
. Both end with areveal_type
.Expected Behavior
works
should revealbuiltins.int
fails
should revealUnion[builtins.int, builtins.str]
Actual Behavior
works
revealsbuiltins.int
(as expected)fails
revealsbuiltins.object
(unexpected)(here's the mypy output of the gist)
Your Environment
Related
I think there's a whole bunch of related issues already, but I wanted to share this example to potentially validate a future fix.
#12009 (comment)
The text was updated successfully, but these errors were encountered: