Repository navigation
Deprecate @raises in favor of @throws in reanalyze - #7932
Merged
tsnobip merged 10 commits intoOct 3, 2025
Merged
Conversation
- Update reanalyze Exception.ml to accept both @throws and @raises decorators - Update warning messages to use @throws terminology - Add @throws decorator to completion with documentation - Mark @raises as deprecated in completion - Update all test files to use @throws instead of @raises - Update expected test outputs to reflect @throws terminology - Update Stdlib_JSON to use @throws instead of @raises Co-authored-by: tsnobip <2479216+tsnobip@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] deprecate the use of
Deprecate @raises in favor of @throws in reanalyze
Oct 2, 2025
@raises in reanalyze and use @throws instead.
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
tsnobip
marked this pull request as ready for review
October 2, 2025 10:49
Member
|
fixes #7680. |
cknitt
reviewed
Oct 3, 2025
cknitt
left a comment
Member
There was a problem hiding this comment.
We should check the terminology - are there still any other places using "raise" instead of "throw"
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. |
cknitt
reviewed
Oct 3, 2025
tsnobip
force-pushed
the
copilot/fix-ffd931b9-0aba-4a57-b568-72a4365d3180
branch
from
October 3, 2025 07:16
2dc9cc9 to
4f5313a
Compare
tsnobip
force-pushed
the
copilot/fix-ffd931b9-0aba-4a57-b568-72a4365d3180
branch
from
October 3, 2025 07:57
01d9c83 to
501eaa2
Compare
tsnobip
added a commit
to rescript-lang/rescript-lang.org
that referenced
this pull request
Oct 3, 2025
Following the changes introduced by rescript-lang/rescript#7932
cknitt
approved these changes
Oct 3, 2025
cknitt
left a comment
Member
There was a problem hiding this comment.
LGTM.
Maybe @cristianoc would like to have a look, too?
fhammerschmidt
pushed a commit
to rescript-lang/rescript-lang.org
that referenced
this pull request
Oct 3, 2025
* Document the deprecation of @raises over @throws Following the changes introduced by rescript-lang/rescript#7932 * document exception analysis in editor-plugins * format * update libraries set up to use exception analysis * remove the outdated functor example for exception analysis * rename List.hd to List.head (its name in Stdlib) * rename functors to module functions
aspeddro
pushed a commit
to aspeddro/rescript-compiler
that referenced
this pull request
Oct 31, 2026
* Initial plan * Deprecate @raises in favor of @throws in reanalyze - Update reanalyze Exception.ml to accept both @throws and @raises decorators - Update warning messages to use @throws terminology - Add @throws decorator to completion with documentation - Mark @raises as deprecated in completion - Update all test files to use @throws instead of @raises - Update expected test outputs to reflect @throws terminology - Update Stdlib_JSON to use @throws instead of @raises Co-authored-by: tsnobip <2479216+tsnobip@users.noreply.github.com> * replace other references of `raise` with `throw` * update "Contribute to the API Reference" * update changelog * update docs some more * rename some more raises * rename raise to throw in API docs * remove unused @throws annotations * update completion --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tsnobip <2479216+tsnobip@users.noreply.github.com> Co-authored-by: tsnobip <dontshootthink@gmail.com> Signed-off-by: Pedro Castro <aspeddro@gmail.com>
cknitt
added a commit
that referenced
this pull request
Nov 3, 2026
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
added a commit
that referenced
this pull request
Nov 4, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR deprecates the
@raisesdecorator in reanalyze in favor of@throwsto better align with JavaScript and ReScript terminology. The change maintains full backward compatibility while guiding users toward the new decorator.Motivation
ReScript uses
throwfor raising exceptions (notraise), so using@throwsfor the exception analysis decorator provides better consistency with the language's terminology and makes it more intuitive for developers.Changes
Core Reanalyze
@throws/@throw(new) and@raises/@raise(deprecated) decorators@throwsinstead of@raisesExample warning message before:
Example warning message after:
IDE/Editor Support
@throwsdecorator with full documentation and marked@raisesas deprecated with a clear migration messageDocumentation & Examples
@throwsdecoratorStdlib_JSONruntime library to use@throwsBackward Compatibility
✅ No breaking changes. Existing code using
@raiseswill continue to work without modification. The implementation accepts all variants:IDE users will see a deprecation notice when using
@raises, guiding them to use@throwsinstead, but their code will function identically.Migration
Users can migrate at their own pace. Simply replace
@raiseswith@throws:Both decorators accept the same syntax:
@throws(MyException)@throws([E1, E2, E3])Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.