Attempts at tests and info on how to fix rbs/CommentsAssociator.cc#836
Open
jesse-shopify wants to merge 2 commits intomasterfrom
Open
Attempts at tests and info on how to fix rbs/CommentsAssociator.cc#836jesse-shopify wants to merge 2 commits intomasterfrom
jesse-shopify wants to merge 2 commits intomasterfrom
Conversation
d7011f4 to
935c235
Compare
…ess/else is present Co-authored-by: Alex Rocha <alex.rocha@shopify.com>
935c235 to
5c667cc
Compare
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.

Fix crash in CommentsAssociator when processing empty if/else branches in modules
This PR fixes a crash in the RBS comments associator that occurred when processing empty if/else branches inside modules or classes. The issue happened when
walkBodywas called with a nullnodepointer from empty if/else branches, causing a null pointer dereference.Additionally, this PR improves error messages for type alias comments at the top level by providing a more appropriate error note when there's no context to show.
Motivation
When processing Ruby files with empty if/else branches inside modules or classes that contained RBS comments, Sorbet would crash due to a null pointer dereference in
CommentsAssociator::walkBody. This pattern appears in some rake files and needed to be handled properly.Test plan
See included automated tests.