Semantic Diff

#9204 Don't warn about unreachable code for a finally block that always throws

1 commit

ac7357822edb14ab7f695dcacff864e38205512e..pr-9204

d500b0138 · cknitt + Claude · Nov 03, 2026, 18:34 UTC

Give a finally block that always throws no unreachable-code warning

Why

The finally block is typed as a statement, and a statement of type 'a reports warning 21, although no code follows a throw that ends the finally block. Code that follows it inside the block still warns.

removedDiagnostic warning 21 for a throwing finally block

exception Blet k = () => try { 1 } finally { throw(B) }
diagnostic
Before
After
Warning number 212:35-42This statement does not continue execution; following code is unreachable.no warning

Review

  • Does { throw(B); Console.log(2) } in a finally block still warn? Yes, the sequence types throw(B) as an ordinary statement.