class Foo[T, U]:
def t(self) -> T: ...
def u(self) -> U: ...
def fn[T](foo: Foo[T, object] | Foo[object, T], value: list[T]) -> T: ...
def fn2[T](value: list[T]) -> T:
return fn(Foo[T, object](), value)
ERROR sandbox.py:10:12-39: Returned type `object` is not assignable to declared return type `T` [bad-return]
ERROR sandbox.py:10:33-38: Argument `set[T]` is not assignable to parameter `value` with type `set[object]` in function `fn` [bad-argument-type]
Describe the Bug
Python: 3.13
Foo[T, object] | Foo[object, T]astral-sh/ty#3533) but unlike ty, pyrefly works correctly when the second argument type is justTinstead oflist[T]Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQBiuuA2gCoA09AqgLqIAOunqj6mGGHoAXABRwYUMAEp6AWgB89donqF9wseMn0ArvMUr1Wnrv2FhjrCbDoOfWWBa7mbLvVxsACsYSmk%2BegAfJhZWQJCw7nY%2BbgA3VChTGF0oCDhpd1VNbTsDdCcJKVcAJndZdMzs%2Blz8wusSwzEAJxhpUy6RV1lfDm540PDZZTSMrOUQThAyHrAoUkJpXABbKAoyaQALXHQ1VJguuAhj%2BgBeekEQAGZCAEZqh%2BFWc67cC75hDDoXDSVDSK4nLZ5LagygHW70ADk31%2BCOEIAAvotUGEIGdGNAYBQ0Fg8EQyBigA
(Only applicable for extension issues) IDE Information
No response