-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix crash in 'use collection initializer' #75242
Fix crash in 'use collection initializer' #75242
Conversation
@@ -94,8 +93,35 @@ public AbstractSpeculationAnalyzer( | |||
} | |||
|
|||
protected abstract ISyntaxFacts SyntaxFactsService { get; } | |||
|
|||
protected abstract SyntaxNode GetSemanticRootForSpeculation(TExpressionSyntax expression); |
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.
just moved all the abstract methods to the top of the file.
protected abstract TExpressionSyntax GetForEachStatementExpression(TForEachStatementSyntax forEachStatement); | ||
protected abstract bool IsForEachTypeInferred(TForEachStatementSyntax forEachStatement, SemanticModel semanticModel); | ||
protected abstract bool ForEachConversionsAreCompatible(SemanticModel originalModel, TForEachStatementSyntax originalForEach, SemanticModel newModel, TForEachStatementSyntax newForEach); | ||
protected abstract void GetForEachSymbols( |
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.
this method changed to add more information back.
Dim info = model.GetForEachStatementInfo(forEach) | ||
getEnumeratorMethod = info.GetEnumeratorMethod | ||
elementType = info.ElementType | ||
localVariables = ImmutableArray.Create(DirectCast(model.GetDeclaredSymbol(forEach), ILocalSymbol)) |
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.
always safe in VB. it doesn't have deconstructions in foreach statements.
@akhera99 ptal :) |
Fixes #75214