Open
Description
This fine-grained incremental test case fails (no error on second run):
[case testDecoratedToAsyncReExported]
from mm import f
x: int = f()
[file mm.py]
from m import f
[file m.py]
from d import singleton
@singleton
def f() -> int:
return 0
[file m.py.2]
async def f() -> str:
return 'x'
[file d.py]
from typing import Callable
class Singleton:
def __call__(self) -> int:
return 0
def singleton(f: Callable[[], int]) -> Singleton: pass
[out]
==
main:2: error: Incompatible types in assignment (expression has type "Coroutine[Any, Any, str]", variable has type "int")
It seems necessary to have a re-export, a decorator, and an async function for this to work. Also changing the return type of the functions seems required. I have no idea so far why this corner case fails.
This fails in 0.971 so it's not a recent regression.