Fix: Perform scope discovery on match cases too#639
Merged
kontheocharis merged 1 commit intomainfrom Dec 22, 2022
Merged
Conversation
feds01
reviewed
Dec 20, 2022
Contributor
|
rebase? |
889a0b0 to
e442db5
Compare
e442db5 to
00a5a69
Compare
feds01
approved these changes
Dec 22, 2022
Contributor
feds01
left a comment
There was a problem hiding this comment.
LGTM, I don't mind if the suggestion is implemented or not.
Comment on lines
+67
to
+70
| if let Some(name) = &spread.name { | ||
| if let Some(member_id) = | ||
| self.ast_info().stack_members().get_data_by_node(name.ast_ref().id()) | ||
| { |
Contributor
There was a problem hiding this comment.
could use a let_chain here:
Suggested change
| if let Some(name) = &spread.name { | |
| if let Some(member_id) = | |
| self.ast_info().stack_members().get_data_by_node(name.ast_ref().id()) | |
| { | |
| if let Some(name) = &spread.name && let Some(member_id) = | |
| self.ast_info().stack_members().get_data_by_node(name.ast_ref().id()) | |
| { |
Collaborator
Author
There was a problem hiding this comment.
I don't like let chains cause they are not yet supported by rustfmt rust-lang/rustfmt#5203. So I'll just keep it like this for now..
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.
The scope discovery and symbol resolution stages did not handle match cases before. This PR implements this. Match cases are similar to declarations in that bindings inside the pattern are added to the child scope. Consequently, match cases create their own scopes.
Closes #637.