Skip to content
Open
Changes from 1 commit
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
18 changes: 17 additions & 1 deletion packages/pyright-internal/src/tests/samples/unreachable1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys
from abc import abstractmethod
from typing import NoReturn
from typing import Any, Callable, NoReturn


def func1():
Expand Down Expand Up @@ -92,6 +92,22 @@ def func9():
return 3


def func9_1(noreturn_func: Callable[[], NoReturn], unknown_func, flag: bool):
Comment thread
bschnurr marked this conversation as resolved.
callback = noreturn_func if flag else unknown_func
callback()

# This should not be marked unreachable because the call target includes Unknown.
return 3


def func9_2(noreturn_func: Callable[[], NoReturn], any_func: Any, flag: bool):
callback = noreturn_func if flag else any_func
callback()

# This should not be marked unreachable because the call target includes Any.
return 3


def func10():
e = OSError()
a1 = os.name == "nt" and None == e.errno
Expand Down
Loading