- Notifications
You must be signed in to change notification settings - Fork471
Deprecate @raises in favor of @throws in reanalyze#7932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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@raisesCo-authored-by: tsnobip <2479216+tsnobip@users.noreply.github.com>
@raises in reanalyze and use@throws instead.pkg-pr-newbot commentedOct 2, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
rescript@rescript/darwin-arm64@rescript/darwin-x64@rescript/linux-arm64@rescript/linux-x64@rescript/runtime@rescript/win32-x64commit: |
fixes#7680. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should check the terminology - are there still any other places using "raise" instead of "throw"
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@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 👍. |
Uh oh!
There was an error while loading.Please reload this page.
2dc9cc9 to4f5313aCompare01d9c83 to501eaa2CompareFollowing the changes introduced byrescript-lang/rescript#7932
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
Maybe@cristianoc would like to have a look, too?
11cde90 intomasterUh oh!
There was an error while loading.Please reload this page.
* Document the deprecation of@raises over@throwsFollowing the changes introduced byrescript-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
Uh oh!
There was an error while loading.Please reload this page.
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 moreCopilot coding agent tips in the docs.