Repository navigation
Commit 6741bab
Don't warn about unreachable code for a finally block that always throws (#9204)
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.
Diagnostic removed (warning 21 for a throwing finally block):
Example:
exception B
let k = () => try { 1 } finally { throw(B) }
Before (diagnostic):
Warning number 21
2:35-42
This statement does not continue execution; following code is unreachable.
After (diagnostic): 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.
Claude-Session: https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 59d2dd5 commit 6741bab
3 files changed
Lines changed: 67 additions & 4 deletions
File tree
- compiler/ml
- tests/build_tests/super_errors
- expected
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2914 | 2914 | | |
2915 | 2915 | | |
2916 | 2916 | | |
2917 | | - | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
2918 | 2920 | | |
2919 | 2921 | | |
2920 | 2922 | | |
2921 | 2923 | | |
2922 | | - | |
| 2924 | + | |
| 2925 | + | |
2923 | 2926 | | |
2924 | 2927 | | |
2925 | 2928 | | |
| |||
4767 | 4770 | | |
4768 | 4771 | | |
4769 | 4772 | | |
4770 | | - | |
| 4773 | + | |
4771 | 4774 | | |
4772 | 4775 | | |
4773 | 4776 | | |
4774 | 4777 | | |
4775 | 4778 | | |
4776 | | - | |
| 4779 | + | |
4777 | 4780 | | |
4778 | 4781 | | |
4779 | 4782 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments