Skip to content

Accept only @throws and @doesNotThrow in reanalyze - #9210

Merged
cknitt merged 1 commit into
masterfrom
remove-reanalyze-raises
Nov 13, 2026
Merged

cknitt merged 1 commit into
masterfrom
remove-reanalyze-raises

Conversation

@cknitt

@cknitt cknitt commented Nov 3, 2026

Copy link
Copy Markdown
Member

#7932 deprecated @raises and @doesNotRaise in 12.0.0-beta.14 and made @throws and @doesNotThrow the documented spellings. Reanalyze still accepts the old names, plus several synonyms nobody documents: @raise, @throw (added in #7521 next to @raise, never deprecated and never offered by completion), and a family of @doNotThrow/@doNotRaise variants with lower-case and typo spellings such as @doesnotthrow and @DoesNoThrow. For v13, this keeps one spelling per annotation.

Exception analysis now recognizes only @throws and @doesNotThrow. Editor completion no longer offers @raises and @doesNotRaise. Every other spelling is an ordinary unknown attribute, and reanalyze ignores it. There is no dedicated warning for an old spelling. Code annotated with one is reported like unannotated code, and the missing-annotation report already names the @throws(...) to add. A separate warning would mean keeping the old names in the analysis only to reject them.

The compiler's own OCaml sources used the old spellings: 72 [@doesNotRaise] and 15 [@@raises ...] annotations in the syntax, gentype, ext and analysis code. They now read [@doesNotThrow] and [@@throws ...]. CONTRIBUTING.md now says @throws where it said @throw. Test fixtures that only contain the old words as code stay as they are: the syntax benchmark data and the printer fixture binary.res.

Tests

  • New reanalyze fixture tests/analysis_tests/tests-reanalyze/deadcode/src/exception/ExnOldSpellings.res uses @raises, @raise, @throw, @doesNotRaise, @doNotRaise, @doNotThrow and @doesnotthrow. expected/exception.txt now reports each annotated value as throwing and not annotated with @throws.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb

@cknitt

cknitt commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T20:10:09.223256Z fd46de2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Changelog

💥 Breaking Change

  • Reanalyze no longer honors @raises, @raise, @throw, @doesNotRaise or the other @doesNotThrow variants: write @throws and @doesNotThrow instead.

Semantic Diff

1 commit · Full page

Accept only @throws and @doesNotThrow in reanalyze

2de3f55 · cknitt + Claude · Nov 03, 2026, 20:00 UTC

Why

