How to get a type check error on `__bool__`

I think it’s fine if syntactically it looks like there is a witness of Never as long as there isn’t actually one (because that would lead to unsoundness).

For example, consider the case where a function takes a callback:

import sys
from collections.abc import Callable

def f(callback: Callable[[int], int]) -> list[int]:
    return [callback(1), callback(2)]

f(callback=lambda x: sys.exit())

The type checker has to assume here that Never is compatible with any return type.

I suppose you could also annotate f as

@overload
def f(callback: Callable[[int], Never]) -> Never: ...
@overload
def f(callback: Callable[[int], int]) -> list[int]: ...
def f(callback: Callable[[int], int]) -> list[int]:
    return [callback(1), callback(2)]

reveal_type(f(callback=lambda x: sys.exit()))  # Never

bpr playground