Skip to content

Commit cd2606e

Browse files
committed
Bump missing return statement note to error severity
1 parent 3f903f8 commit cd2606e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def is_implicit_any(t: Type) -> bool:
654654
if self.is_trivial_body(defn.body):
655655
pass
656656
else:
657-
self.msg.note(messages.MISSING_RETURN_STATEMENT, defn)
657+
self.msg.fail(messages.MISSING_RETURN_STATEMENT, defn)
658658

659659
self.return_types.pop()
660660

test-data/unit/check-async-await.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async def f() -> int:
2020
make_this_not_trivial = 1
2121
[builtins fixtures/async_await.pyi]
2222
[out]
23-
main:2: note: Missing return statement
23+
main:2: error: Missing return statement
2424

2525
[case testAsyncDefReturnWithoutValue]
2626
# flags: --fast-parser

test-data/unit/check-optional.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def f() -> None:
493493
def g() -> int:
494494
1 + 1 #
495495
[out]
496-
main:5: note: Missing return statement
496+
main:5: error: Missing return statement
497497

498498
[case testGenericTypeAliasesOptional]
499499
from typing import TypeVar, Generic, Optional

test-data/unit/check-statements.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def f() -> Generator[int, None, str]:
6363

6464
[case testNoReturnInGenerator]
6565
from typing import Generator
66-
def f() -> Generator[int, None, str]: # N: Missing return statement
66+
def f() -> Generator[int, None, str]: # E: Missing return statement
6767
yield 1
6868
[out]
6969

test-data/unit/check-warnings.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def g() -> int:
7171
return 1
7272
[builtins fixtures/list.pyi]
7373
[out]
74-
main:5: note: Missing return statement
74+
main:5: error: Missing return statement
7575

7676
[case testNoReturnWhile]
7777
# flags: --warn-no-return
@@ -95,7 +95,7 @@ def j() -> int:
9595
continue
9696
[builtins fixtures/list.pyi]
9797
[out]
98-
main:7: note: Missing return statement
98+
main:7: error: Missing return statement
9999

100100
[case testNoReturnExcept]
101101
# flags: --warn-no-return
@@ -122,7 +122,7 @@ def h() -> int:
122122
return 1
123123
[builtins fixtures/exception.pyi]
124124
[out]
125-
main:2: note: Missing return statement
125+
main:2: error: Missing return statement
126126

127127
[case testNoReturnEmptyBodyWithDocstring]
128128
def f() -> int:

0 commit comments

Comments
 (0)