Skip to content

Commit 51756c0

Browse files
committed
Add test case for running on fictional platform where unreachable gets triggered
1 parent 07e62f3 commit 51756c0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test-data/unit/check-unreachable-code.test

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,21 @@ def foo(self) -> int:
383383
[builtins fixtures/ops.pyi]
384384
[out]
385385

386+
[case testSysPlatformEarlyReturnActualUnreachableCodeForPlatform]
387+
# flags: --warn-unreachable --platform fictional
388+
import sys
389+
390+
def foo() -> int:
391+
if sys.platform != 'fictional':
392+
return 1
393+
return 0
394+
return 0 + 1 # E: Statement is unreachable
395+
[builtins fixtures/ops.pyi]
396+
[out]
397+
386398
-- TODO: We currently suppress unreachability warnings past semantic
387-
-- reachability checks. This should be enabled and fixed.
388-
[case testSysPlatformInFunctionEarlyReturnWithActualUnreachableCode-skip]
399+
-- reachability checks. Need to decide if this should be fixed and enabled.
400+
[case testSysPlatformEarlyReturnActualUnreachableCodeNotForPlatform-skip]
389401
# flags: --warn-unreachable
390402
import sys
391403

0 commit comments

Comments
 (0)