-
Notifications
You must be signed in to change notification settings - Fork 471
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate @raises in favor of @throws in reanalyze #7932
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>
@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: |
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"
@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 👍. |
2dc9cc9
to
4f5313a
Compare
01d9c83
to
501eaa2
Compare
Following the changes introduced by rescript-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?
* 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
Overview
This PR deprecates the
@raises
decorator in reanalyze in favor of@throws
to better align with JavaScript and ReScript terminology. The change maintains full backward compatibility while guiding users toward the new decorator.Motivation
ReScript uses
throw
for raising exceptions (notraise
), so using@throws
for 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@throws
instead of@raises
Example warning message before:
Example warning message after:
IDE/Editor Support
@throws
decorator with full documentation and marked@raises
as deprecated with a clear migration messageDocumentation & Examples
@throws
decoratorStdlib_JSON
runtime library to use@throws
Backward Compatibility
✅ No breaking changes. Existing code using
@raises
will continue to work without modification. The implementation accepts all variants:IDE users will see a deprecation notice when using
@raises
, guiding them to use@throws
instead, but their code will function identically.Migration
Users can migrate at their own pace. Simply replace
@raises
with@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.