AbstractFlowPass.VisitStackAllocArrayCreation should use the regular way for visiting initializer#60210
Merged
jcouv merged 6 commits intodotnet:mainfrom Mar 25, 2022
Merged
Conversation
…way for visiting initializer
cston
approved these changes
Mar 16, 2022
Member
Author
|
@dotnet/roslyn-compiler for second review (one-line fix) |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 4 pipeline(s). |
auto-merge was automatically disabled
March 18, 2022 17:24
Pull request was converted to draft
Member
Author
|
Investigating bootstrap issue (relates to nullable tracking for semantic model)... |
Member
Author
|
Sorry for growing the PR. The bootstrap issue revealed that nullability analysis of stackalloc needed to be updated. I've shared the code with analysis of regular array creations. |
cston
reviewed
Mar 18, 2022
| // public T Item; | ||
| Diagnostic(ErrorCode.WRN_UnassignedInternalField, "Item").WithArguments("D<T>.Item", "").WithLocation(15, 14) | ||
| ); | ||
| } |
Contributor
cston
approved these changes
Mar 18, 2022
Made some required changes since your review
AlekseyTs
reviewed
Mar 24, 2022
| return null; | ||
| } | ||
|
|
||
| bool isInferred = node.Syntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression; |
Contributor
Contributor
There was a problem hiding this comment.
However I see that this is a preexisting condition.
AlekseyTs
reviewed
Mar 24, 2022
| return null; | ||
| } | ||
|
|
||
| private TypeSymbol VisitArrayInitialization(TypeSymbol type, bool isInferred, BoundArrayInitialization initialization, bool hasErrors) |
Contributor
Member
Author
There was a problem hiding this comment.
The bound node is called BoundArrayInitialization, so this is following our normal naming convention
AlekseyTs
reviewed
Mar 24, 2022
| static TypeWithAnnotations getSpanElementType(NamedTypeSymbol namedType) | ||
| { | ||
| Debug.Assert(namedType.Name == "Span"); | ||
| Debug.Assert(namedType.OriginalDefinition.TypeParameters.Count() == 1); |
Contributor
AlekseyTs
reviewed
Mar 24, 2022
| static TypeSymbol setSpanElementType(NamedTypeSymbol namedType, TypeWithAnnotations elementType) | ||
| { | ||
| Debug.Assert(namedType.Name == "Span"); | ||
| Debug.Assert(namedType.OriginalDefinition.TypeParameters.Count() == 1); |
Contributor
AlekseyTs
reviewed
Mar 24, 2022
| } | ||
|
|
||
| Debug.Assert(node.Type is not null); | ||
| bool isInferred = node.Syntax.Kind() == SyntaxKind.ImplicitStackAllocArrayCreationExpression; |
Contributor
AlekseyTs
reviewed
Mar 24, 2022
| } | ||
|
|
||
| Debug.Assert(node.Type is not null); | ||
| bool isInferred = node.Syntax.Kind() == SyntaxKind.ImplicitStackAllocArrayCreationExpression; |
Contributor
Member
Author
There was a problem hiding this comment.
Yes, Stackalloc_InferredType
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.
Fixes #60134
Fix is same as we recently did for arrays in PR #57612
FYI @bernd5