12.0.0-beta.14 deprecated @raises and @doesNotRaise in favour of @throws and @doesNotThrow (#7932). v13 drops the old spellings, the undeprecated @throw synonym, and the @doNotThrow/case variants, so one spelling remains for each annotation.

An old spelling is now an unknown attribute, so the code it annotated is reported like unannotated code. The compiler's own [@doesNotRaise] and [@@raises] annotations become [@doesNotThrow] and [@@throws].

Reanalyze modified (old annotation spellings)

@raises(Not_found)
let oldRaisesAnnotation = () => throw(Not_found)

reanalyze

-no issue
 
+Exception Analysis
+ExnOldSpellings.res:5:5-23
+oldRaisesAnnotation might throw Not_found (ExnOldSpellings.res:5:32) and is not annotated with @throws(Not_found)

⚠️ Breaking: @raises, @raise, @throw, @doesNotRaise, @doNotRaise, @doNotThrow and the lower-case variants are ignored; write @throws and @doesNotThrow.

Review

  • Why no dedicated warning for an old spelling? The missing-annotation report already names the @throws(...) to write, and recognizing the old names only to reject them would keep them in the analysis.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: fd46de28ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.75510% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.96%. Comparing base (32116b5) to head (3368127).

Files with missing lines Patch % Lines
compiler/gentype/paths.ml 77.77% 2 Missing ⚠️
compiler/syntax/src/res_scanner.ml 80.00% 2 Missing ⚠️
compiler/syntax/src/jsx_v4.ml 0.00% 1 Missing ⚠️
compiler/syntax/src/res_core.ml 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9210   +/-   ##
=======================================
  Coverage   81.95%   81.96%           
=======================================
  Files         456      456           
  Lines       65612    65607    -5     
=======================================
+ Hits        53775    53776    +1     
+ Misses      11837    11831    -6     
Files with missing lines Coverage Δ
analysis/reanalyze/src/arnold.ml 84.54% <ø> (ø)
analysis/reanalyze/src/exception.ml 81.56% <100.00%> (+1.70%) ⬆️
analysis/reanalyze/src/log_.ml 68.37% <100.00%> (ø)
analysis/reanalyze/src/reanalyze.ml 43.21% <ø> (ø)
analysis/src/process_cmt.ml 84.41% <100.00%> (ø)
compiler/ext/ext_util.ml 23.07% <ø> (ø)
compiler/gentype/emit_js.ml 79.76% <100.00%> (ø)
compiler/gentype/generated_files.ml 62.50% <100.00%> (ø)
compiler/gentype/gentype_common.ml 86.36% <100.00%> (ø)
compiler/gentype/gentype_main.ml 80.95% <100.00%> (ø)
... and 18 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cknitt
cknitt requested a review from cristianoc November 3, 2026 20:15
@cknitt
cknitt marked this pull request as ready for review November 3, 2026 20:15
@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9210

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9210

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9210

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9210

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9210

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9210

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9210

commit: 3368127

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

@cknitt
cknitt force-pushed the remove-reanalyze-raises branch from fd46de2 to 2de3f55 Compare November 4, 2026 08:29
Why:
    12.0.0-beta.14 deprecated `@raises` and `@doesNotRaise` in favour of
    `@throws` and `@doesNotThrow` (#7932). v13 drops the old spellings,
    the undeprecated `@throw` synonym, and the `@doNotThrow`/case variants,
    so one spelling remains for each annotation.

An old spelling is now an unknown attribute, so the code it annotated is
reported like unannotated code. The compiler's own `[@doesNotRaise]` and
`[@@raises]` annotations become `[@doesNotThrow]` and `[@@throws]`.

Reanalyze modified (old annotation spellings):
Example:
    @raises(Not_found)
    let oldRaisesAnnotation = () => throw(Not_found)
Before (reanalyze): no issue
After (reanalyze):
    Exception Analysis
    ExnOldSpellings.res:5:5-23
    oldRaisesAnnotation might throw Not_found (ExnOldSpellings.res:5:32) and is not annotated with @throws(Not_found)

Review: Why no dedicated warning for an old spelling? The missing-annotation report already names the `@throws(...)` to write, and recognizing the old names only to reject them would keep them in the analysis.
Breaking: `@raises`, `@raise`, `@throw`, `@doesNotRaise`, `@doNotRaise`, `@doNotThrow` and the lower-case variants are ignored; write `@throws` and `@doesNotThrow`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the remove-reanalyze-raises branch from 2de3f55 to 3368127 Compare November 10, 2026 16:17
@github-actions

Copy link
Copy Markdown

Changelog

💥 Breaking Change

  • Reanalyze no longer honors @raises, @raise, @throw, @doesNotRaise or the other @doesNotThrow variants: write @throws and @doesNotThrow instead.

Semantic Diff

1 commit · Full page

Accept only @throws and @doesNotThrow in reanalyze

3368127 · cknitt + Claude · Nov 03, 2026, 20:00 UTC

Why

12.0.0-beta.14 deprecated @raises and @doesNotRaise in favour of @throws and @doesNotThrow (#7932). v13 drops the old spellings, the undeprecated @throw synonym, and the @doNotThrow/case variants, so one spelling remains for each annotation.

An old spelling is now an unknown attribute, so the code it annotated is reported like unannotated code. The compiler's own [@doesNotRaise] and [@@raises] annotations become [@doesNotThrow] and [@@throws].

Reanalyze modified (old annotation spellings)

@raises(Not_found)
let oldRaisesAnnotation = () => throw(Not_found)

reanalyze

-no issue
 
+Exception Analysis
+ExnOldSpellings.res:5:5-23
+oldRaisesAnnotation might throw Not_found (ExnOldSpellings.res:5:32) and is not annotated with @throws(Not_found)

⚠️ Breaking: @raises, @raise, @throw, @doesNotRaise, @doNotRaise, @doNotThrow and the lower-case variants are ignored; write @throws and @doesNotThrow.

Review

  • Why no dedicated warning for an old spelling? The missing-annotation report already names the @throws(...) to write, and recognizing the old names only to reject them would keep them in the analysis.

@github-actions

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 682,344,971 → 682,345,054 (±0.00%).

Generated projects: 923,214,162 → 923,213,879 (±0.00%).

None of the 265 benchmarks changed by 0.1% or more.

Instructions

In total: 9,666,072,926 → 9,666,072,926 (±0.00%).

None of the 33 benchmarks changed by 0.1% or more.

Output size

In total: 25,812,251 → 25,812,251 (±0.00%).

None of the 13 benchmarks changed by 0.1% or more.

Pull request 3368127 compared with base 32116b5 in this run.

@github-actions

Copy link
Copy Markdown

@cristianoc cristianoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, Cristiano's assistant, reviewing at his request.

Reviewed the canonical @throws / @doesNotThrow handling, migration of internal annotations, completion entries, and old-spelling regression expectations. The removal is consistent with the documented v13 breaking change; no blocking findings. Exact-head CI is green. Static review and CI inspection only; I did not rerun the compiler/tests locally.

@cknitt
cknitt merged commit a87d9cb into master Nov 13, 2026
20 of 22 checks passed
@cknitt
cknitt deleted the remove-reanalyze-raises branch November 13, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants