Closed pinterior closed 1 month ago
This is a tricky case. The type is actually either int
or str
in this case, not int | str
.
Pyright's behavior is consistent with mypy's in this case, which also emits two reveal_type
outputs.
I'm going to mark this as "won't fix" because I think the current behavior is fine, and I don't see a straightforward way to change it.
I see.
and, I have another question:
If in case types are int
and Never
, is it possible for Pylance to infer int
instead of the current Unknown
, considering a lambda that takes Never
as an argument as "should never be called"?
(I'm not sure if the inference is from Pyright or Pylance, so I'm asking here)
Describe the bug
reveal_type
used inside lambda passed to union type of functions emits multiple output.Code or Screenshots
on pyright-play.net
perhaps it could be:
VS Code extension or command-line
command-line tool, 1.1.371