File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1500,13 +1500,13 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
1500
1500
typ = self .accept (s .expr , return_type )
1501
1501
# Returning a value of type Any is always fine.
1502
1502
if isinstance (typ , AnyType ):
1503
- return None
1503
+ return
1504
1504
1505
1505
if self .is_unusable_type (return_type ):
1506
1506
# Lambdas are allowed to have a unusable returns.
1507
1507
# Functions returning a value of type None are allowed to have a Void return.
1508
1508
if isinstance (self .function_stack [- 1 ], FuncExpr ) or isinstance (typ , NoneTyp ):
1509
- return None
1509
+ return
1510
1510
self .fail (messages .NO_RETURN_VALUE_EXPECTED , s )
1511
1511
else :
1512
1512
self .check_subtype (
@@ -1519,10 +1519,10 @@ def check_return_stmt(self, s: ReturnStmt) -> None:
1519
1519
else :
1520
1520
# Empty returns are valid in Generators with Any typed returns.
1521
1521
if (self .function_stack [- 1 ].is_generator and isinstance (return_type , AnyType )):
1522
- return None
1522
+ return
1523
1523
1524
1524
if isinstance (return_type , (Void , NoneTyp , AnyType )):
1525
- return None
1525
+ return
1526
1526
1527
1527
if self .in_checked_function ():
1528
1528
self .fail (messages .RETURN_VALUE_EXPECTED , s )
You can’t perform that action at this time.
0 commit comments