89 references to Type
Microsoft.CodeAnalysis.CSharp (17)
Binder\ForEachLoopBinder.cs (3)
91syntax.Type, 290TypeSyntax typeSyntax = node.Type; 1316((syntax as ForEachStatementSyntax)?.Type.IsVar == true) ?
FlowAnalysis\NullableWalker.cs (1)
11924ReportNullabilityMismatchInAssignment(foreachSyntax.Type, sourceType, destinationType);
Lowering\Instrumentation\DebugInfoInjector.cs (1)
319iterationVarDeclSpan = TextSpan.FromBounds(forEachSyntax.Type.SpanStart, forEachSyntax.Identifier.Span.End);
Syntax.xml.Main.Generated.cs (1)
1894=> node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"));
Syntax.xml.Syntax.Generated.cs (10)
7787if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) 7798public new ForEachStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 7800public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 7802public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 7804public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 7806public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); 7808public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); 7810public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); 7812public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); 7814public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement);
Syntax\SyntaxFacts.cs (1)
132return ((ForEachStatementSyntax)parent).Type == node;
Microsoft.CodeAnalysis.CSharp.CodeStyle (9)
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
104forEachStatement.Type == unusedDefinition.Syntax)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
130semanticModel, local, forEachStatement.Type, forEachStatement.Identifier, elementConversion,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
657ForEachStatementSyntax foreachStatement => foreachStatement.Type.IsTypeInferred(semanticModel),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
91? forEachStatement.Type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
143ForEachStatementSyntax forEach => forEach.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (2)
55if (!forEachStatement.Type.StripRefIfNeeded().IsVar) 104foreachStatement.Type == typeName)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
61var type = forEachStatement.Type.StripRefIfNeeded(); 143foreachStatement.Type == typeName)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
124CreateTupleOrDeclarationExpression(tupleType, forEachStatement.Type),
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
116forEach.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1656@foreach.Type is IdentifierNameSyntax identifierName &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1263var variableTypes = GetTypes(forEachStatementSyntax.Type);
Microsoft.CodeAnalysis.CSharp.Features (19)
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
110foreachStatement2.Type == type)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
414f is ForEachStatementSyntax forEachStatement ? forEachStatement.Type :
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (5)
106type: forEachStatement.Type.IsVar ? null : forEachStatement.Type, 107identifier: forEachStatement.Type.IsVar 109SyntaxNodeOrTokenExtensions.GetTrivia(forEachStatement.Type.GetFirstToken()) 168SyntaxNodeOrTokenExtensions.GetTrivia(forEachStatement.Type.GetFirstToken())
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
664var forEachStatementTypeSymbolType = _semanticModel.GetTypeInfo(forEachStatement.Type, _cancellationToken).Type; 695forEachStatement.Type,
EditAndContinue\BreakpointSpans.cs (1)
678return CreateSpan(simpleForEachStatement.Type, simpleForEachStatement.Identifier);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (3)
327ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 882case SyntaxKind.ForEachStatement: return AreEquivalentIgnoringLambdaBodies(((ForEachStatementSyntax)oldNode).Type, ((ForEachStatementSyntax)newNode).Type);
InlineHints\CSharpInlineTypeHintsService.cs (2)
62else if (node is ForEachStatementSyntax { Type.IsVar: true } forEachStatement) 67return CreateTypeHint(type, forEachStatement.Type, forEachStatement.Identifier);
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
104forEachStatement.Type == unusedDefinition.Syntax)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
130semanticModel, local, forEachStatement.Type, forEachStatement.Identifier, elementConversion,
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
124CreateTupleOrDeclarationExpression(tupleType, forEachStatement.Type),
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
116forEach.Type,
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Semantics\ForEachTests.cs (3)
2143var typeInfo = model.GetTypeInfo(loopSyntax.Type); 2147var conv = model.GetConversion(loopSyntax.Type); 2894var varSyntax = foreachSyntax.Type;
Semantics\NullableReferenceTypesTests.cs (2)
10536var type1 = foreachSyntax[0].Type; 10540var type2 = foreachSyntax[1].Type;
Semantics\RefFieldTests.cs (2)
14674var type = decl.Type; 15213var type = decl.Type;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\NullablePublicAPITests.cs (1)
2466var typeInfo = model.GetTypeInfoAndVerifyIOperation(foreachStatement.Type);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (12)
Generated\Syntax.Test.xml.Generated.cs (2)
12665Assert.NotNull(node.Type); 12671var newNode = node.WithAttributeLists(node.AttributeLists).WithAwaitKeyword(node.AwaitKeyword).WithForEachKeyword(node.ForEachKeyword).WithOpenParenToken(node.OpenParenToken).WithType(node.Type).WithIdentifier(node.Identifier).WithInKeyword(node.InKeyword).WithExpression(node.Expression).WithCloseParenToken(node.CloseParenToken).WithStatement(node.Statement);
Parsing\StatementParsingTests.cs (10)
1934Assert.NotNull(fs.Type); 1935Assert.Equal("T", fs.Type.ToString()); 1967Assert.NotNull(fs.Type); 1968Assert.Equal("T", fs.Type.ToString()); 1996Assert.NotNull(fs.Type); 1997Assert.Equal("var", fs.Type.ToString()); 1998Assert.Equal(SyntaxKind.IdentifierName, fs.Type.Kind()); 1999Assert.Equal(SyntaxKind.IdentifierToken, ((IdentifierNameSyntax)fs.Type).Identifier.Kind()); 3382Assert.NotNull(fs.Type); 3383Assert.Equal("T", fs.Type.ToString());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
371(expression.Parent is ForEachStatementSyntax forEach && forEach.Type == expression) ||
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
277name.CheckParent<ForEachStatementSyntax>(f => f.Type == name) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
657ForEachStatementSyntax foreachStatement => foreachStatement.Type.IsTypeInferred(semanticModel),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
91? forEachStatement.Type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
143ForEachStatementSyntax forEach => forEach.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (2)
55if (!forEachStatement.Type.StripRefIfNeeded().IsVar) 104foreachStatement.Type == typeName)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
61var type = forEachStatement.Type.StripRefIfNeeded(); 143foreachStatement.Type == typeName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1656@foreach.Type is IdentifierNameSyntax identifierName &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1263var variableTypes = GetTypes(forEachStatementSyntax.Type);
Roslyn.Diagnostics.CSharp.Analyzers (9)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
657ForEachStatementSyntax foreachStatement => foreachStatement.Type.IsTypeInferred(semanticModel),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
91? forEachStatement.Type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
143ForEachStatementSyntax forEach => forEach.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (2)
55if (!forEachStatement.Type.StripRefIfNeeded().IsVar) 104foreachStatement.Type == typeName)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
61var type = forEachStatement.Type.StripRefIfNeeded(); 143foreachStatement.Type == typeName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
1656@foreach.Type is IdentifierNameSyntax identifierName &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1263var variableTypes = GetTypes(forEachStatementSyntax.Type);