-
Notifications
You must be signed in to change notification settings - Fork 140
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
Run Sorbet type-checking with typed: true
#2561
Merged
Merged
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
paracycle
force-pushed
the
uk-typecheck-with-typed-true
branch
from
March 6, 2024 20:24
c5fa311
to
b9de1b2
Compare
kddnewton
approved these changes
Mar 6, 2024
This change makes the Sorbet typechecking step use `typed: true` by default for all files except the ones we explicitly typed override back to `typed: false`. We also extend the Sorbet config to suppress a few classes of errors that are not essential and would be hard to fix without inline type annotations.
For example, use `.fetch` or `.dig` instead of `[]`, and use `===` instead of `is_a?` for checking types of objects.
paracycle
force-pushed
the
uk-typecheck-with-typed-true
branch
from
March 6, 2024 21:24
b9de1b2
to
f0e06d8
Compare
eregon
reviewed
Mar 11, 2024
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.
Nice!
@@ -1799,7 +1799,7 @@ def visit_block(call, block) | |||
|
|||
# Visit a heredoc that can be either a string or an xstring. | |||
def visit_heredoc(node) | |||
children = [] | |||
children = Array.new |
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.
Is this change necessary?
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 PR makes the Sorbet type-checking task work with
typed: true
for all files by default, except for a few files that we revert back totyped: false
. We also suppress a handful of classes of errors that are hard to solve without inline type assertions and are not essential errors for what we are trying to do here.I've also had to make some code changes to get type-checking to work at this level. The major refactor was to move all template related methods and classes under the
Prism::Template
namespace, so that there is no name collision with types under thePrism
namespace.