Factor nullability logic for placeholders#58036
Merged
jcouv merged 5 commits intodotnet:mainfrom Dec 4, 2021
Merged
Conversation
f841fb3 to
2b93066
Compare
2b93066 to
c4596a2
Compare
AlekseyTs
reviewed
Dec 1, 2021
| if (expression is BoundValuePlaceholderBase placeholder) | ||
| { | ||
| if (_resultForPlaceholdersOpt != null && _resultForPlaceholdersOpt.TryGetValue(placeholder, out var value)) | ||
| if (PlaceholderMustBeRegistered(placeholder)) |
Contributor
AlekseyTs
reviewed
Dec 1, 2021
|
|
||
| private void VisitPlaceholderWithReplacement(BoundValuePlaceholderBase node) | ||
| { | ||
| if (PlaceholderMustBeRegistered(node)) |
Contributor
Member
Author
|
@dotnet/roslyn-compiler for second review. Small PR. Thanks |
AlekseyTs
reviewed
Dec 1, 2021
| if (expression is BoundValuePlaceholderBase placeholder) | ||
| { | ||
| if (_resultForPlaceholdersOpt != null && _resultForPlaceholdersOpt.TryGetValue(placeholder, out var value)) | ||
| if (_resultForPlaceholdersOpt != null) |
Contributor
Member
Author
There was a problem hiding this comment.
Just me being stupid... :-P
AlekseyTs
reviewed
Dec 1, 2021
| SetResult(node, result.RValueType, result.LValueType); | ||
| } | ||
| else | ||
| if (_resultForPlaceholdersOpt != null) |
Contributor
cston
reviewed
Dec 1, 2021
| Debug.Assert(removed); | ||
| } | ||
|
|
||
| private bool PlaceholderMustBeRegistered(BoundValuePlaceholderBase placeholder) |
cston
approved these changes
Dec 1, 2021
333fred
reviewed
Dec 2, 2021
| Debug.Assert(removed); | ||
| } | ||
|
|
||
| private static bool PlaceholderMustBeRegistered(BoundValuePlaceholderBase placeholder) |
Member
There was a problem hiding this comment.
This appears to only be used as an assert. Consider making this a conditional method and doing the assert directly.
AlekseyTs
reviewed
Dec 3, 2021
| default: | ||
| // Newer placeholders are expected to follow placeholder discipline, namely that | ||
| // they must be added to the map before they are visited, then removed. | ||
| throw ExceptionUtilities.UnexpectedValue(placeholder.Kind); |
Contributor
Member
Author
There was a problem hiding this comment.
I don't see a problem with throwing as we do everywhere else. It's clear.
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 4 pipeline(s). |
333fred
added a commit
to 333fred/roslyn
that referenced
this pull request
Dec 6, 2021
…rovements * upstream/main: (68 commits) Lazy load ISourceLinkService to reduce DLL loads (dotnet#58108) [main] Update dependencies from dotnet/source-build (dotnet#57707) [main] Update dependencies from dotnet/arcade (dotnet#57968) Factor nullability logic for placeholders (dotnet#58036) Standardize list pattern lowering on `Index` constructor. (dotnet#58055) Add scripts to verify if a branch is ready to review Merge pull request dotnet#58100 from dotnet/dev/jorobich/skip-test Fix some places we weren't correctly disposing of VisualStudioAnalyzers Fix analyzer references being removed and added in one batch Fix indenting Ensure we don't silently capture any exceptions Don't MEF import the implementation directly if the public type will do Change comment Add comment Use actual jump tables Remove unused function Revert Simplify code Compute kind on demand Reorder ...
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.
Introduce
NullableWalker.AddPlaceholderReplacementandRemovePlaceholderReplacement