Summary
This passes with ty 0.0.79 and reports invalid-return-type with 0.0.80:
from collections.abc import Callable
def capybara[**P, T](fn: Callable[P, T], /, *args: P.args, **kwargs: P.kwargs) -> T:
return fn(*args, **kwargs)
def agouti[**P, T](callable: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T:
return callable(*args, **kwargs)
def hutia(fn: Callable[[], str]) -> str:
return capybara(agouti, fn)
Expected: hutia returns str. Both forwarding functions preserve the return type of their callback.
Actual: ty 0.0.80 infers T@agouti for the return expression.
Versions: 0.0.79 (b4cd792) and 0.0.80 (7fd8e15).
Version
No response
Summary
This passes with ty 0.0.79 and reports invalid-return-type with 0.0.80:
Expected:
hutiareturnsstr. Both forwarding functions preserve the return type of their callback.Actual: ty 0.0.80 infers
T@agoutifor the return expression.Versions: 0.0.79 (b4cd792) and 0.0.80 (7fd8e15).
Version
No response