Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions test-data/unit/check-expressions.test
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,36 @@ f() and b # E: "f" does not return a value (it only ever returns None)
b or f() # E: "f" does not return a value (it only ever returns None)
[builtins fixtures/bool.pyi]

[case testNoneReturnWithDecorators-xfail]
# See: https://github.com/python/mypy/issues/14179
from typing import Callable, TypeVar

F = TypeVar('F', bound=Callable)

def deco(f: F) -> F:
pass

@deco
@deco
def f() -> None:
pass

y1 = f() # E: "f" does not return a value (it only ever returns None)

class A:
@staticmethod
def g() -> None: pass

y2 = A.g() # E: "g" of "A" does not return a value (it only ever returns None)
y3 = A().g() # E: "g" of "A" does not return a value (it only ever returns None)
[builtins fixtures/staticmethod.pyi]

[case testNoneReturnWithCallable-xfail]
class A:
def __call__(self) -> None: pass

y = A()() # E: Function does not return a value (it only ever returns None)


-- Slicing
-- -------
Expand Down
Loading