-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Implement pattern-matching in top-level scripts #13999
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
12c9bc8
Move computation of better conversion from expression into `BetterCon…
gafter b5b90cb
Implement pattern-matching in top-level scripts
gafter 59aca3e
Merge master into master-10603
gafter 82d9177
Minor changes per code review.
gafter b91ce62
Merge branch 'master' of https://github.com/dotnet/roslyn into master…
gafter ada3838
Move out var overload closer to the draft spec for out var (without r…
gafter 27ac2cc
Revert some changes after moving out var handling in overload resolut…
gafter 337d641
Adjust indentation.
gafter 7a9a8b1
Align implementation with spec for overload resolution vs out var.
gafter 2b047fe
Merge branch 'master' of https://github.com/dotnet/roslyn into master…
gafter 08e0312
Merge branch 'master' of https://github.com/dotnet/roslyn into master…
gafter 65c84a9
Call a LocalLowering helper for constructing the pattern variable ass…
gafter 41be29b
Make VariableDeclaratorNode protected (revert).
gafter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1562,12 +1562,16 @@ | |
</AbstractNode> | ||
|
||
<Node Name="BoundDeclarationPattern" Base="BoundPattern"> | ||
<Field Name="LocalSymbol" Type="LocalSymbol" Null="disallow"/> | ||
<!-- Variable is a local symbol, or in the case of top-level code in scripts and interactive, | ||
a field that is a member of the script class. --> | ||
<Field Name="Variable" Type="Symbol" Null="disallow"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please add a comment what kind of symbols could end up here. #Closed |
||
<!-- VariableAccess is an access to the declared symbol, suitable for use | ||
in the lowered form in either an lvalue or rvalue position. We maintain it separately | ||
from the LocalSymbol to facilitate lowerings in which the variable is no longer a simple | ||
local access (e.g. the expression evaluator). It is expected to be logically side-effect | ||
free. --> | ||
from the Symbol to facilitate lowerings in which the variable is no longer a simple | ||
variable access (e.g. in the expression evaluator). It is expected to be logically side-effect | ||
free. The necessity of this member is a consequence of a design issue documented in | ||
https://github.com/dotnet/roslyn/issues/13960 . When that is fixed this field can be | ||
removed. --> | ||
<Field Name="VariableAccess" Type="BoundExpression" Null="disallow"/> | ||
<Field Name="DeclaredType" Type="BoundTypeExpression" Null="allow"/> | ||
<Field Name="IsVar" Type="bool"/> | ||
|
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
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
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
Oops, something went wrong.
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.
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.
I believe merging handling of BoundKind.OutVariablePendingInference and BoundKind.OutDeconstructVarPendingInference into this
if
complicates the code significantly. The behavior we want for these nodes is very simple and it is better to handle them separately, so that we can quote the spec and have an easy way to match implementation to the spec. It is nearly impossible to match the current implementation to the spec. #ClosedThere 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.
The behavior we want arises from the specification for exactly matching expression. I will implement it that way, now that we have that tentative spec language.
In reply to: 80791006 [](ancestors = 80791006)
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.
Please quote what you think the tentative specification is. I am not able to verify correctness of the change otherwise.
In reply to: 80793171 [](ancestors = 80793171,80791006)
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.
I will include the quote in a comment.
In reply to: 80794118 [](ancestors = 80794118,80793171,80791006)
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.
There is an open issue for the spec/implementation misalignment in #14177 and an open discussion in the LDM. When it is settled I will implement and document the new spec.
In reply to: 80795408 [](ancestors = 80795408,80794118,80793171,80791006)
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.
Please revert change to this file then.
In reply to: 80800555 [](ancestors = 80800555,80795408,80794118,80793171,80791006)
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.
Closed the issue, as it does not occur in the ECMA draft for our next spec. I've updated the spec and the implementation to align as close as the shape of our implementation allows.
In reply to: 80800555 [](ancestors = 80800555,80795408,80794118,80793171,80791006)