Skip to content

Instantly share code, notes, and snippets.

@hackaugusto
Last active July 9, 2019 13:14
Show Gist options
  • Select an option

  • Save hackaugusto/620eb4421587edf16541f1b0c78e32df to your computer and use it in GitHub Desktop.

Select an option

Save hackaugusto/620eb4421587edf16541f1b0c78e32df to your computer and use it in GitHub Desktop.
from typing import List, NoReturn
class Uninhabited:
pass
def never(x: Uninhabited) -> NoReturn:
raise RuntimeError()
def f2() -> int:
v: List[int] = [1]
if isinstance(v, list):
pass
else:
never(v)
return 1
exhaustive.py:18: error: Argument 1 to "never" has incompatible type "List[int]"; expected "Uninhabited"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment