Skip to content

Commit

Permalink
#3209: Only add imports for extension methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Jun 9, 2024
1 parent 9723549 commit 6c08851
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public override void VisitNamespaceDeclaration(NamespaceDeclaration namespaceDec
public override void VisitForeachStatement(ForeachStatement foreachStatement)
{
var annotation = foreachStatement.Annotation<ForeachAnnotation>();
if (annotation?.GetEnumeratorCall is CallInstruction { Method.DeclaringType: var type })
if (annotation?.GetEnumeratorCall is CallInstruction { Method: { IsExtensionMethod: true, DeclaringType: var type } })
{
AddImportedNamespace(type);
}
Expand Down

0 comments on commit 6c08851

Please sign in to comment.