-
Notifications
You must be signed in to change notification settings - Fork 286
Description
The conformance test for specialtypes_never.py (lines 28-33) seems stricter than what the spec requires:
def func2(x: int) -> int:
if x > 0:
return x
stop()
... # E?: This statement can be marked unreachable
return "whatever works" # No type error
The spec's example for a similar scenario says that the error "might be not reported by some checkers" but the conformance test uses # No type error, requiring all checkers to suppress the error.
There's also an inconsistency: lines 32 and 33 are equally unreachable after stop(), but the test allows an optional error on one (# E?) while forbidding any error on the other. If this is about reachability, it seems that both should be treated the same?
The NoReturn recognition part is already tested by func2 itself. If a checker didn't recognize stop() as NoReturn, it would flag the function for not returning int on all paths. It seems that the lines after stop() are testing dead-code error suppression policy, which the spec leaves to the implementation?
Suggested change: Would it make sense to remove lines 32-33 to get:
def func2(x: int) -> int:
if x > 0:
return x
stop()
This still tests that checkers recognize NoReturn calls, without mandating a specific error suppression policy. Would appreciate any thoughts on whether this reading is correct.