- Notifications
You must be signed in to change notification settings - Fork263
Distribute return type over union#2047
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Inspired bymicrosoft/pyright#10673, I looked at this simple example: Code sample inpyright playground fromcollections.abcimportSequencedeflistify[T](x:Sequence[T])->list[T]:returnlist(x)deffunc(x:Sequence[str]|Sequence[int]):y=listify(x)reveal_type(y)# list[str | int]print(y) It feels like the revealed type is not actually what we want here. The desirable inference is imo Is there simple way to annotate What seems to happen here is that we assign I guess with multiple arguments this runs into combinatoric explosion... |
BetaWas this translation helpful?Give feedback.