Skip to content

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

Open
cknitt wants to merge 1 commit into
masterfrom
remove-reanalyze-raises
Open

cknitt wants to merge 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 85.71429% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.76%. Comparing base (f1a0476) to head (2de3f55).

Files with missing lines Patch % Lines
compiler/gentype/paths.ml 66.66% 3 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.75%   81.76%           
=======================================
  Files         457      457           
  Lines       65329    65324    -5     
=======================================
+ Hits        53410    53411    +1     
+ Misses      11919    11913    -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 67.22% <100.00%> (ø)
analysis/reanalyze/src/reanalyze.ml 43.93% <ø> (ø)
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: 2de3f55

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

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 fd46de2 to 2de3f55 Compare November 4, 2026 08:29

This branch has not been deployed

No deployments
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.

1 participant