97 references to Type
Microsoft.CodeAnalysis.CSharp (19)
Binder\Binder_Expressions.cs (10)
5204var typeWithAnnotations = BindType(node.Type, diagnostics); 5219return BindClassCreationExpression(node, (NamedTypeSymbol)type, GetName(node.Type), diagnostics, originalType); 5243diagnostics.Add(ErrorCode.ERR_InvalidObjectCreation, node.Type.Location)); 5535else if (node.Type.Kind() == SyntaxKind.TupleType) 5537diagnostics.Add(ErrorCode.ERR_NewWithTupleTypeSyntax, node.Type.GetLocation()); 5541return BindClassCreationExpression(node, typeName, node.Type, type, analyzedArguments, diagnostics, node.Initializer, initializerType); 5594return MakeBadExpressionForObjectCreation(node, type, analyzedArguments, node.Initializer, node.Type, diagnostics, wasCompilerGenerated); 6229ObjectCreationExpressionSyntax { Type: { } type } => type.Location, 6932var result = BindInterfaceCreationExpression(node, type, diagnostics, node.Type, analyzedArguments, node.Initializer, wasTargetTyped: false); 7090var result = BindTypeParameterCreationExpression(node, typeParameter, analyzedArguments, node.Initializer, node.Type, wasTargetTyped: false, diagnostics);
Compilation\CSharpSemanticModel.cs (2)
2051((ObjectCreationExpressionSyntax)boundNodeForSyntacticParent.Syntax).Type == boundExpr.Syntax)) // Do not return any type information for a ObjectCreationExpressionSyntax.Type node. 3410((ObjectCreationExpressionSyntax)boundNodeForSyntacticParent.Syntax).Type == boundType.Syntax &&
Syntax.xml.Main.Generated.cs (1)
1687=> node.Update(VisitToken(node.NewKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList), (InitializerExpressionSyntax?)Visit(node.Initializer));
Syntax.xml.Syntax.Generated.cs (4)
3678if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) 3689public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); 3692public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); 3694public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer);
Syntax\SyntaxFactory.cs (1)
2222if (node.Kind() == SyntaxKind.NullableType && ((ObjectCreationExpressionSyntax)parent).Type == node)
Syntax\SyntaxFacts.cs (1)
117return ((ObjectCreationExpressionSyntax)parent).Type == node;
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
113else if (objectCreation.Parent is InitializerExpressionSyntax { Parent: ObjectCreationExpressionSyntax { Type: var collectionType } })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
92return objectCreationNode.Type.GetLastToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
956if (parent is ObjectCreationExpressionSyntax objectCreation && objectCreation.Type == node) 1639type = objectCreationExpression.Type;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
562updatedObjectCreation.Type.WithoutTrailingTrivia(),
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
96var symbolInfo = document.SemanticModel.GetSymbolInfo(objectCreationExpression.Type, cancellationToken);
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
53ObjectCreationExpressionSyntax objectCreationNode => objectCreationNode.Type.GetRightmostName(),
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
23.WithType(objectCreation.Type.WithTrailingTrivia(objectCreation.ArgumentList.GetTrailingTrivia()))
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (4)
110objectCreationExpression.Type, 111lockTypeExpression.WithTriviaFrom(objectCreationExpression.Type)); 157objectCreation.Type, 158lockTypeExpression.WithTriviaFrom(objectCreation.Type));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2505if (semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol is ITypeSymbol type && !type.CanSupportCollectionInitializer(containingSymbol))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (1)
426var typeNode = objectCreationExpressionNode.Type;
Microsoft.CodeAnalysis.CSharp.Features (14)
ChangeSignature\CSharpChangeSignatureService.cs (3)
163token.Parent.AncestorsAndSelf().Any(a => a == objectCreation.Type)) 165var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol; 273return ((ObjectCreationExpressionSyntax)matchingNode).Type;
ConvertLinq\ConvertForEachToLinqQuery\ToToListConverter.cs (1)
31ForEachInfo.SemanticModel.GetSymbolInfo(objectCreationExpression.Type, cancellationToken).Symbol is ITypeSymbol typeSymbol &&
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
163else if (expression is ObjectCreationExpressionSyntax { Type: TypeSyntax exceptionType })
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
113else if (objectCreation.Parent is InitializerExpressionSyntax { Parent: ObjectCreationExpressionSyntax { Type: var collectionType } })
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (1)
562updatedObjectCreation.Type.WithoutTrailingTrivia(),
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
96var symbolInfo = document.SemanticModel.GetSymbolInfo(objectCreationExpression.Type, cancellationToken);
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
53ObjectCreationExpressionSyntax objectCreationNode => objectCreationNode.Type.GetRightmostName(),
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
23.WithType(objectCreation.Type.WithTrailingTrivia(objectCreation.ArgumentList.GetTrailingTrivia()))
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (4)
110objectCreationExpression.Type, 111lockTypeExpression.WithTriviaFrom(objectCreationExpression.Type)); 157objectCreation.Type, 158lockTypeExpression.WithTriviaFrom(objectCreation.Type));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (8)
Semantics\GlobalUsingDirectiveTests.cs (7)
4246Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4254Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4282Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4290Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4298Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4306Assert.Equal("alias1=C1", model.GetAliasInfo(node.Type).ToTestDisplayString()); 4318Assert.Equal("alias1=C3", model.GetAliasInfo(node.Type).ToTestDisplayString());
Semantics\TypeOfTests.cs (1)
34var identifierName = node.Type;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (12)
Compilation\SemanticModelGetSemanticInfoTests.cs (12)
14792SymbolInfo symbolInfo = model.GetSymbolInfo(creation.Type); 14797var memberGroup = model.GetMemberGroup(creation.Type); 14800TypeInfo typeInfo = model.GetTypeInfo(creation.Type); 14804var conv = model.GetConversion(creation.Type); 14888SymbolInfo symbolInfo = model.GetSymbolInfo(creation.Type); 14893var memberGroup = model.GetMemberGroup(creation.Type); 14896TypeInfo typeInfo = model.GetTypeInfo(creation.Type); 14900var conv = model.GetConversion(creation.Type); 14999SymbolInfo symbolInfo = model.GetSymbolInfo(creation.Type); 15004var memberGroup = model.GetMemberGroup(creation.Type); 15007TypeInfo typeInfo = model.GetTypeInfo(creation.Type); 15011var conv = model.GetConversion(creation.Type);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (21)
Generated\Syntax.Test.xml.Generated.cs (2)
11817Assert.NotNull(node.Type); 11820var newNode = node.WithNewKeyword(node.NewKeyword).WithType(node.Type).WithArgumentList(node.ArgumentList).WithInitializer(node.Initializer);
Parsing\ExpressionParsingTests.cs (19)
1150Assert.NotNull(oc.Type); 1151Assert.Equal("a", oc.Type.ToString()); 1173Assert.NotNull(oc.Type); 1174Assert.Equal("a", oc.Type.ToString()); 1196Assert.NotNull(oc.Type); 1197Assert.Equal("a", oc.Type.ToString()); 1218Assert.NotNull(oc.Type); 1219Assert.Equal("a", oc.Type.ToString()); 1241Assert.NotNull(oc.Type); 1242Assert.Equal("a", oc.Type.ToString()); 1264Assert.NotNull(oc.Type); 1265Assert.Equal("a", oc.Type.ToString()); 1288Assert.NotNull(oc.Type); 1289Assert.Equal("a", oc.Type.ToString()); 1314Assert.NotNull(oc.Type); 1315Assert.Equal("a", oc.Type.ToString()); 1338Assert.NotNull(oc.Type); 1339Assert.Equal("a", oc.Type.ToString()); 3030Assert.Equal(1, ((NameSyntax)objectCreation.Type).Arity);
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
92return objectCreationNode.Type.GetLastToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
956if (parent is ObjectCreationExpressionSyntax objectCreation && objectCreation.Type == node) 1639type = objectCreationExpression.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2505if (semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol is ITypeSymbol type && !type.CanSupportCollectionInitializer(containingSymbol))
Microsoft.VisualStudio.LanguageServices.CSharp (1)
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
391if (SemanticModel.GetSymbolInfo(objectCreationExpression.Type).Symbol is not ITypeSymbol type)
Roslyn.Diagnostics.CSharp.Analyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
92return objectCreationNode.Type.GetLastToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
956if (parent is ObjectCreationExpressionSyntax objectCreation && objectCreation.Type == node) 1639type = objectCreationExpression.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2505if (semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol is ITypeSymbol type && !type.CanSupportCollectionInitializer(containingSymbol))