-
Notifications
You must be signed in to change notification settings - Fork 455
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
%todo extension #6713
Merged
Merged
%todo extension #6713
Conversation
This file contains 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
aspeddro
reviewed
Apr 3, 2024
jscomp/build_tests/super_errors/expected/todo_with_no_payload.res.expected
Outdated
Show resolved
Hide resolved
mununki
reviewed
Apr 4, 2024
I've updated the PoC to throw errors instead of using |
I think this is a great feature, I would definitely use it! This is the best of both worlds, you can prototype quickly and still let the compiler track all the places you have to complete. |
Good feature! I'd love to use it once released. |
cristianoc
approved these changes
Apr 4, 2024
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.
This adds a
%todo
extension, for which the compiler will warn (but not fail) when encountered:Gives:
(I've shamelessly taken the warning text from a screenshot of the same functionality in Gleam. We should change that if we want to merge this)
And compiles to the following JS:
%todo
doesn't need to have a payload string unless you want it to:Notice that the source ReScript file name + location is also included in the runtime error.
You can also easily run the compiler with this warning producing an error instead (as to make sure no
%todo
makes it into actual prod builds, or similar):rescript -warn-error +110
The
%todo
node itself is transformed intoJs.Exn.raiseError(todoMessage)
.