Skip to content

Commit d1778da

Browse files
author
Guido van Rossum
committed
Make decorator more complicated (both b.deco and a.g are now deferred)
1 parent 331f845 commit d1778da

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test-data/unit/check-modules.test

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,15 +1280,21 @@ import a
12801280
[file a.py]
12811281
import b
12821282
def g() -> None:
1283-
f()
1283+
f('')
12841284
@b.deco
1285-
def f() -> int: pass
1285+
def f(a: str) -> int: pass
1286+
reveal_type(f)
12861287
x = 1 + 1
12871288
[file b.py]
1288-
from typing import Any
1289+
from typing import Callable, TypeVar
12891290
import a
1290-
def deco(f: Any) -> Any:
1291+
T = TypeVar('T')
1292+
def deco(f: Callable[[T], int]) -> Callable[[T], int]:
12911293
a.x
1294+
return f
1295+
[out]
1296+
main:1: note: In module imported here:
1297+
tmp/a.py:6: error: Revealed type is 'def (builtins.str*) -> builtins.int'
12921298

12931299

12941300
-- Scripts and __main__

0 commit comments

Comments
 (0)