2551 references to TypeKind
Aspire.Hosting.Azure.Provisioning.Generators (7)
AspireProvisioningProxyGenerator.cs (7)
444namedType.TypeKind is TypeKind.Class or TypeKind.Struct && 1993if (parameter.Type.TypeKind == TypeKind.Enum) 2586return type.TypeKind is TypeKind.Class or TypeKind.Struct && 2593return type.TypeKind == TypeKind.Struct && !type.IsReadOnly; 2665if (type.TypeKind == TypeKind.Enum)
Aspire.Hosting.Integration.Analyzers (6)
AspireExportAnalyzer.cs (6)
919contextNamedType.TypeKind is TypeKind.Enum or TypeKind.Interface) 973return type.TypeKind == TypeKind.Delegate || 1438namedType.TypeArguments[0].TypeKind is not TypeKind.Interface) 2238if (type.TypeKind == TypeKind.Enum) 2609return namedType.TypeKind == TypeKind.Delegate;
ConfigurationSchemaGenerator (8)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (7)
69type.TypeKind is TypeKind.TypeParameter or TypeKind.Pointer or TypeKind.Error || 192else if (type.TypeKind is TypeKind.Array) 602if (!(typeSymbol.IsAbstract || typeSymbol.TypeKind is TypeKind.Interface)) 841if (typeArg.TypeKind is TypeKind.TypeParameter or TypeKind.Error ||
RuntimeSource\SourceGenerators\TypeRef.cs (1)
33public TypeKind TypeKind { get; }
dotnet-format (1)
Analyzers\AnalyzerRunner.cs (1)
103if (compilation.ObjectType.TypeKind == TypeKind.Error)
GenerateDocumentationAndConfigFiles (120)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
520=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
113if (type1.TypeKind == TypeKind.TypeParameter && 114type2.TypeKind == TypeKind.TypeParameter &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (5)
48case TypeKind.Class: 49if (type.TypeKind == TypeKind.Interface) 56case TypeKind.Interface: 71if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 86if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
412namedType.TypeKind != TypeKind.Interface ||
src\roslyn\src\RoslynAnalyzers\Utilities\Workspaces\SyntaxGeneratorExtensions.cs (6)
42if (containingType.TypeKind == TypeKind.Class) 143if (containingType.TypeKind == TypeKind.Class) 195if (containingType.TypeKind == TypeKind.Class) 242if (containingType.TypeKind == TypeKind.Class) 290if (containingType.TypeKind == TypeKind.Class) 355if (containingType.TypeKind == TypeKind.Class)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
37if (typeSymbol.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
152if (namedType.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
418TypeKind typeKind, string name, 437bool isRecord, TypeKind typeKind, string name, 488typeKind: TypeKind.Delegate,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
43public override TypeKind TypeKind => TypeKind.Array;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
93public override TypeKind TypeKind => _constructedFrom.TypeKind;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
29TypeKind typeKind, 63public override TypeKind TypeKind { get; } 95return this.TypeKind == TypeKind.Delegate
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
19public override TypeKind TypeKind => TypeKind.Pointer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
60public override TypeKind TypeKind => TypeKind.TypeParameter;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (3)
27public abstract TypeKind TypeKind { get; } 39public bool IsValueType => TypeKind is TypeKind.Struct or TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
518if (containingType?.TypeKind == TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
124member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented)
ILLink.RoslynAnalyzer (12)
DataFlow\LocalDataFlowAnalysis.cs (1)
86if (Context.OwningSymbol is INamedTypeSymbol { TypeKind: TypeKind.Delegate })
ISymbolExtensions.cs (1)
193return typeSymbol.TypeKind == TypeKind.Interface;
RequiresAnalyzerBase.cs (1)
190if (typeSymbol.TypeKind != TypeKind.Class || typeSymbol.BaseType == null)
TrimAnalysis\HandleCallAction.cs (1)
166else if (staticType.IsSealed || staticType.IsTypeOf("System", "Delegate") || staticType.TypeKind == TypeKind.Array)
TrimAnalysis\SingleValueExtensions.cs (6)
21TypeKind.TypeParameter => 25TypeKind.Error => new SystemTypeValue(new TypeProxy(type)), 26TypeKind.Class or TypeKind.Enum or TypeKind.Interface or TypeKind.Struct =>
TrimAnalysis\TrimAnalysisVisitor.cs (2)
202(operation.Type?.TypeKind == TypeKind.Enum || operation.Type?.SpecialType == SpecialType.System_Int32)) 534else if (operation.Type?.TypeKind == TypeKind.Enum && constantValue is int enumConstantValue)
Microsoft.Analyzers.Extra (3)
CallAnalysis\Arrays.cs (2)
108if (keyType.TypeKind == TypeKind.Enum 112if (keyType.TypeKind == TypeKind.Enum)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
42if (type.TypeKind == TypeKind.Interface)
Microsoft.Analyzers.Local (2)
ApiLifecycle\AssemblyAnalysis.cs (1)
195if (type.TypeKind != TypeKind.Delegate)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
42if (type.TypeKind == TypeKind.Interface)
Microsoft.AspNetCore.App.Analyzers (5)
src\aspnetcore\src\Shared\Roslyn\CodeAnalysisExtensions.cs (1)
107if (source.TypeKind == TypeKind.Interface)
src\aspnetcore\src\Shared\Roslyn\MvcFacts.cs (1)
17if (type.TypeKind != TypeKind.Class)
src\aspnetcore\src\Shared\RoslynUtils\ParsabilityHelper.cs (1)
26if (typeSymbol.TypeKind == TypeKind.Enum)
src\aspnetcore\src\Shared\RoslynUtils\SymbolExtensions.cs (2)
311return typeSymbol.TypeKind == TypeKind.Enum; 321if (underlyingType?.TypeKind == TypeKind.Enum)
Microsoft.AspNetCore.App.SourceGenerators (1)
PublicTopLevelProgramGenerator.cs (1)
32TypeKind: TypeKind.Class,
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentDisposableSanityAnalyzer.cs (1)
45if (type.TypeKind != TypeKind.Class || !type.AllInterfaces.Any(i => SymbolEqualityComparer.Default.Equals(i, iComponentType)))
Microsoft.AspNetCore.Http.RequestDelegateGenerator (6)
src\aspnetcore\src\Shared\RoslynUtils\ParsabilityHelper.cs (1)
26if (typeSymbol.TypeKind == TypeKind.Enum)
src\aspnetcore\src\Shared\RoslynUtils\SymbolExtensions.cs (2)
311return typeSymbol.TypeKind == TypeKind.Enum; 321if (underlyingType?.TypeKind == TypeKind.Enum)
StaticRouteHandlerModel\Emitters\EndpointParameterEmitter.cs (1)
340var receiverType = endpointParameter.BindableMethodSymbol?.ReceiverType is { TypeKind: TypeKind.Interface } targetType
StaticRouteHandlerModel\EndpointParameter.cs (1)
312if (type.TypeKind == TypeKind.Array)
StaticRouteHandlerModel\EndpointResponse.cs (1)
76ResponseType.TypeKind != TypeKind.Error &&
Microsoft.AspNetCore.Mvc.Analyzers (6)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (2)
26if (typeCache.PageModelAttribute == null || typeCache.PageModelAttribute.TypeKind == TypeKind.Error) 77return type.TypeKind == TypeKind.Class &&
src\aspnetcore\src\Shared\Roslyn\CodeAnalysisExtensions.cs (1)
107if (source.TypeKind == TypeKind.Interface)
src\aspnetcore\src\Shared\Roslyn\MvcFacts.cs (1)
17if (type.TypeKind != TypeKind.Class)
TagHelpersInCodeBlocksAnalyzer.cs (1)
175return typeSymbol != null && typeSymbol.TypeKind != TypeKind.Error;
TopLevelParameterNameAnalyzer.cs (1)
301return typeSymbol != null && typeSymbol.TypeKind != TypeKind.Error;
Microsoft.AspNetCore.OpenApi.SourceGenerators (4)
Helpers\ISymbolExtensions.cs (1)
171return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } &&
XmlCommentGenerator.Parser.cs (1)
127symbol is not INamedTypeSymbol { TypeKind: TypeKind.Class, IsStatic: true })
XmlComments\XmlComment.InheritDoc.cs (2)
297if (typeSymbol.TypeKind == TypeKind.Class) 303else if (typeSymbol.TypeKind == TypeKind.Interface)
Microsoft.Build.TaskAuthoring.Analyzer (3)
MultiThreadableTaskDeclarationAnalyzer.cs (1)
76if (type.TypeKind != TypeKind.Class)
TaskEnvironmentConstructorInjectionAnalyzer.cs (1)
56if (taskType.TypeKind != TypeKind.Class ||
UnsupportedTaskItemTypeAnalyzer.cs (1)
100if (typeArg.TypeKind == TypeKind.TypeParameter)
Microsoft.CodeAnalysis (23)
Compilation\Expression.cs (1)
41if (type.TypeKind == TypeKind.Enum)
Emit\EditAndContinue\DefinitionMap.cs (1)
660if (displayClass.TypeKind == TypeKind.Struct)
MetadataReader\MetadataDecoder.cs (7)
400Debug.Assert(!refersToNoPiaLocalType || generic.TypeKind == TypeKind.Error); 1022value = (type.IsReferenceType || type.TypeKind == TypeKind.Pointer || type.TypeKind == TypeKind.FunctionPointer) ? ConstantValue.Null : ConstantValue.Bad; 1549return (type.TypeKind == TypeKind.Enum) ? TypedConstantKind.Enum : TypedConstantKind.Primitive; 2144if (type.TypeKind == TypeKind.Error) 2149Debug.Assert(type.TypeKind == TypeKind.Array); 2155if (type.TypeKind == TypeKind.Error)
Operations\CommonConversion.cs (1)
89ContainingType: { TypeKind: TypeKind.Interface, Name: WellKnownMemberNames.UnionMembersInterfaceName, Arity: 0, ContainingType.IsUnion: true }
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (2)
142if (type.TypeKind == TypeKind.Enum) 185if (typeSymbol.TypeKind != TypeKind.Enum)
Symbols\INamedTypeSymbolInternal.cs (3)
36if (type.TypeKind == TypeKind.Enum) 75case TypeKind.Enum: 77case TypeKind.Struct:
Symbols\ITypeSymbol.cs (1)
27TypeKind TypeKind { get; }
Symbols\ITypeSymbolInternal.cs (1)
14TypeKind TypeKind { get; }
Symbols\TypedConstant.cs (4)
143if (_type!.SpecialType == specialType || (_type.TypeKind == TypeKind.Enum && specialType == SpecialType.System_Enum)) 182case TypeKind.Array: 184case TypeKind.Enum: 186case TypeKind.Error:
Symbols\TypeKind.cs (2)
102internal const TypeKind FunctionType = (TypeKind)255;
Microsoft.CodeAnalysis.Analyzers (132)
MetaAnalyzers\ClassIsNotDiagnosticAnalyzer.cs (1)
51if (namedType.TypeKind == TypeKind.Class &&
MetaAnalyzers\CompareSymbolsCorrectlyAnalyzer.cs (1)
297operation.Type.TypeKind == TypeKind.Class &&
MetaAnalyzers\DiagnosticAnalyzerAPIUsageAnalyzer.cs (1)
262usedType.TypeKind != TypeKind.Error)
MetaAnalyzers\RegisterActionAnalyzer.cs (2)
401typeArgument.TypeKind != TypeKind.TypeParameter && 402typeArgument.TypeKind != TypeKind.Error &&
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (2)
391if (typeArgument.TypeKind != TypeKind.TypeParameter && 392typeArgument.TypeKind != TypeKind.Error &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamedTypeMetricData.cs (5)
134case TypeKind.Class: 135case TypeKind.Interface: 146case TypeKind.Struct: 147case TypeKind.Enum: 148case TypeKind.Delegate:
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
520=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
113if (type1.TypeKind == TypeKind.TypeParameter && 114type2.TypeKind == TypeKind.TypeParameter &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (5)
48case TypeKind.Class: 49if (type.TypeKind == TypeKind.Interface) 56case TypeKind.Interface: 71if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 86if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
412namedType.TypeKind != TypeKind.Interface ||
src\roslyn\src\RoslynAnalyzers\Utilities\Workspaces\SyntaxGeneratorExtensions.cs (6)
42if (containingType.TypeKind == TypeKind.Class) 143if (containingType.TypeKind == TypeKind.Class) 195if (containingType.TypeKind == TypeKind.Class) 242if (containingType.TypeKind == TypeKind.Class) 290if (containingType.TypeKind == TypeKind.Class) 355if (containingType.TypeKind == TypeKind.Class)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
37if (typeSymbol.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
152if (namedType.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
418TypeKind typeKind, string name, 437bool isRecord, TypeKind typeKind, string name, 488typeKind: TypeKind.Delegate,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
43public override TypeKind TypeKind => TypeKind.Array;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
93public override TypeKind TypeKind => _constructedFrom.TypeKind;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
29TypeKind typeKind, 63public override TypeKind TypeKind { get; } 95return this.TypeKind == TypeKind.Delegate
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
19public override TypeKind TypeKind => TypeKind.Pointer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
60public override TypeKind TypeKind => TypeKind.TypeParameter;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (3)
27public abstract TypeKind TypeKind { get; } 39public bool IsValueType => TypeKind is TypeKind.Struct or TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
518if (containingType?.TypeKind == TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
124member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented)
Microsoft.CodeAnalysis.AnalyzerUtilities (105)
src\a172c07bebba4cd8\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (1)
37Debug.Assert(CollectionNamedTypes.All(ct => ct.TypeKind == TypeKind.Interface));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamedTypeMetricData.cs (5)
134case TypeKind.Class: 135case TypeKind.Interface: 146case TypeKind.Struct: 147case TypeKind.Enum: 148case TypeKind.Delegate:
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
520=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
113if (type1.TypeKind == TypeKind.TypeParameter && 114type2.TypeKind == TypeKind.TypeParameter &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (5)
48case TypeKind.Class: 49if (type.TypeKind == TypeKind.Interface) 56case TypeKind.Interface: 71if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 86if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
412namedType.TypeKind != TypeKind.Interface ||
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataSymbolMap.cs (1)
124if (namedTypeSymbol.TypeKind == TypeKind.Interface
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (4)
1349static bool IsInterfaceOrTypeParameter(ITypeSymbol? type) => type?.TypeKind is TypeKind.Interface or TypeKind.TypeParameter; 2404if (argument.Parameter?.Type.TypeKind == TypeKind.Delegate || 2411if (argument.Parameter.Type.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
Microsoft.CodeAnalysis.CodeStyle (93)
src\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
183if (value.Type.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (2)
90if (typeWithoutNullable.TypeKind == TypeKind.Enum) 122if (type.RemoveNullableIfPresent()?.TypeKind != TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (1)
27if (switchExpressionType?.TypeKind == TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (1)
68if (switchExpressionType?.TypeKind == TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
177if (namedType.TypeKind is not TypeKind.Class and not TypeKind.Struct and not TypeKind.Module)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
Microsoft.CodeAnalysis.CodeStyle.Fixes (60)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol.ContainingType?.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (4)
402return TypeToGenerateIn?.TypeKind is (TypeKind?)TypeKind.Class or (TypeKind?)TypeKind.Struct;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
58baseType.TypeKind == TypeKind.Error) 108if (classType.TypeKind == TypeKind.Struct)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (11)
19protected static readonly ISet<TypeKind> EnumType = new HashSet<TypeKind> { TypeKind.Enum }; 20protected static readonly ISet<TypeKind> ClassInterfaceModuleStructTypes = new HashSet<TypeKind> 22TypeKind.Class, 23TypeKind.Module, 24TypeKind.Struct, 25TypeKind.Interface 31ISet<TypeKind> typeKinds) 42if (typeToGenerateIn.TypeKind == TypeKind.Interface && isStatic)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
24protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, [NotNullWhen(true)] out IMethodSymbol? methodSymbol, [NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn); 25protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, [NotNullWhen(true)] out IMethodSymbol? methodSymbol, [NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (2)
59var classTypes = constraints.Where(ts => ts.TypeKind == TypeKind.Class).ToList(); 60var nonClassTypes = constraints.Where(ts => ts.TypeKind != TypeKind.Class).ToList();
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (2)
76generateMethodBodies: _state.TypeToGenerateIn.TypeKind != TypeKind.Interface)), 92generateMethodBodies: _state.TypeToGenerateIn.TypeKind != TypeKind.Interface)),
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
47state.TypeToGenerateIn.TypeKind != TypeKind.Interface &&
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
193return isAbstract || State.TypeToGenerateIn.TypeKind == TypeKind.Interface || throwStatement == null 225if (State.TypeToGenerateIn.TypeKind != TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (1)
73generateMethodBodies: TypeToGenerateIn.TypeKind != TypeKind.Interface);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (2)
117return _state.TypeToGenerateIn.TypeKind != TypeKind.Interface && _refKind != RefKind.None 124if (state.TypeToGenerateIn.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (3)
97if (state.TypeToGenerateIn.TypeKind == TypeKind.Interface && state.IsStatic) 107var isOnlyReadAndIsInInterface = state.TypeToGenerateIn.TypeKind == TypeKind.Interface && !state.IsWrittenTo; 141if (state.TypeToGenerateIn.TypeKind != TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
86if (this.TypeToGenerateIn.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
226if (state.ClassOrStructType.TypeKind != TypeKind.Class) 249if (idisposable?.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
271var condition1 = typeParameter.ConstraintTypes.Count(t => t.TypeKind == TypeKind.Class) >= 2;
src\roslyn\src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
40type.TypeKind == TypeKind.Class && type.IsSealed && !type.IsStatic)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (2)
195conversion.Type.TypeKind != TypeKind.Error) 199if (conversion.Operand.Type == null || conversion.Operand.Type.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
37if (typeSymbol.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
152if (namedType.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
418TypeKind typeKind, string name, 437bool isRecord, TypeKind typeKind, string name, 488typeKind: TypeKind.Delegate,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
43public override TypeKind TypeKind => TypeKind.Array;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
93public override TypeKind TypeKind => _constructedFrom.TypeKind;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
29TypeKind typeKind, 63public override TypeKind TypeKind { get; } 95return this.TypeKind == TypeKind.Delegate
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
19public override TypeKind TypeKind => TypeKind.Pointer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
60public override TypeKind TypeKind => TypeKind.TypeParameter;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (3)
27public abstract TypeKind TypeKind { get; } 39public bool IsValueType => TypeKind is TypeKind.Struct or TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
518if (containingType?.TypeKind == TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
124member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented)
Microsoft.CodeAnalysis.CSharp (782)
Binder\Binder_Attributes.cs (2)
58if (boundTypeSymbol.TypeKind != TypeKind.Error) 736parameter.Type.TypeKind == TypeKind.Array &&
Binder\Binder_Constraints.cs (14)
505type.TypeKind == TypeKind.Class) 585case TypeKind.Error: 586case TypeKind.TypeParameter: 589case TypeKind.Interface: 592case TypeKind.Dynamic: 597case TypeKind.Class: 600goto case TypeKind.Struct; 610case TypeKind.Delegate: 611case TypeKind.Enum: 612case TypeKind.Struct: 617case TypeKind.Array: 618case TypeKind.Pointer: 619case TypeKind.FunctionPointer: 624case TypeKind.Submission:
Binder\Binder_Conversions.cs (26)
858case TypeKind.Enum: 859case TypeKind.Struct: 860case TypeKind.Class when !type.IsAnonymousType: // We don't want to enable object creation with unspeakable types 862case TypeKind.TypeParameter: 864case TypeKind.Delegate: 866case TypeKind.Interface: 868case TypeKind.Array: 869case TypeKind.Class: 870case TypeKind.Dynamic: 872goto case TypeKind.Error; 873case TypeKind.Pointer: 874case TypeKind.FunctionPointer: 876goto case TypeKind.Error; 877case TypeKind.Error: 3519Debug.Assert(delegateType is NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { HasUseSiteError: false } } 3520|| delegateType.TypeKind == TypeKind.FunctionPointer, 3636static bool hasConversion(TypeKind targetKind, Conversions conversions, TypeSymbol source, TypeSymbol destination, 3657return targetKind == TypeKind.FunctionPointer 3662static ErrorCode getMethodMismatchErrorCode(TypeKind type) 3665TypeKind.Delegate => ErrorCode.ERR_MethDelegateMismatch, 3666TypeKind.FunctionPointer => ErrorCode.ERR_MethFuncPtrMismatch, 3670static ErrorCode getRefMismatchErrorCode(TypeKind type) 3673TypeKind.Delegate => ErrorCode.ERR_DelegateRefMismatch, 3674TypeKind.FunctionPointer => ErrorCode.ERR_FuncPtrRefMismatch, 3710Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer);
Binder\Binder_Crefs.cs (12)
761case TypeKind.Array: 763case TypeKind.Pointer: 765case TypeKind.FunctionPointer: 781case TypeKind.Delegate: 782case TypeKind.Class: 783case TypeKind.Interface: 784case TypeKind.Struct: 785case TypeKind.Enum: 786case TypeKind.Error: 802case TypeKind.Dynamic: 803case TypeKind.TypeParameter: 1201Debug.Assert(type.TypeKind != TypeKind.Error || typeSyntax.ContainsDiagnostics || !typeSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics(), "Why wasn't there a diagnostic?");
Binder\Binder_Expressions.cs (39)
2447if (this.ContainingType.TypeKind == TypeKind.Submission 2451if (memberDeclaringType.TypeKind == TypeKind.Submission) 2902if (targetType.TypeKind != TypeKind.Delegate || 2955TypeKind.FunctionPointer => ErrorCode.ERR_MethFuncPtrMismatch, 2956TypeKind.Delegate => ErrorCode.ERR_CannotConvertAddressOfToDelegate, 4934if ((containingType.TypeKind == TypeKind.Enum || containingType.TypeKind == TypeKind.Struct) && initializerArgumentListOpt == null) 4985else if (initializerArgumentListOpt != null && containingType.TypeKind == TypeKind.Struct) 5311case TypeKind.Struct: 5312case TypeKind.Class: 5313case TypeKind.Enum: 5314case TypeKind.Error: 5317case TypeKind.Delegate: 5320case TypeKind.Interface: 5323case TypeKind.TypeParameter: 5326case TypeKind.Pointer: 5327case TypeKind.FunctionPointer: 5330goto case TypeKind.Class; 5332case TypeKind.Submission: 5334case TypeKind.Dynamic: 5336case TypeKind.Array: 5340goto case TypeKind.Class; 5478if (arg.Type is { TypeKind: TypeKind.Dynamic }) 5639else if (argument.Type.TypeKind == TypeKind.Delegate) 5739Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 7132Debug.Assert(coClassType.TypeKind == TypeKind.Class || coClassType.TypeKind == TypeKind.Error); 7513if (type.TypeKind == TypeKind.Enum) 8144if (leftType.TypeKind == TypeKind.TypeParameter) 10020if (receiverOpt is not BoundTypeExpression { Type: { TypeKind: TypeKind.TypeParameter } }) 10618case TypeKind.Array: 10621case TypeKind.Dynamic: 10624case TypeKind.Pointer: 10627case TypeKind.Class: 10628case TypeKind.Struct: 10629case TypeKind.Interface: 10630case TypeKind.TypeParameter: 10633case TypeKind.Submission: // script class is synthesized and should not be used as a type of an indexer expression:
Binder\Binder_InterpolatedString.cs (2)
397if (value.Type?.TypeKind == TypeKind.Dynamic) 433&& unconvertedInterpolatedString.Parts.All(p => p is not BoundStringInsert { Value.Type.TypeKind: TypeKind.Dynamic });
Binder\Binder_Lookup.cs (24)
284case TypeKind.TypeParameter: 288case TypeKind.Interface: 292case TypeKind.Class: 293case TypeKind.Struct: 294case TypeKind.Enum: 295case TypeKind.Delegate: 296case TypeKind.Array: 297case TypeKind.Dynamic: 298case TypeKind.Submission: 302case TypeKind.Error: 306case TypeKind.Pointer: 307case TypeKind.FunctionPointer: 308case TypeKind.Extension: 312case TypeKind.Unknown: 908Debug.Assert(!type.IsInterfaceType() && type.TypeKind != TypeKind.TypeParameter); 1973case TypeKind.TypeParameter: 1977case TypeKind.Interface: 1981case TypeKind.Class: 1982case TypeKind.Struct: 1983case TypeKind.Enum: 1984case TypeKind.Delegate: 1985case TypeKind.Array: 1986case TypeKind.Dynamic: 1987case TypeKind.Submission:
Binder\Binder_Operators.cs (15)
1041leftType?.TypeKind == TypeKind.FunctionPointer && rightType?.TypeKind == TypeKind.FunctionPointer) 1309(object?)left.Type != null && left.Type.TypeKind == TypeKind.Delegate) 4815return targetType.TypeKind == TypeKind.Error; 4875var targetTypeKind = targetType.TypeKind; 4918if (targetTypeKind == TypeKind.Dynamic) 4928if (inputType.TypeKind == TypeKind.Dynamic) 5372var targetTypeKind = targetType.TypeKind; 5405if (operand.HasAnyErrors || targetTypeKind == TypeKind.Error) 5421if (targetTypeKind == TypeKind.TypeParameter) 5425else if (targetTypeKind == TypeKind.Pointer || targetTypeKind == TypeKind.FunctionPointer) 5476var operandTypeKind = operandType.TypeKind; 5486if (operandTypeKind == TypeKind.Dynamic) 5493if (targetTypeKind == TypeKind.Dynamic)
Binder\Binder_Patterns.cs (1)
1469if (iTupleType.TypeKind != TypeKind.Interface)
Binder\Binder_Query.cs (1)
968if (ultimateReceiver.Type.TypeKind == TypeKind.TypeParameter)
Binder\Binder_QueryErrors.cs (1)
82if (instanceType.TypeKind == TypeKind.Array || name == "Cast" && HasCastToQueryProvider(instanceType, ref useSiteInfo))
Binder\Binder_Statements.cs (6)
2356if (targetType.TypeKind == TypeKind.Error) 2416if (targetType.TypeKind == TypeKind.TypeParameter) 2515case TypeKind.FunctionPointer when fromAddressOf: 2518case TypeKind.FunctionPointer: 2521case TypeKind.Delegate when fromAddressOf: 2524case TypeKind.Delegate:
Binder\ForEachLoopBinder.cs (7)
1655case TypeKind.Class: 1656case TypeKind.Struct: 1657case TypeKind.Interface: 1658case TypeKind.TypeParameter: // Not specifically mentioned in the spec, but consistent with Dev10. 1659case TypeKind.Dynamic: // Not specifically mentioned in the spec, but consistent with Dev10. 1662case TypeKind.Submission: 1849if (type.TypeKind == TypeKind.TypeParameter)
Binder\PatternExplainer.cs (1)
813if (type is NamedTypeSymbol { TypeKind: TypeKind.Enum } e)
Binder\Semantics\AccessCheck.cs (3)
368if (containingType.TypeKind == TypeKind.Submission) 430if (originalContainingType.TypeKind == TypeKind.Submission) 700: containingType.TypeKind == TypeKind.Struct ? ErrorCode.ERR_ProtectedInStruct
Binder\Semantics\Conversions\Conversions.cs (1)
537if (spanType.TypeKind == TypeKind.Struct && spanType.IsRefLikeType)
Binder\Semantics\Conversions\ConversionsBase.cs (7)
2195if (otherType.TypeKind == TypeKind.Enum) 2672case TypeKind.Class: 2681case TypeKind.Interface: 2686case TypeKind.Delegate: 2691case TypeKind.TypeParameter: 2694case TypeKind.Array: 3330if ((source.TypeKind == TypeKind.TypeParameter) &&
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (1)
266if (op.ReturnsVoid || op.ParameterCount != 1 || op.ReturnType.TypeKind == TypeKind.Error)
Binder\Semantics\Operators\OperatorFacts.cs (4)
21case TypeKind.Struct: 22case TypeKind.Class: 23case TypeKind.TypeParameter: 24case TypeKind.Interface:
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (15)
506if (type.TypeKind != TypeKind.TypeParameter) return false; 1890if (source.TypeKind == TypeKind.Pointer && target.TypeKind == TypeKind.Pointer) 2263if (target.TypeKind != TypeKind.Class) 2282if (source.TypeKind == TypeKind.Class) 2286else if (source.TypeKind == TypeKind.TypeParameter) 2324case TypeKind.Struct: 2325case TypeKind.Class: 2326case TypeKind.Interface: 2330case TypeKind.TypeParameter: 2660if (source.TypeKind != TypeKind.Class || target.TypeKind != TypeKind.Class) 2701case TypeKind.Struct: 2702case TypeKind.Class: 2703case TypeKind.Interface:
Binder\Semantics\OverloadResolution\OverloadResolution.cs (3)
2505if (m1.Member.ContainingType.TypeKind == TypeKind.Submission && m2.Member.ContainingType.TypeKind == TypeKind.Submission) 2825if (t1.TypeKind == TypeKind.Pointer)
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (2)
1261else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate && 1266else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer)
CodeGen\EmitAddress.cs (3)
426Debug.Assert(arrayAccess.Type.TypeKind == TypeKind.TypeParameter, "constrained call should only be used with type parameter types"); 536Debug.Assert(receiverType.TypeKind == TypeKind.TypeParameter || receiverType.IsValueType); 543return receiverType.TypeKind == TypeKind.TypeParameter && addressKind != AddressKind.Constrained;
CodeGen\EmitConversion.cs (1)
362if (receiver is not BoundTypeExpression { Type: { TypeKind: TypeKind.TypeParameter } })
CodeGen\EmitExpression.cs (7)
440(receiverType.IsReferenceType && receiverType.TypeKind == TypeKind.TypeParameter) || 817Debug.Assert(thisType.TypeKind != TypeKind.TypeParameter); 1094if (elementType.TypeKind == TypeKind.TypeParameter) 2711if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 3553if (type is { TypeKind: TypeKind.TypeParameter } && constantValue.IsNull) 4175Debug.Assert(load.Type is { TypeKind: TypeKind.FunctionPointer }); 4181if (load.ConstrainedToTypeOpt is not { TypeKind: TypeKind.TypeParameter })
CodeGen\EmitStackAllocInitializer.cs (1)
27var elementType = (type.TypeKind == TypeKind.Pointer
CodeGen\EmitStatement.cs (1)
180if (exprType?.TypeKind == TypeKind.TypeParameter)
Compilation\CSharpCompilation.cs (9)
2032if (mainType is null || mainType.IsGenericType || (mainType.TypeKind != TypeKind.Class && mainType.TypeKind != TypeKind.Struct && !mainType.IsInterface)) 2350if (firstType.TypeKind != TypeKind.Array) 4467if (csharpReturnType.TypeKind is TypeKind.Dynamic || 4468csharpLeftType.TypeKind is TypeKind.Dynamic || 4469csharpRightType.TypeKind is TypeKind.Dynamic) 4511if (csharpLeftType.TypeKind is TypeKind.Delegate && 4693if (csharpReturnType.TypeKind is TypeKind.Dynamic || 4694csharpOperandType.TypeKind is TypeKind.Dynamic)
Compilation\CSharpSemanticModel.cs (3)
550if (varTypeInfo.Type is { TypeKind: not TypeKind.Error }) 992if (varTypeInfo.Type is { TypeKind: not TypeKind.Error }) 2253else if (boundExpr is BoundConversion { ConversionKind: ConversionKind.MethodGroup, Conversion: var exprConversion, Type: { TypeKind: TypeKind.FunctionPointer }, SymbolOpt: var symbol })
Compiler\ClsComplianceChecker.cs (22)
254if (symbol.TypeKind == TypeKind.Delegate) 285if (paramType.TypeKind == TypeKind.Array || 474if (type.TypeKind == TypeKind.Delegate) 605if (argument.TypeInternal.TypeKind == TypeKind.Array) 621if (argument.TypeInternal.TypeKind == TypeKind.Array) 639if (type.TypeKind == TypeKind.Array) 738System.Diagnostics.Debug.Assert(method.ContainingType.TypeKind == TypeKind.Delegate); 985case TypeKind.Array: 987case TypeKind.Dynamic: 992case TypeKind.Pointer: 993case TypeKind.FunctionPointer: 995case TypeKind.Error: 996case TypeKind.TypeParameter: 1000case TypeKind.Class: 1001case TypeKind.Struct: 1002case TypeKind.Interface: 1003case TypeKind.Delegate: 1004case TypeKind.Enum: 1005case TypeKind.Submission: 1032if (type.TypeKind == TypeKind.Error) 1372TypeKind typeKind = xType.TypeKind; 1378if (typeKind == TypeKind.Array)
Compiler\MethodCompiler.cs (3)
643containingType is { IsImplicitlyDeclared: false, TypeKind: TypeKind.Class or TypeKind.Struct or TypeKind.Interface } &&
Emitter\Model\MethodSymbolAdapter.cs (1)
635return this.IsExtern || (object)ContainingType != null && ContainingType.TypeKind == TypeKind.Delegate;
Emitter\Model\NamedTypeSymbolAdapter.cs (3)
45get { return AdaptedNamedTypeSymbol.TypeKind == TypeKind.Enum; } 523case TypeKind.Enum: 524case TypeKind.Delegate:
Emitter\NoPia\EmbeddedType.cs (3)
158case TypeKind.Enum: 159case TypeKind.Delegate: 161case TypeKind.Interface:
Emitter\NoPia\EmbeddedTypesManager.cs (16)
321case TypeKind.Interface: 344goto case TypeKind.Struct; 345case TypeKind.Struct: 346case TypeKind.Delegate: 347case TypeKind.Enum: 453Debug.Assert(namedType.TypeKind == TypeKind.Struct || namedType.TypeKind == TypeKind.Enum || namedType.TypeKind == TypeKind.Delegate); 456if (namedType.TypeKind == TypeKind.Struct || namedType.TypeKind == TypeKind.Enum) 506var containerKind = field.AdaptedFieldSymbol.ContainingType.TypeKind; 509if (containerKind == TypeKind.Interface || containerKind == TypeKind.Delegate || 510(containerKind == TypeKind.Struct && (field.AdaptedFieldSymbol.IsStatic || field.AdaptedFieldSymbol.DeclaredAccessibility != Accessibility.Public))) 545case TypeKind.Struct: 546case TypeKind.Enum:
FlowAnalysis\AbstractFlowPass.cs (1)
2244fieldSymbol.ContainingType.TypeKind == TypeKind.Struct &&
FlowAnalysis\DefiniteAssignment.cs (8)
103&& CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }; 1006variableBySlot[slot].Symbol.GetTypeOrReturnType().TypeKind == TypeKind.Struct; 1084(_trackClassFields || type.TypeKind == TypeKind.Struct); 1211Debug.Assert(CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }); 1264if (CurrentSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }) 2625case TypeKind.Array: 2629case TypeKind.Class: 2630case TypeKind.Struct:
FlowAnalysis\EmptyStructTypeCache.cs (4)
235case TypeKind.Enum: 236case TypeKind.Struct: 237case TypeKind.TypeParameter: 239case TypeKind.Array:
FlowAnalysis\NullableWalker.cs (7)
2559return valueType.Type?.TypeKind == TypeKind.TypeParameter && 2751targetType.TypeKind == TypeKind.TypeParameter || 2847fieldOrPropertyType.TypeKind == TypeKind.TypeParameter || 5009if (type.TypeKind != TypeKind.Struct) 6177{ TypeKind: TypeKind.Interface } => type.AllInterfacesNoUseSiteDiagnostics, 9974NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { Parameters: { } parameters } signature } => (signature, parameters), 10966case BoundExpression arg when arg.Type is { TypeKind: TypeKind.Delegate }:
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (2)
582LocalSymbol thisTemp = (F.CurrentType.TypeKind == TypeKind.Class) ? F.SynthesizedLocal(F.CurrentType) : null; 643LocalSymbol thisTemp = (F.CurrentType.TypeKind == TypeKind.Class) ? F.SynthesizedLocal(F.CurrentType) : null;
Lowering\AsyncRewriter\AsyncRewriter.cs (6)
74var typeKind = (compilationState.Compilation.Options.EnableEditAndContinue || method.IsIterator) ? TypeKind.Class : TypeKind.Struct; 172if (F.CurrentType.TypeKind == TypeKind.Class) 195if (stateMachineType.TypeKind == TypeKind.Class) 204if (frameType.TypeKind == TypeKind.Class)
Lowering\AsyncRewriter\AsyncStateMachine.cs (3)
20private readonly TypeKind _typeKind; 25public AsyncStateMachine(VariableSlotAllocator variableAllocatorOpt, TypeCompilationState compilationState, MethodSymbol asyncMethod, int asyncMethodOrdinal, TypeKind typeKind) 64public override TypeKind TypeKind
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (2)
610if (e.StrippedType().TypeKind == TypeKind.Enum) 819if ((object)d != null && d.TypeKind == TypeKind.Delegate)
Lowering\ClosureConversion\SynthesizedClosureEnvironment.cs (3)
39public override TypeKind TypeKind { get; } 56TypeKind = isStruct ? TypeKind.Struct : TypeKind.Class;
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
241_ when variableType.TypeKind is TypeKind.Struct
Lowering\IteratorRewriter\IteratorStateMachine.cs (2)
46public override TypeKind TypeKind 48get { return TypeKind.Class; }
Lowering\LocalRewriter\DelegateCacheContainer.cs (2)
50public override TypeKind TypeKind => TypeKind.Class;
Lowering\LocalRewriter\DynamicSiteContainer.cs (2)
40public override TypeKind TypeKind 42get { return TypeKind.Class; }
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (4)
2279Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2284Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2471Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2472Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer });
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (1)
556case ConversionKind.MethodGroup when oldNodeOpt is { Type: { TypeKind: TypeKind.FunctionPointer } funcPtrType }:
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (2)
213else if (fixedCollectionInitializer.Expression.Type is { TypeKind: TypeKind.Array }) 241Debug.Assert(initializerExpr.Type is { TypeKind: TypeKind.Pointer });
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (4)
876Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 904Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1025Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1053Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array });
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.cs (1)
15Debug.Assert(targetType.TypeKind == TypeKind.Submission);
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (1)
37if (rewrittenReceiverOpt is { Type: { TypeKind: TypeKind.Array } } && !isLeftOfAssignment)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (1)
933Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer });
Lowering\LocalRewriter\LocalRewriter.cs (1)
850Debug.Assert(node.Expression.Type is { TypeKind: TypeKind.Array });
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
71if (!method.IsStatic && method.ContainingType.TypeKind == TypeKind.Struct && !isRuntimeAsync)
Lowering\SyntheticBoundNodeFactory.cs (3)
1199Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1205Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1218Debug.Assert(array.Type is { TypeKind: TypeKind.Array });
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (1)
18else if (type.IsReferenceType || type.TypeKind == TypeKind.Pointer || ITypeSymbolHelpers.IsNullableType(type))
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (1)
153if (symbol.TypeKind != TypeKind.Error)
SymbolDisplay\SymbolDisplayVisitor.cs (3)
312if (type != null && type.TypeKind != TypeKind.Error) 375(containingType.TypeKind != TypeKind.Interface && !IsEnumMember(symbol) & !IsLocalFunction(symbol)))) 467&& symbol.ContainingType.TypeKind == TypeKind.Enum
SymbolDisplay\SymbolDisplayVisitor.Members.cs (4)
70else if (symbol.ContainingType.TypeKind == TypeKind.Enum) 887if (type.TypeKind == TypeKind.Enum) 938if (containingType?.TypeKind != TypeKind.Interface) 974if (containingType?.TypeKind != TypeKind.Interface)
SymbolDisplay\SymbolDisplayVisitor.Types.cs (26)
231if (typeArg.TypeKind != TypeKind.Pointer) 286var shouldSkip = namespaceSymbol.IsGlobalNamespace && symbol.TypeKind == TypeKind.Error; 329if (symbol.IsAnonymousType && symbol.TypeKind != TypeKind.Delegate) 382if (symbolName is null && symbol.IsAnonymousType && symbol.TypeKind == TypeKind.Delegate) 547if (tupleSymbol.TypeKind == TypeKind.Error || 615if (symbol.TypeKind == TypeKind.Error && 634symbol.TypeKind == TypeKind.Delegate && 643case TypeKind.Class when symbol.IsRecord: 645case TypeKind.Struct when symbol.IsRecord: 647case TypeKind.Submission: 648case TypeKind.Module: 649case TypeKind.Class: 651case TypeKind.Delegate: 653case TypeKind.Enum: 655case TypeKind.Error: 657case TypeKind.Interface: 659case TypeKind.Struct: 729if (symbol.IsAnonymousType && symbol.TypeKind != TypeKind.Delegate) 743case TypeKind.Class when symbol.IsRecord: 748case TypeKind.Struct when symbol.IsRecord: 764case TypeKind.Module: 765case TypeKind.Class: 770case TypeKind.Enum: 775case TypeKind.Delegate: 780case TypeKind.Interface: 785case TypeKind.Struct:
Symbols\AnonymousTypes\PublicSymbols\AnonymousManager.TypeOrDelegatePublicSymbol.cs (1)
179public abstract override TypeKind TypeKind { get; }
Symbols\AnonymousTypes\PublicSymbols\AnonymousType.DelegatePublicSymbol.cs (2)
37public override TypeKind TypeKind => TypeKind.Delegate;
Symbols\AnonymousTypes\PublicSymbols\AnonymousType.TypePublicSymbol.cs (2)
78public override TypeKind TypeKind 80get { return TypeKind.Class; }
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.DelegateTemplateSymbol.cs (2)
227public override TypeKind TypeKind => TypeKind.Delegate;
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (2)
101public override TypeKind TypeKind 103get { return TypeKind.Class; }
Symbols\ArrayTypeSymbol.cs (3)
295public override TypeKind TypeKind 299return TypeKind.Array; 377while (current.TypeKind == TypeKind.Array)
Symbols\AssemblySymbol.cs (4)
521=> GetSpecialType(InternalSpecialType.System_Runtime_CompilerServices_AsyncHelpers) is { TypeKind: TypeKind.Class, IsStatic: true }; 528return GetSpecialType(SpecialType.System_Runtime_CompilerServices_RuntimeFeature) is { TypeKind: TypeKind.Class, IsStatic: true } && 551GetSpecialType(SpecialType.System_Runtime_CompilerServices_PreserveBaseOverridesAttribute) is { TypeKind: TypeKind.Class }; 1061if (result is null || result.TypeKind == TypeKind.Error)
Symbols\BaseTypeAnalysis.cs (1)
118if (fieldType is null || fieldType.TypeKind != TypeKind.Struct || field.IsStatic)
Symbols\Compilation_WellKnownMembers.cs (5)
227if (type.Kind != SymbolKind.NamedType || type.TypeKind != TypeKind.Class) 984case TypeKind.Dynamic: 988case TypeKind.Array: 997case TypeKind.Pointer: 1006case TypeKind.FunctionPointer:
Symbols\ConstantValueUtils.cs (1)
89if (typeSymbol.TypeKind == TypeKind.TypeParameter)
Symbols\ConstraintsHelper.cs (28)
168case TypeKind.TypeParameter: 219case TypeKind.Interface: 220case TypeKind.Class: 221case TypeKind.Delegate: 223Debug.Assert(inherited || currentCompilation == null || constraintType.TypeKind != TypeKind.Delegate); 238case TypeKind.Struct: 242if (underlyingType.TypeKind == TypeKind.TypeParameter) 262case TypeKind.Enum: 268case TypeKind.Array: 274case TypeKind.Error: 279case TypeKind.Pointer: 280case TypeKind.FunctionPointer: 285case TypeKind.Submission: 1197else if (typeArgument.TypeKind == TypeKind.TypeParameter) 1383if (typeArgument.TypeKind == TypeKind.TypeParameter) 1483case TypeKind.Struct: 1486case TypeKind.Enum: 1487case TypeKind.Dynamic: 1490case TypeKind.Class: 1498case TypeKind.TypeParameter: 1504case TypeKind.Submission: 1515Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 1565case TypeKind.Array: 1566case TypeKind.Class: 1567case TypeKind.Delegate: 1568case TypeKind.Enum: 1569case TypeKind.Struct:
Symbols\DynamicTypeSymbol.cs (3)
63public override TypeKind TypeKind 67return TypeKind.Dynamic; 203if (ReferenceEquals(this, t2) || t2.TypeKind == TypeKind.Dynamic)
Symbols\EnumConversions.cs (8)
13internal static TypeKind ToTypeKind(this DeclarationKind kind) 21return TypeKind.Class; 24return TypeKind.Submission; 27return TypeKind.Delegate; 30return TypeKind.Enum; 33return TypeKind.Interface; 38return TypeKind.Struct; 41return TypeKind.Extension;
Symbols\ErrorTypeSymbol.cs (2)
236public sealed override TypeKind TypeKind 240return TypeKind.Error;
Symbols\ExtendedErrorTypeSymbol.cs (8)
224if ((object?)oldSymbol == null || oldSymbol.TypeKind != TypeKind.Error) 250internal static TypeKind ExtractNonErrorTypeKind(TypeSymbol oldSymbol) 252if (oldSymbol.TypeKind != TypeKind.Error) 267TypeKind commonTypeKind = TypeKind.Error; 273if ((object?)type != null && type.TypeKind != TypeKind.Error) 275if (commonTypeKind == TypeKind.Error) 278return TypeKind.Error; // no common kind.
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (2)
76public override TypeKind TypeKind => TypeKind.FunctionPointer;
Symbols\FunctionTypeSymbol.cs (1)
102public override TypeKind TypeKind => TypeKindInternal.FunctionType;
Symbols\Metadata\PE\MetadataDecoder.cs (4)
397case TypeKind.Interface: 411case TypeKind.Delegate: 412case TypeKind.Enum: 413case TypeKind.Struct:
Symbols\Metadata\PE\NativeIntegerTypeDecoder.cs (11)
86case TypeKind.Array: 88case TypeKind.Pointer: 90case TypeKind.FunctionPointer: 92case TypeKind.TypeParameter: 93case TypeKind.Dynamic: 95case TypeKind.Class: 96case TypeKind.Struct: 97case TypeKind.Interface: 98case TypeKind.Delegate: 99case TypeKind.Enum: 102Debug.Assert(type.TypeKind == TypeKind.Error);
Symbols\Metadata\PE\PEMethodSymbol.cs (2)
1344if ((this.ContainingType.TypeKind == TypeKind.Class && this.IsRuntimeFinalizer(skipFirstMethodKindCheck: true)) || 1351if (_containingType.TypeKind == TypeKind.Delegate)
Symbols\Metadata\PE\PENamedTypeSymbol.cs (30)
72private TypeKind _lazyKind; 122if (this.TypeKind is TypeKind.Enum or TypeKind.Extension) 1435if (this.TypeKind == TypeKind.Enum) 1640&& this.TypeKind == TypeKind.Enum) 1734if (this.TypeKind == TypeKind.Enum) 1793if (this.TypeKind == TypeKind.Struct) 2203case TypeKind.Class: 2204case TypeKind.Struct: 2205case TypeKind.Delegate: 2232public override TypeKind TypeKind 2236var result = (TypeKind)Volatile.Read(ref Unsafe.As<TypeKind, byte>(ref _lazyKind)); 2238if (result == TypeKind.Unknown) 2243result = TypeKind.Extension; 2247result = TypeKind.Interface; 2253result = TypeKind.Class; 2263result = TypeKind.Enum; 2268result = TypeKind.Delegate; 2276result = TypeKind.Struct; 2405bool checkForExtensionGroup = this.IsStatic && this.ContainingType is null && this.TypeKind == TypeKind.Class && 2428type.TypeKind == TypeKind.Class && type.BaseTypeNoUseSiteDiagnostics.IsObjectType() && 2452marker.TypeKind == TypeKind.Class && marker.BaseTypeNoUseSiteDiagnostics.IsObjectType() && marker.Arity == 0 && 2492if (this.TypeKind == TypeKind.Struct) 2575var isOrdinaryEmbeddableStruct = (this.TypeKind == TypeKind.Struct) && (this.SpecialType == Microsoft.CodeAnalysis.SpecialType.None) && this.ContainingAssembly.IsLinked; 2739else if (TypeKind == TypeKind.Class && SpecialType != SpecialType.System_Enum) 2900if (this.TypeKind == TypeKind.Struct) 2949if (this.TypeKind == TypeKind.Struct) 2991var coClassType = ((object)type != null && (type.TypeKind == TypeKind.Class || type.IsErrorType())) ? (NamedTypeSymbol)type : null;
Symbols\MissingMetadataTypeSymbol.cs (1)
376t2.TypeKind == TypeKind.Dynamic &&
Symbols\NamedTypeSymbol.cs (15)
223if (TypeKind != TypeKind.Delegate) 581var kind = TypeKind; 582return kind != TypeKind.Enum && kind != TypeKind.Struct && kind != TypeKind.Error; 595var kind = TypeKind; 596return kind == TypeKind.Struct || kind == TypeKind.Enum; 629return TypeKind == TypeKind.Submission; 648var name = (TypeKind == TypeKind.Submission) ? SynthesizedEntryPointSymbol.FactoryName : SynthesizedEntryPointSymbol.MainName; 696=> TypeKind == TypeKind.Extension; 1109if (t2.TypeKind == TypeKind.Dynamic) 1935/// Requires less computation than <see cref="TypeSymbol.TypeKind"/> == <see cref="TypeKind.Interface"/>. 1948return TypeKind is TypeKind.Class or TypeKind.Struct &&
Symbols\NamespaceOrTypeSymbol.cs (1)
213TypeKind typeKind = kind.ToDeclarationKind().ToTypeKind();
Symbols\PointerTypeSymbol.cs (3)
166public override TypeKind TypeKind 170return TypeKind.Pointer; 220while (current.TypeKind == TypeKind.Pointer)
Symbols\PublicModel\TypeSymbol.cs (1)
149TypeKind ITypeSymbol.TypeKind
Symbols\Retargeting\RetargetingSymbolTranslator.cs (2)
842Debug.Assert(nts.TypeKind == TypeKind.Error || nts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 854Debug.Assert(ts.TypeKind == TypeKind.Error || ts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive);
Symbols\Source\ExplicitInterfaceHelpers.cs (3)
197case TypeKind.Class: 198case TypeKind.Struct: 199case TypeKind.Interface:
Symbols\Source\SourceAssemblySymbol.cs (1)
2226Debug.Assert(forwardedType.TypeKind != TypeKind.Error);
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
81if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error && 82binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
Symbols\Source\SourceEventSymbol.cs (4)
662else if (IsAbstract && ContainingType.TypeKind == TypeKind.Struct) 667else if (IsVirtual && ContainingType.TypeKind == TypeKind.Struct) 708else if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission))
Symbols\Source\SourceFixedFieldSymbol.cs (2)
169public override TypeKind TypeKind 171get { return TypeKind.Struct; }
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (7)
519case TypeKind.Enum: 520case TypeKind.Delegate: 521case TypeKind.Extension: 524case TypeKind.Class: 525case TypeKind.Struct: 526case TypeKind.Interface: 527case TypeKind.Submission: // we have to check that "override" is not used
Symbols\Source\SourceMemberContainerSymbol.cs (48)
103public TypeKind TypeKind 105get { return (TypeKind)((_flags >> TypeKindOffset) & TypeKindMask); } 119public Flags(ExtendedSpecialType specialType, TypeKind typeKind, bool hasPrimaryConstructor) 240TypeKind typeKind = declaration.Kind.ToTypeKind(); 264Debug.Assert(typeKind is TypeKind.Struct or TypeKind.Class || !HasPrimaryConstructor); 293private DeclarationModifiers MakeModifiers(TypeKind typeKind, BindingDiagnosticBag diagnostics) 300if (typeKind == TypeKind.Extension) 329case TypeKind.Class: 330case TypeKind.Submission: 340case TypeKind.Struct: 349case TypeKind.Interface: 352case TypeKind.Delegate: 398case TypeKind.Interface: 401case TypeKind.Class: 406case TypeKind.Struct: 407case TypeKind.Enum: 408case TypeKind.Delegate: 409case TypeKind.Extension: 828public override TypeKind TypeKind 849return this.TypeKind == TypeKind.Interface; 1499case TypeKind.Class: 1500case TypeKind.Struct: 1503case TypeKind.Interface: 1510case TypeKind.Extension: 1655if (this.TypeKind == TypeKind.Enum) 2704if (this.TypeKind is TypeKind.Delegate or TypeKind.Extension) 2768if (TypeKind != TypeKind.Struct) 2793Debug.Assert(TypeKind == TypeKind.Struct); 2827(type.TypeKind == TypeKind.Struct) && 3158if (f is null || !f.IsStatic || f.Type.TypeKind != TypeKind.Struct) continue; 3187if (f is null || !f.IsStatic || f.Type.TypeKind != TypeKind.Struct) continue; 3722case TypeKind.Struct: 3727case TypeKind.Enum: 3731case TypeKind.Class: 3732case TypeKind.Interface: 3733case TypeKind.Submission: 4005if (TypeKind is TypeKind.Class) 4012case TypeKind.Struct: 4013case TypeKind.Enum: 4014case TypeKind.Class: 4015case TypeKind.Interface: 4016case TypeKind.Submission: 4020if (TypeKind == TypeKind.Class) // Tracked by https://github.com/dotnet/roslyn/issues/78827 : MQ, Consider tightening this check to only top-level non-generic static classes, however optimizing for error scenarios is usually not a goal. 4037if (type.TypeKind == TypeKind.Extension) 4915Debug.Assert(TypeKind == TypeKind.Struct); 5725builder.AddNonTypeMember(this, (this.TypeKind == TypeKind.Submission) ?
Symbols\Source\SourceMemberFieldSymbol.cs (1)
608if (ContainingType.TypeKind != TypeKind.Struct)
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
1487if (ContainingSymbol is NamedTypeSymbol { IsComImport: true, TypeKind: TypeKind.Class or TypeKind.Interface })
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (32)
44TypeKind is not (TypeKind.Enum or TypeKind.Delegate or TypeKind.Submission)) 282if (this.TypeKind == TypeKind.Enum) 312else if (baseType.TypeKind == TypeKind.Error && (object)partBase != null) 319else if ((object)partBase != null && !TypeSymbol.Equals(partBase, baseType, TypeCompareKind.ConsiderEverything) && partBase.TypeKind != TypeKind.Error) 524if (i == 0 && TypeKind == TypeKind.Class) // allow class in the first position 563if (baseType.TypeKind == TypeKind.Error) 567TypeKind guessTypeKind = baseType.GetNonErrorTypeKindGuess(); 568if (guessTypeKind == TypeKind.Interface) 575if ((baseType.TypeKind == TypeKind.Class || 576baseType.TypeKind == TypeKind.Delegate || 577baseType.TypeKind == TypeKind.Struct || 605case TypeKind.Interface: 638case TypeKind.Class: 639if (TypeKind == TypeKind.Class) 655case TypeKind.TypeParameter: 659case TypeKind.Error: 664case TypeKind.Dynamic: 668case TypeKind.Submission: 689if (TypeKind != TypeKind.Class || baseType.TypeKind == TypeKind.Interface) 721var typeKind = this.TypeKind; 723if (typeKind == TypeKind.Enum) 730bool isInterface = (typeKind == TypeKind.Interface); 772var typeKind = this.TypeKind; 777if (typeKind == TypeKind.Enum) 783else if (typeKind == TypeKind.Extension) 797case TypeKind.Class: 807case TypeKind.Struct: 812case TypeKind.Interface: 815case TypeKind.Delegate:
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (2)
46if (this.TypeKind != TypeKind.Enum) 89if (this.TypeKind != TypeKind.Enum)
Symbols\Source\SourceNamedTypeSymbol.cs (14)
822case TypeKind.Delegate: 825case TypeKind.Enum: 826case TypeKind.Interface: 829case TypeKind.Struct: 830case TypeKind.Class: 1228if (TypeKind != TypeKind.Struct) 1257return builderType is NamedTypeSymbol { TypeKind: TypeKind.Class or TypeKind.Struct, IsGenericType: false }; 1364if ((object)coClassType != null && coClassType.TypeKind == TypeKind.Class) 1554if (this.TypeKind == TypeKind.Struct) 1658if (this.TypeKind == TypeKind.Class) 2010if (TypeKind == TypeKind.Struct && !IsRecordStruct && HasInlineArrayAttribute(out _)) 2096if (TypeKind == TypeKind.Struct && HasExtendedLayoutAttribute) 2120|| TypeKind != TypeKind.Class
Symbols\Source\SourceOrdinaryMethodSymbol.cs (5)
908else if (IsSealed && ContainingType.TypeKind == TypeKind.Struct) 930else if (IsAbstract && ContainingType.TypeKind == TypeKind.Struct) 935else if (IsVirtual && ContainingType.TypeKind == TypeKind.Struct) 945else if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission))
Symbols\Source\SourcePropertyAccessorSymbol.cs (3)
569if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission)) 574else if (IsVirtual && ContainingType.IsSealed && ContainingType.TypeKind != TypeKind.Struct) // error CS0106 on struct already
Symbols\Source\SourcePropertySymbolBase.cs (2)
1161else if (IsAbstract && ContainingType.TypeKind == TypeKind.Struct) 1166else if (IsVirtual && ContainingType.TypeKind == TypeKind.Struct)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
422case { TypeKind: TypeKind.TypeParameter, IsReferenceType: false }:
Symbols\Source\ThisParameterSymbol.cs (1)
157if (ContainingType?.TypeKind != TypeKind.Struct)
Symbols\Symbol_Attributes.cs (7)
70case TypeKind.Class: 73case TypeKind.Delegate: 76case TypeKind.Enum: 79case TypeKind.Interface: 82case TypeKind.Struct: 85case TypeKind.TypeParameter: 88case TypeKind.Submission:
Symbols\Symbol.cs (3)
257if (ContainingType?.TypeKind == TypeKind.Submission) 279if (ContainingType.TypeKind == TypeKind.Submission) 290Debug.Assert(ContainingType.TypeKind != TypeKind.Submission);
Symbols\SymbolExtensions.cs (3)
85return superType.TypeKind == TypeKind.Submission && subType.TypeKind == TypeKind.Submission; 239if (type.TypeKind == TypeKind.TypeParameter)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorTypeSymbol.cs (2)
147public override TypeKind TypeKind => TypeKind.Class;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (2)
867public override TypeKind TypeKind => TypeKind.Class;
Symbols\Synthesized\SynthesizedContainer.cs (3)
48internal sealed override bool IsInterface => this.TypeKind == TypeKind.Interface; 94public override bool IsAbstract => (object)Constructor == null && this.TypeKind != TypeKind.Struct; 168internal override NamedTypeSymbol BaseTypeNoUseSiteDiagnostics => ContainingAssembly.GetSpecialType(this.TypeKind == TypeKind.Struct ? SpecialType.System_ValueType : SpecialType.System_Object);
Symbols\Synthesized\SynthesizedEmbeddedAttributeSymbol.cs (2)
79public override TypeKind TypeKind => TypeKind.Class;
Symbols\Synthesized\SynthesizedHotReloadExceptionSymbol.cs (2)
106public override TypeKind TypeKind => TypeKind.Class;
Symbols\Synthesized\SynthesizedInlineArrayTypeSymbol.cs (2)
64public override TypeKind TypeKind => TypeKind.Struct;
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (2)
84Debug.Assert(_containingType.TypeKind == TypeKind.Class); 88if (_containingType.TypeKind == TypeKind.Delegate)
Symbols\Synthesized\SynthesizedPrivateImplementationDetailsType.cs (2)
57public override TypeKind TypeKind => TypeKind.Class;
Symbols\Synthesized\SynthesizedSubmissionConstructor.cs (1)
19Debug.Assert(containingType.TypeKind == TypeKind.Submission);
Symbols\TypeParameterSymbol.cs (7)
196public sealed override TypeKind TypeKind 200return TypeKind.TypeParameter; 394if (constraint.TypeKind == TypeKind.TypeParameter) 404Debug.Assert(constraint.TypeKind != TypeKind.TypeParameter); 414case TypeKind.Interface: 416case TypeKind.Error: 485if (constraintType.TypeKind == TypeKind.TypeParameter)
Symbols\TypeSymbol.cs (7)
110var interfaces = (baseType.TypeKind == TypeKind.TypeParameter) ? ((TypeParameterSymbol)baseType).EffectiveInterfacesNoUseSiteDiagnostics : baseType.InterfacesNoUseSiteDiagnostics(); 346var interfaces = (baseType.TypeKind == TypeKind.TypeParameter) ? ((TypeParameterSymbol)baseType).EffectiveInterfacesNoUseSiteDiagnostics : baseType.InterfacesNoUseSiteDiagnostics(); 487public abstract TypeKind TypeKind { get; } 511TypeKind.Pointer => Microsoft.Cci.PrimitiveTypeCode.Pointer, 512TypeKind.FunctionPointer => Microsoft.Cci.PrimitiveTypeCode.FunctionPointer, 2528TypeKind ITypeSymbolInternal.TypeKind => this.TypeKind; 2556if (this.TypeKind == TypeKind.Struct)
Symbols\TypeSymbolExtensions.cs (71)
72if (type.TypeKind != TypeKind.TypeParameter) 118if (type.TypeKind == TypeKind.TypeParameter) 240return type.TypeKind == TypeKind.Enum; 335case TypeKind.Pointer: 336case TypeKind.Dynamic: 337case TypeKind.FunctionPointer: 346return type is { IsValueType: true, TypeKind: not TypeKind.TypeParameter }; 358return type.TypeKind == TypeKind.Class; 364return type.TypeKind == TypeKind.Struct; 380return type.TypeKind == TypeKind.Dynamic; 386return type.TypeKind == TypeKind.TypeParameter; 392return type.TypeKind == TypeKind.Array; 398return type.TypeKind == TypeKind.Array && ((ArrayTypeSymbol)type).IsSZArray; 441return type.TypeKind == TypeKind.FunctionPointer; 448case TypeKind.Pointer: 449case TypeKind.FunctionPointer: 461case TypeKind.Class: 462case TypeKind.Struct: 465case TypeKind.TypeParameter: 611return type.TypeKind == TypeKind.Delegate; 747case TypeKind.Class: 748case TypeKind.Struct: 749case TypeKind.Interface: 750case TypeKind.Enum: 751case TypeKind.Delegate: 752case TypeKind.Submission: 822case TypeKind.Class: 823case TypeKind.Struct: 824case TypeKind.Interface: 825case TypeKind.Enum: 826case TypeKind.Delegate: 841case TypeKind.Submission: 880case TypeKind.Dynamic: 881case TypeKind.TypeParameter: 882case TypeKind.Submission: 883case TypeKind.Enum: 893goto case TypeKind.Delegate; 895case TypeKind.Error: 896case TypeKind.Class: 897case TypeKind.Struct: 898case TypeKind.Interface: 899case TypeKind.Delegate: 900case TypeKind.Extension: 968case TypeKind.Array: 972case TypeKind.Pointer: 976case TypeKind.FunctionPointer: 1211if (ReferenceEquals(parent2.OriginalDefinition, parent1OriginalDefinition) || parent1OriginalDefinition.TypeKind == TypeKind.Submission && parent2.TypeKind == TypeKind.Submission) 1251(type, parameter, unused) => type.TypeKind == TypeKind.TypeParameter && (parameter is null || TypeSymbol.Equals(type, parameter, TypeCompareKind.ConsiderEverything2)); 1262(type, typeParameterContainer, unused) => type.TypeKind == TypeKind.TypeParameter && (object)type.ContainingSymbol == (object)typeParameterContainer; 1271(type, parameters, unused) => type.TypeKind == TypeKind.TypeParameter && parameters.Contains((TypeParameterSymbol)type); 1318(type, _, _) => type.TypeKind == TypeKind.TypeParameter && type.ContainingSymbol is MethodSymbol; 1329private static readonly Func<TypeSymbol, object?, bool, bool> s_containsDynamicPredicate = (type, unused1, unused2) => type.TypeKind == TypeKind.Dynamic; 1367type.VisitType((TypeSymbol t, object? _, bool _) => t.TypeKind is TypeKind.Pointer or TypeKind.FunctionPointer, null) is object; 1395internal static TypeKind GetNonErrorTypeKindGuess(this TypeSymbol type) 1594case TypeKind.Struct: 1597case TypeKind.Array: 1598case TypeKind.Class: 1599case TypeKind.Delegate: 1600case TypeKind.Dynamic: 1601case TypeKind.Error: 1602case TypeKind.Interface: 1603case TypeKind.Pointer: 1604case TypeKind.FunctionPointer: 1607case TypeKind.Enum: 1610case TypeKind.TypeParameter: 1613case TypeKind.Submission: 1754return type.IsReferenceType && type.TypeKind != TypeKind.TypeParameter; 1762return type.IsValueType && type.TypeKind != TypeKind.TypeParameter; 2087if (taskType.TypeKind == TypeKind.Error)
Symbols\TypeWithAnnotations.cs (4)
200if (typeSymbol.TypeKind != TypeKind.TypeParameter) 271public TypeKind TypeKind => Type.TypeKind; 650if (type.TypeKind != TypeKind.Array) 1068Debug.Assert(underlying.TypeKind == TypeKind.TypeParameter);
Symbols\VarianceSafety.cs (12)
75case TypeKind.Class: 76case TypeKind.Struct: 77case TypeKind.Enum: 79case TypeKind.Extension: 82case TypeKind.Interface: 83case TypeKind.Delegate: 373case TypeKind.Class: 374case TypeKind.Struct: 375case TypeKind.Enum: // Can't be generic, but can be nested in generic. 376case TypeKind.Interface: 377case TypeKind.Delegate: 378case TypeKind.Error:
Symbols\Wrapped\WrappedNamedTypeSymbol.cs (1)
113public override TypeKind TypeKind
Utilities\TypeSymbolExtensions.cs (17)
183case TypeKind.TypeParameter: 186case TypeKind.Class: 187case TypeKind.Struct: 188case TypeKind.Error: 189case TypeKind.Interface: 192case TypeKind.Dynamic: 193case TypeKind.Enum: 194case TypeKind.Delegate: 195case TypeKind.Array: 196case TypeKind.Submission: 197case TypeKind.Pointer: 198case TypeKind.FunctionPointer: 199case TypeKind.Extension: 278case TypeKind.Class: 279case TypeKind.Error: 281case TypeKind.Interface: 283case TypeKind.Struct:
Microsoft.CodeAnalysis.CSharp.CodeStyle (28)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
90if (syntaxContext.SemanticModel.GetTypeInfo(invocationExpression.Expression, syntaxContext.CancellationToken).Type is { TypeKind: TypeKind.FunctionPointer })
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
56if (namedTypeSymbol.TypeKind != TypeKind.Struct)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
58TypeKind: TypeKind.Struct, 256return instance is { Type.TypeKind: TypeKind.Struct } ||
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
82if (typeSymbol.TypeKind is not TypeKind.Struct)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
140if (invokedMethod is { ContainingType.TypeKind: TypeKind.Struct, IsReadOnly: false, ContainingType.IsReadOnly: false })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
115if (symbolInfo.GetAnySymbol() is not IFieldSymbol { ContainingType.TypeKind: TypeKind.Struct })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
138if (operation?.Parent is IAssignmentOperation { Type.TypeKind: TypeKind.Dynamic })
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
128if (asType?.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
120if (isType?.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
274if (namedType.TypeKind is not (TypeKind.Class or TypeKind.Struct))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (3)
66if (lockType.GetTypeMembers("Scope").FirstOrDefault() is not { TypeKind: TypeKind.Struct, IsRefLikeType: true, DeclaredAccessibility: Accessibility.Public }) 78if (namedType is not { TypeKind: TypeKind.Class or TypeKind.Struct })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (2)
42if (typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (2)
211if (containingType != null && containingType.TypeKind == TypeKind.Interface) 445if (parameter.Type.OriginalDefinition.TypeKind != TypeKind.TypeParameter)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (8)
253if (originalDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 270if (rewrittenDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 316if (originalConvertedType is null || originalConvertedType.TypeKind == TypeKind.Error) 375if (rewrittenConvertedType.TypeKind == TypeKind.Error) 594originalConvertedType.IsReferenceType && rewrittenConvertedType.TypeKind == TypeKind.Dynamic) 1116if (!original.IsReferenceType || original.TypeKind == TypeKind.Interface) 1459if (originalMemberSymbol.ContainingType.TypeKind == TypeKind.Interface) 1499rewrittenType.TypeKind == TypeKind.Array ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
260if (declaredType.TypeKind == TypeKind.Dynamic)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (43)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
44TypeKind: TypeKind.Class or TypeKind.Struct, 272recordKeyword = type.TypeKind == TypeKind.Class 417type.TypeKind == TypeKind.Class 423type.TypeKind == TypeKind.Class
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (1)
179if (containingType.TypeKind == TypeKind.Struct && !containingType.IsReadOnly)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
39return classType?.TypeKind is TypeKind.Class or TypeKind.Struct;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (5)
56ISet<TypeKind> classInterfaceModuleStructTypes, 82ISet<TypeKind> classInterfaceModuleStructTypes, 108ISet<TypeKind> classInterfaceModuleStructTypes, 136ISet<TypeKind> classInterfaceModuleStructTypes, 167ISet<TypeKind> classInterfaceModuleStructTypes,
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
71if (interfaceSymbolInfo.GetAnySymbol() is INamedTypeSymbol interfaceType && interfaceType.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
85if (type != null && type.TypeKind != TypeKind.Error) 124return type.TypeKind == TypeKind.Enum &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
47if (type == null || type.TypeKind == TypeKind.Error || type.IsAnonymousType)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
390semanticModel.GetSymbolInfo(baseType.Type, cancellationToken).GetAnySymbol() is INamedTypeSymbol { TypeKind: TypeKind.Class })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
60if (type is INamedTypeSymbol { TypeKind: TypeKind.Enum } enumType)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
293if (constraintType.IsReferenceType && constraintType.TypeKind != TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (8)
96if (info.Context.GenerateMembers && namedType.TypeKind != TypeKind.Delegate) 188if (namedType.TypeKind == TypeKind.Enum) 192else if (namedType.TypeKind == TypeKind.Delegate) 200var isRecordClass = namedType.TypeKind is TypeKind.Class; 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration; 293if (namedType.TypeKind == TypeKind.Class) 321if (namedType is { TypeKind: TypeKind.Class, BaseType: not null, BaseType.SpecialType: not SpecialType.System_Object })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
3062return ((INamedTypeSymbol)symbol).TypeKind == TypeKind.Enum; 3065return target.IsType && ((ITypeSymbol)target).TypeKind == TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (4)
59typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Class).Concat( 60typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Interface).Concat( 61typeParameter.ConstraintTypes.Where(t => t.TypeKind is not TypeKind.Class and not TypeKind.Interface)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (2)
53if (symbol.ContainingType.TypeKind == TypeKind.Submission) 67if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (4)
197if (symbol is { TypeKind: TypeKind.Error, Name: "var" }) 234if (innerType.TypeKind != TypeKind.Pointer) 269if (symbol.ContainingType.TypeKind != TypeKind.Submission) 288if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
447if (type.TypeKind == TypeKind.Delegate) 1037if (parentTypes.Any(static parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate)) 1039return parentTypes.Where(parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate);
Microsoft.CodeAnalysis.CSharp.Features (72)
ChangeSignature\CSharpChangeSignatureService.cs (1)
166if (typeSymbol is INamedTypeSymbol { TypeKind: TypeKind.Delegate })
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (2)
105if (type.TypeKind == TypeKind.Interface) 113if (type.TypeKind == TypeKind.TypeParameter)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (5)
124if (type.TypeKind != TypeKind.Enum) 179if (type.TypeKind == TypeKind.Enum) 285if (containingType?.TypeKind == TypeKind.Enum && 342if (type.TypeKind is TypeKind.Struct or TypeKind.Class)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.ItemGetter.cs (4)
100if (symbol is not { TypeKind: TypeKind.Interface }) 108if (containingType is not INamedTypeSymbol { TypeKind: TypeKind.Class or TypeKind.Struct or TypeKind.Interface })
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (3)
156if (semanticModel.GetTypeInfo(objectCreationExpression, cancellationToken).Type is not INamedTypeSymbol { TypeKind: not TypeKind.Delegate } type) 191if (within is not { TypeKind: TypeKind.Struct or TypeKind.Class })
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (6)
963return method.ContainingType.TypeKind != TypeKind.Struct; 967if (method.ContainingType.TypeKind == TypeKind.Struct) 1965TypeKind.Struct => symbol.IsRecord ? CSharpFeaturesResources.record_struct : FeaturesResources.struct_, 1966TypeKind.Class => symbol.IsRecord ? CSharpFeaturesResources.record_ : FeaturesResources.class_, 2557{ ContainingType.TypeKind: TypeKind.Interface } 2562IFieldSymbol { ContainingType.TypeKind: TypeKind.Enum }
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (1)
95var expression = returnType.TypeKind == TypeKind.Array && containingScope is InitializerExpressionSyntax initializerExpression
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (2)
189semanticInfo.TypeKind is TypeKind.Error or TypeKind.Unknown)
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
137info.ConvertedType.TypeKind != TypeKind.Interface)
GenerateType\CSharpGenerateTypeService.cs (1)
438if (expressionType is INamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: var invokeMethod })
NavigationBar\CSharpNavigationBarItemService.cs (1)
259return symbol.ContainingType.TypeKind == TypeKind.Enum
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
71if (within.TypeKind is not TypeKind.Struct and not TypeKind.Class)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (2)
72if (invokedType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } or IFunctionPointerTypeSymbol) 120if (invokedType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } expressionType)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
68if (type.TypeKind == TypeKind.Delegate) 105Debug.Assert(type.TypeKind == TypeKind.Delegate);
Snippets\AbstractCSharpTypeSnippetProvider.cs (1)
26TypeKind typeKind, string defaultPrefix = "")
Snippets\CSharpClassSnippetProvider.cs (1)
19: AbstractCSharpTypeSnippetProvider<ClassDeclarationSyntax>(TypeKind.Class)
Snippets\CSharpConsoleSnippetProvider.cs (1)
42if (lambdaSymbol is IMethodSymbol { ReturnType: { SpecialType: SpecialType.System_Void } or { TypeKind: TypeKind.Error } })
Snippets\CSharpEnumSnippetProvider.cs (1)
19: AbstractCSharpTypeSnippetProvider<EnumDeclarationSyntax>(TypeKind.Enum)
Snippets\CSharpInterfaceSnippetProvider.cs (1)
19: AbstractCSharpTypeSnippetProvider<InterfaceDeclarationSyntax>(TypeKind.Interface, defaultPrefix: "I")
Snippets\CSharpStructSnippetProvider.cs (1)
19: AbstractCSharpTypeSnippetProvider<StructDeclarationSyntax>(TypeKind.Struct)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
90if (syntaxContext.SemanticModel.GetTypeInfo(invocationExpression.Expression, syntaxContext.CancellationToken).Type is { TypeKind: TypeKind.FunctionPointer })
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
56if (namedTypeSymbol.TypeKind != TypeKind.Struct)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
58TypeKind: TypeKind.Struct, 256return instance is { Type.TypeKind: TypeKind.Struct } ||
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
82if (typeSymbol.TypeKind is not TypeKind.Struct)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
140if (invokedMethod is { ContainingType.TypeKind: TypeKind.Struct, IsReadOnly: false, ContainingType.IsReadOnly: false })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
115if (symbolInfo.GetAnySymbol() is not IFieldSymbol { ContainingType.TypeKind: TypeKind.Struct })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
138if (operation?.Parent is IAssignmentOperation { Type.TypeKind: TypeKind.Dynamic })
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
128if (asType?.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
120if (isType?.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
274if (namedType.TypeKind is not (TypeKind.Class or TypeKind.Struct))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (3)
66if (lockType.GetTypeMembers("Scope").FirstOrDefault() is not { TypeKind: TypeKind.Struct, IsRefLikeType: true, DeclaredAccessibility: Accessibility.Public }) 78if (namedType is not { TypeKind: TypeKind.Class or TypeKind.Struct })
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
44TypeKind: TypeKind.Class or TypeKind.Struct, 272recordKeyword = type.TypeKind == TypeKind.Class 417type.TypeKind == TypeKind.Class 423type.TypeKind == TypeKind.Class
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (1)
179if (containingType.TypeKind == TypeKind.Struct && !containingType.IsReadOnly)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
39return classType?.TypeKind is TypeKind.Class or TypeKind.Struct;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (5)
56ISet<TypeKind> classInterfaceModuleStructTypes, 82ISet<TypeKind> classInterfaceModuleStructTypes, 108ISet<TypeKind> classInterfaceModuleStructTypes, 136ISet<TypeKind> classInterfaceModuleStructTypes, 167ISet<TypeKind> classInterfaceModuleStructTypes,
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
71if (interfaceSymbolInfo.GetAnySymbol() is INamedTypeSymbol interfaceType && interfaceType.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
85if (type != null && type.TypeKind != TypeKind.Error) 124return type.TypeKind == TypeKind.Enum &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
47if (type == null || type.TypeKind == TypeKind.Error || type.IsAnonymousType)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
390semanticModel.GetSymbolInfo(baseType.Type, cancellationToken).GetAnySymbol() is INamedTypeSymbol { TypeKind: TypeKind.Class })
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (3)
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.cs (3)
48if (symbol.ContainingType.TypeKind != TypeKind.Submission) 66if (symbol.TypeKind != TypeKind.Error) 133if (symbol.TypeKind == TypeKind.Error && symbol.Name == "var")
Microsoft.CodeAnalysis.CSharp.Workspaces (45)
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (1)
24private static readonly Func<ITypeSymbol, bool> s_shouldInclude = t => t.TypeKind != TypeKind.Error && t.GetArity() > 0;
Rename\CSharpRenameRewriterLanguageService.cs (4)
769matchingLocal is ILocalSymbol { Type.TypeKind: TypeKind.Delegate } || 770matchingLocal is IParameterSymbol { Type.TypeKind: TypeKind.Delegate }; 796if (renamedSymbol is INamedTypeSymbol { TypeKind: not TypeKind.Enum } namedType) 801if (renamedSymbol.ContainingSymbol is INamedTypeSymbol { TypeKind: not TypeKind.Enum } containingNamedType &&
Simplification\CSharpSimplificationService.Expander.cs (1)
793if (typeinfo.Type != null && typeinfo.Type.TypeKind == TypeKind.Dynamic)
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
323if (symbol is { IsStatic: true, ContainingType.TypeKind: TypeKind.Interface } &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (2)
42if (typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (2)
211if (containingType != null && containingType.TypeKind == TypeKind.Interface) 445if (parameter.Type.OriginalDefinition.TypeKind != TypeKind.TypeParameter)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (8)
253if (originalDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 270if (rewrittenDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 316if (originalConvertedType is null || originalConvertedType.TypeKind == TypeKind.Error) 375if (rewrittenConvertedType.TypeKind == TypeKind.Error) 594originalConvertedType.IsReferenceType && rewrittenConvertedType.TypeKind == TypeKind.Dynamic) 1116if (!original.IsReferenceType || original.TypeKind == TypeKind.Interface) 1459if (originalMemberSymbol.ContainingType.TypeKind == TypeKind.Interface) 1499rewrittenType.TypeKind == TypeKind.Array ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
260if (declaredType.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
60if (type is INamedTypeSymbol { TypeKind: TypeKind.Enum } enumType)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
293if (constraintType.IsReferenceType && constraintType.TypeKind != TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (8)
96if (info.Context.GenerateMembers && namedType.TypeKind != TypeKind.Delegate) 188if (namedType.TypeKind == TypeKind.Enum) 192else if (namedType.TypeKind == TypeKind.Delegate) 200var isRecordClass = namedType.TypeKind is TypeKind.Class; 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration; 293if (namedType.TypeKind == TypeKind.Class) 321if (namedType is { TypeKind: TypeKind.Class, BaseType: not null, BaseType.SpecialType: not SpecialType.System_Object })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
3062return ((INamedTypeSymbol)symbol).TypeKind == TypeKind.Enum; 3065return target.IsType && ((ITypeSymbol)target).TypeKind == TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (4)
59typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Class).Concat( 60typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Interface).Concat( 61typeParameter.ConstraintTypes.Where(t => t.TypeKind is not TypeKind.Class and not TypeKind.Interface)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (2)
53if (symbol.ContainingType.TypeKind == TypeKind.Submission) 67if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (4)
197if (symbol is { TypeKind: TypeKind.Error, Name: "var" }) 234if (innerType.TypeKind != TypeKind.Pointer) 269if (symbol.ContainingType.TypeKind != TypeKind.Submission) 288if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
447if (type.TypeKind == TypeKind.Delegate) 1037if (parentTypes.Any(static parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate)) 1039return parentTypes.Where(parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate);
Microsoft.CodeAnalysis.Extensions.Package (45)
Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
Microsoft.CodeAnalysis.Features (165)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (1)
56ContainingType.TypeKind == TypeKind.Interface ||
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (2)
106=> typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct;
Completion\Providers\AbstractObjectCreationCompletionProvider.cs (3)
85if (type.TypeKind is TypeKind.Interface or TypeKind.Pointer or TypeKind.Dynamic ||
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (4)
166return type.TypeKind is not (TypeKind.Delegate or TypeKind.Struct or TypeKind.FunctionPointer or TypeKind.Pointer);
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (2)
87if (enclosingSymbol.TypeKind is not (TypeKind.Struct or TypeKind.Class))
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (1)
121if (namedType.TypeKind == TypeKind.Interface)
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionProvider.cs (1)
80TypeKind: not TypeKind.Error
Completion\Providers\ImportCompletionProvider\ExtensionMemberImportCompletionHelper.SymbolComputer_Constraints.cs (5)
31=> CheckConstraints(receiverTypeSymbol, typeParameter, TypeKind.Interface, static type => type.GetAllInterfacesIncludingThis()); 34=> CheckConstraints(receiverTypeSymbol, typeParameter, TypeKind.Class, static type => type.GetBaseTypesAndThis()); 38TypeKind typeKind, 68TypeKind constraintTypeKind, 105ITypeSymbol type, TypeKind typeKind, Func<ITypeSymbol, IEnumerable<ITypeSymbol>> getInheritanceTypes)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
317isRecord, TypeKind.Class, className, capturedTypeParameters, members: members);
ConvertCast\AbstractConvertCastCodeRefactoringProvider.cs (1)
52if (type is { TypeKind: TypeKind.Error })
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
279if (collectionType.TypeKind == TypeKind.Interface && knownCollectionInterfaces.Contains(collectionType.OriginalDefinition))
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
918TypeKind.Struct, structName, typeParameters, members: members, containingAssembly: containingAssembly);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (20)
297return (symbol is IParameterSymbol { ContainingType: not { TypeKind: TypeKind.Delegate } }) 336TypeKind.Class => FeaturesResources.class_, 337TypeKind.Interface => FeaturesResources.interface_, 338TypeKind.Delegate => FeaturesResources.delegate_, 339TypeKind.Enum => FeaturesResources.enum_, 340TypeKind.TypeParameter => FeaturesResources.type_parameter, 345=> symbol.IsConst ? ((symbol.ContainingType.TypeKind == TypeKind.Enum) ? FeaturesResources.enum_value : FeaturesResources.const_field) : 3453if (oldSymbol is not INamedTypeSymbol { TypeKind: TypeKind.Delegate }) 3720=> IsMember(symbol) || symbol is INamedTypeSymbol { TypeKind: TypeKind.Delegate }; 3857if (symbol.ContainingType is { TypeKind: TypeKind.Interface }) 4767newParameter.ContainingType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } newContainingDelegateType) 4775if (hasReturnTypeAttributeChange && newSymbol is INamedTypeSymbol { TypeKind: TypeKind.Delegate } newDelegateType) 5145if (record.TypeKind == TypeKind.Class) 5350(newSymbol.ContainingType.TypeKind == TypeKind.Struct) ? RudeEditKind.InsertOrMoveStructMember : RudeEditKind.InsertOrMoveTypeWithLayoutMember, 5440if (type.TypeKind == TypeKind.Struct) 5445if (type.TypeKind != TypeKind.Class) 5755if (!isStatic && oldType.TypeKind == TypeKind.Class && newType.TypeKind == TypeKind.Class) 6077var isInInterface = newMember.ContainingType.TypeKind == TypeKind.Interface; 6362=> (parameter.ContainingType.TypeKind == TypeKind.Struct) ? FeaturesResources.struct_ : FeaturesResources.class_with_explicit_or_sequential_layout;
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
89TypeKind.Class,
ExtractInterface\AbstractExtractInterfaceService.cs (4)
92if (semanticModel.GetDeclaredSymbol(typeNode, cancellationToken) is not INamedTypeSymbol { TypeKind: not TypeKind.Extension } typeToExtractFrom) 144typeKind: TypeKind.Interface, 263var candidateInterfaceName = type.TypeKind == TypeKind.Interface ? type.Name : "I" + type.Name; 323if (typeToExtractFrom.TypeKind == TypeKind.Interface)
ExtractInterface\ExtractInterfaceCodeAction.cs (1)
26=> _typeAnalysisResult.TypeToExtractFrom is { TypeKind: TypeKind.Interface }
ExtractMethod\MethodExtractor.Analyzer.cs (1)
117&& thisParameterBeingRead is { Type: { TypeKind: TypeKind.Struct, IsReadOnly: false } };
ExtractMethod\MethodExtractor.cs (2)
231if (type.TypeKind is TypeKind.Error or TypeKind.Unknown)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
198else if (symbol is INamedTypeSymbol { TypeKind: TypeKind.Class } namedType)
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (2)
212if (containingType?.TypeKind is not TypeKind.Class and not TypeKind.Struct)
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.State.cs (1)
67if (ContainingType == null || ContainingType.TypeKind == TypeKind.Interface)
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (4)
90if (containingType?.TypeKind is not TypeKind.Class and not TypeKind.Struct) 179if (info.ContainingType != null && info.ContainingType.TypeKind != TypeKind.Interface) 300if (generateEquals && containingType.TypeKind == TypeKind.Struct)
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (9)
43if (options.TypeKind == TypeKind.Delegate) 139if (_state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface || argumentList.Count == 0) 219if (!(parameters.Count == 0 && options is { TypeKind: TypeKind.Struct })) 277if (_state.BaseTypeOrInterfaceOpt == null || _state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface) 287if (_state.BaseTypeOrInterfaceOpt != null && _state.BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface) 311private TypeKind DetermineTypeKind() 314? TypeKind.Struct 316? TypeKind.Interface 317: TypeKind.Class;
GenerateType\AbstractGenerateTypeService.State.cs (5)
253if (baseType.TypeKind is not TypeKind.Class and not TypeKind.Interface) 283(BaseTypeOrInterfaceOpt == null || BaseTypeOrInterfaceOpt.TypeKind == TypeKind.Interface)) 301if (TypeToGenerateInOpt.TypeKind is not TypeKind.Class and 302not TypeKind.Module)
GenerateType\GenerateTypeOptionsResult.cs (2)
22public TypeKind TypeKind { get; } 30TypeKind typeKind,
GoToBase\FindBaseHelpers.cs (3)
18TypeKind: TypeKind.Class or TypeKind.Interface or TypeKind.Struct,
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
324if (memberSymbol.TypeKind == TypeKind.Interface) 337Debug.Assert(memberSymbol.TypeKind is TypeKind.Class or TypeKind.Struct);
InheritanceMargin\AbstractInheritanceMarginService.cs (3)
73return !symbol.IsStatic && namedType.TypeKind is TypeKind.Interface or TypeKind.Class or TypeKind.Struct;
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
439if (parameterType.TypeKind != TypeKind.Enum)
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
84methodSymbol.ContainingType.TypeKind == TypeKind.Interface)
IntroduceVariable\AbstractIntroduceVariableService.State.cs (1)
98if (containingType?.TypeKind is TypeKind.Interface)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (2)
556if (symbol.TypeKind == TypeKind.Delegate) 641if (symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Enum)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
68public TypeKind TypeKind => _symbol.TypeKind;
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (1)
58if (containingType.TypeKind == TypeKind.Enum)
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
154private static TypeKind GetNewTypeKind(INamedTypeSymbol oldType)
PullMemberUp\MemberAndDestinationValidator.cs (2)
17if (destination.TypeKind is not TypeKind.Interface and not TypeKind.Class)
PullMemberUp\MembersPuller.cs (5)
66TypeKind.Interface => PullMembersIntoInterfaceAsync(document, pullMembersUpOptions, cancellationToken), 68TypeKind.Class or TypeKind.Module => PullMembersIntoClassAsync(document, pullMembersUpOptions, cancellationToken), 127if (analysisResult.Member.ContainingType.TypeKind == TypeKind.Interface) 492return destination.TypeKind == TypeKind.Interface
PullMemberUp\PullMembersUpOptionsBuilder.cs (1)
18if (destination.TypeKind == TypeKind.Interface)
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (1)
379if (property.ContainingType.TypeKind == TypeKind.Interface)
RQName\RQNodeBuilder.cs (3)
289else if (symbol.TypeKind == TypeKind.TypeParameter) 293else if (symbol.TypeKind == TypeKind.Unknown) 297else if (symbol.TypeKind == TypeKind.Dynamic)
Shared\Extensions\ISymbolExtensions_2.cs (9)
41if (containingType != null && containingType.TypeKind == TypeKind.Enum) 61case TypeKind.Extension: 62case TypeKind.Class: 66case TypeKind.Delegate: 70case TypeKind.Enum: 74case TypeKind.Interface: 78case TypeKind.Module: 82case TypeKind.Struct: 86case TypeKind.Error:
Snippets\SnippetFunctionService.cs (1)
60if (typeSymbol?.TypeKind != TypeKind.Enum)
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (2)
19TypeKind typeKind, string defaultPrefix) 23private readonly TypeKind _typeKind = typeKind;
src\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
183if (value.Type.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (2)
90if (typeWithoutNullable.TypeKind == TypeKind.Enum) 122if (type.RemoveNullableIfPresent()?.TypeKind != TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (1)
27if (switchExpressionType?.TypeKind == TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (1)
68if (switchExpressionType?.TypeKind == TypeKind.Enum)
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
177if (namedType.TypeKind is not TypeKind.Class and not TypeKind.Struct and not TypeKind.Module)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol.ContainingType?.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (4)
402return TypeToGenerateIn?.TypeKind is (TypeKind?)TypeKind.Class or (TypeKind?)TypeKind.Struct;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
58baseType.TypeKind == TypeKind.Error) 108if (classType.TypeKind == TypeKind.Struct)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (11)
19protected static readonly ISet<TypeKind> EnumType = new HashSet<TypeKind> { TypeKind.Enum }; 20protected static readonly ISet<TypeKind> ClassInterfaceModuleStructTypes = new HashSet<TypeKind> 22TypeKind.Class, 23TypeKind.Module, 24TypeKind.Struct, 25TypeKind.Interface 31ISet<TypeKind> typeKinds) 42if (typeToGenerateIn.TypeKind == TypeKind.Interface && isStatic)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
24protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, [NotNullWhen(true)] out IMethodSymbol? methodSymbol, [NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn); 25protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, [NotNullWhen(true)] out IMethodSymbol? methodSymbol, [NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (2)
59var classTypes = constraints.Where(ts => ts.TypeKind == TypeKind.Class).ToList(); 60var nonClassTypes = constraints.Where(ts => ts.TypeKind != TypeKind.Class).ToList();
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (2)
76generateMethodBodies: _state.TypeToGenerateIn.TypeKind != TypeKind.Interface)), 92generateMethodBodies: _state.TypeToGenerateIn.TypeKind != TypeKind.Interface)),
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
47state.TypeToGenerateIn.TypeKind != TypeKind.Interface &&
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
193return isAbstract || State.TypeToGenerateIn.TypeKind == TypeKind.Interface || throwStatement == null 225if (State.TypeToGenerateIn.TypeKind != TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (1)
73generateMethodBodies: TypeToGenerateIn.TypeKind != TypeKind.Interface);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (2)
117return _state.TypeToGenerateIn.TypeKind != TypeKind.Interface && _refKind != RefKind.None 124if (state.TypeToGenerateIn.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (3)
97if (state.TypeToGenerateIn.TypeKind == TypeKind.Interface && state.IsStatic) 107var isOnlyReadAndIsInInterface = state.TypeToGenerateIn.TypeKind == TypeKind.Interface && !state.IsWrittenTo; 141if (state.TypeToGenerateIn.TypeKind != TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
86if (this.TypeToGenerateIn.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
226if (state.ClassOrStructType.TypeKind != TypeKind.Class) 249if (idisposable?.TypeKind == TypeKind.Interface)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
271var condition1 = typeParameter.ConstraintTypes.Count(t => t.TypeKind == TypeKind.Class) >= 2;
src\roslyn\src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
40type.TypeKind == TypeKind.Class && type.IsSealed && !type.IsStatic)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (2)
195conversion.Type.TypeKind != TypeKind.Error) 199if (conversion.Operand.Type == null || conversion.Operand.Type.TypeKind != TypeKind.Error)
Microsoft.CodeAnalysis.NetAnalyzers (205)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\AvoidEmptyInterfaces.cs (1)
47if (symbol.TypeKind == TypeKind.Interface &&
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CollectionsShouldImplementGenericInterface.cs (2)
104Debug.Assert(interfacePairs.All(kvp => kvp.Key.TypeKind == TypeKind.Interface && kvp.Value.All(x => x.TypeKind == TypeKind.Interface)));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotDeclareVisibleInstanceFields.cs (1)
66field.ContainingType?.TypeKind == TypeKind.Struct)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotNameEnumValuesReserved.cs (1)
46field.ContainingType.TypeKind != TypeKind.Enum ||
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotOverloadOperatorEqualsOnReferenceTypes.cs (1)
52method.ContainingType.TypeKind != TypeKind.Class)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotPrefixEnumValuesWithTypeName.cs (1)
51if (symbol.TypeKind != TypeKind.Enum || !(enumValues = symbol.GetMembers().Where(m => m.Kind == SymbolKind.Field && !m.IsImplicitlyDeclared)).Any())
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumShouldNotHaveDuplicatedValues.cs (1)
59if (enumSymbol.TypeKind != TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumsShouldHaveZeroValue.cs (1)
105if (symbol.TypeKind != TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumStorageShouldBeInt32.cs (1)
58if (symbol.TypeKind != TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumWithFlagsAttribute.cs (1)
87symbol.TypeKind == TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EquatableAnalyzer.cs (4)
67if ((namedType.TypeKind != TypeKind.Struct && namedType.TypeKind != TypeKind.Class) 68|| (namedType.TypeKind == TypeKind.Struct && namedType.IsRefLikeType)) 98if (overridesObjectEquals && !implementsEquatable && namedType.TypeKind == TypeKind.Struct)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EquatableAnalyzer.Fixer.cs (8)
51if (model.GetDeclaredSymbol(declaration, context.CancellationToken) is not INamedTypeSymbol type || type.TypeKind != TypeKind.Class && type.TypeKind != TypeKind.Struct) 65if (type.TypeKind == TypeKind.Struct && !TypeImplementsEquatable(type, equatableType)) 103type.TypeKind != TypeKind.Class && type.TypeKind != TypeKind.Struct) 116if (type.TypeKind == TypeKind.Struct && !TypeImplementsEquatable(type, equatableType)) 172returnStatement = typeSymbol.TypeKind == TypeKind.Class 178returnStatement = typeSymbol.TypeKind == TypeKind.Class
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\Helpers\EnumHelpers.cs (1)
64Debug.Assert(enumType.TypeKind == TypeKind.Enum);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldHaveCorrectPrefix.cs (1)
100if (symbol.TypeKind == TypeKind.Interface &&
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldHaveCorrectSuffix.cs (2)
123if (wellKnownNamedType.OriginalDefinition.TypeKind == TypeKind.Interface) 193eventSymbol.Type.TypeKind == TypeKind.Delegate &&
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotContainUnderscores.cs (2)
155if (namedType.TypeKind == TypeKind.Delegate && 258if (containingType.TypeKind == TypeKind.Delegate)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotHaveIncorrectSuffix.cs (1)
206if (namedTypeSymbol.TypeKind == TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ImplementIDisposableCorrectly.cs (2)
188if (type.TypeKind == TypeKind.Class && 249if (type != null && type.TypeKind == TypeKind.Class &&
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\InterfaceMethodsShouldBeCallableByChildTypes.cs (1)
103method.ContainingType.TypeKind != TypeKind.Class ||
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\NestedTypesShouldNotBeVisible.cs (3)
75if (nestedType.TypeKind == TypeKind.Delegate) 110if (nestedType.TypeKind == TypeKind.Enum) 128DiagnosticDescriptor descriptor = containingType.TypeKind == TypeKind.Module
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorOverloadsHaveNamedAlternates.cs (2)
251if (typeSymbol.TypeKind != TypeKind.Array) 261while (elementType.TypeKind == TypeKind.Array);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorOverloadsHaveNamedAlternates.Fixer.cs (2)
66typeSymbol.TypeKind == TypeKind.Struct ? DeclarationKind.Struct : DeclarationKind.Class) is not SyntaxNode typeDeclaration) 92if (expectedSignature.Name == "CompareTo" && operatorOverloadSymbol.ContainingType.TypeKind == TypeKind.Class)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverloadOperatorEqualsOnOverridingValueTypeEquals.cs (1)
43!(namedTypeSymbol.IsRefLikeType && namedTypeSymbol.TypeKind == TypeKind.Struct) &&
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideEqualsAndOperatorEqualsOnValueTypes.cs (2)
73namedType.TypeKind == TypeKind.Enum || 74(namedType.TypeKind == TypeKind.Struct && namedType.IsRefLikeType) ||
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideEqualsOnOverloadingOperatorEquals.Fixer.cs (2)
36typeSymbol.TypeKind is not TypeKind.Class and not TypeKind.Struct)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideMethodsOnComparableTypes.cs (2)
92if (namedTypeSymbol.TypeKind == TypeKind.Interface || 93namedTypeSymbol.TypeKind == TypeKind.Enum ||
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideMethodsOnComparableTypes.Fixer.cs (4)
46return model.GetDeclaredSymbol(declaration, cancellationToken) is INamedTypeSymbol { TypeKind: TypeKind.Class or TypeKind.Struct } typeSymbol 61if (model.GetDeclaredSymbol(declaration, cancellationToken) is not INamedTypeSymbol { TypeKind: TypeKind.Class or TypeKind.Struct } typeSymbol)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ParameterNamesShouldMatchBaseDeclaration.cs (1)
79if (originalDefinition.ContainingType.TypeKind != TypeKind.Interface)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\PropertiesShouldNotReturnArrays.cs (1)
45if (symbol.Type.TypeKind == TypeKind.Array && !symbol.IsOverride)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UseGenericEventHandlerInstances.cs (1)
84namedType.TypeKind == TypeKind.Delegate && namedType.DelegateInvokeMethod != null;
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UseIntegralOrStringArgumentForIndexers.cs (2)
89if (paramType.TypeKind == TypeKind.TypeParameter) 94if (paramType.TypeKind == TypeKind.Enum)
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUninstantiatedInternalClasses.cs (7)
181=> coClassAttributeSymbol != null && type.TypeKind == TypeKind.Interface; 192typeSymbol.TypeKind == TypeKind.Class) 201=> designerAttributeSymbol != null && (type.TypeKind == TypeKind.Interface || type.TypeKind == TypeKind.Class); 234=> debuggerTypeProxyAttributeSymbol != null && (type.TypeKind == TypeKind.Struct || type.TypeKind == TypeKind.Class); 305if (type.TypeKind != TypeKind.Class || type.IsAbstract || type.IsStatic)
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUnusedPrivateFields.cs (1)
69SpecialType specialType = argument.Type.TypeKind == TypeKind.Enum ?
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotInitializeUnnecessarily.cs (3)
57if (field.ContainingType?.TypeKind == TypeKind.Struct && !field.IsStatic) 80if (prop.ContainingType?.TypeKind == TypeKind.Struct && !prop.IsStatic) 128(type.IsPrimitiveType() || type.TypeKind == TypeKind.Enum) &&
Microsoft.CodeQuality.Analyzers\QualityGuidelines\PreferJaggedArraysOverMultidimensional.cs (1)
148while (type.TypeKind == TypeKind.Array)
Microsoft.CodeQuality.Analyzers\QualityGuidelines\SealMethodsThatSatisfyPrivateInterfaces.cs (2)
48if (type.TypeKind != TypeKind.Class || 96&& member.ContainingType.TypeKind == TypeKind.Class;
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.AutoLayoutTypeCache.cs (1)
63SpecialType specialType = argument.Type.TypeKind == TypeKind.Enum ?
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.DelegateInteropUsageAnalyzer.cs (8)
59if (operation.Arguments.Length == 2 && operation.Arguments.GetArgumentForParameterAtIndex(1) is { Value: ITypeOfOperation { TypeOperand: INamedTypeSymbol { TypeKind: TypeKind.Delegate } delegateType } } arg) 66if (operation.TargetMethod.TypeArguments.Length == 1 && operation.TargetMethod.TypeArguments[0] is INamedTypeSymbol { TypeKind: TypeKind.Delegate } delegateType) 75if (conversion.Operand.Type is INamedTypeSymbol { TypeKind: TypeKind.Delegate } delegateType) 85if (argumentValue.Type is INamedTypeSymbol { TypeKind: TypeKind.Delegate } delegateType) 119if (param.Type.TypeKind == TypeKind.Delegate) 123else if (param.Type is IArrayTypeSymbol { ElementType.TypeKind: TypeKind.Delegate }) 129if (symbol.ReturnType.TypeKind == TypeKind.Delegate) 133else if (symbol.ReturnType is IArrayTypeSymbol { ElementType.TypeKind: TypeKind.Delegate })
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.DisabledRuntimeMarshallingAssemblyAnalyzer.cs (1)
121if (type.TypeKind != TypeKind.Delegate || !type.HasAnyAttribute(_unmanagedFunctionPointerAttribute))
Microsoft.NetCore.Analyzers\InteropServices\DynamicInterfaceCastableImplementation.cs (1)
85if (targetType.TypeKind != TypeKind.Interface)
Microsoft.NetCore.Analyzers\InteropServices\ProvidePublicParameterlessSafeHandleConstructor.cs (1)
52if (type.TypeKind != TypeKind.Class)
Microsoft.NetCore.Analyzers\Performance\ConstantExpectedAnalyzer.cs (3)
276SpecialType.None when type.TypeKind == TypeKind.TypeParameter => true, 378case SpecialType.None when parameterSymbol.Type.TypeKind == TypeKind.TypeParameter: 418if (parameterSymbol?.Type.TypeKind is TypeKind.Enum)
Microsoft.NetCore.Analyzers\Performance\PreferReadOnlySpanOverSpan.cs (1)
65methodSymbol.ContainingType.TypeKind is TypeKind.Interface ||
Microsoft.NetCore.Analyzers\Performance\UseAsSpanInsteadOfRangeIndexer.cs (1)
188else if (containingType.TypeKind == TypeKind.Array)
Microsoft.NetCore.Analyzers\Performance\UseConcreteTypeAnalyzer.cs (6)
132if (namedType.TypeKind == TypeKind.Interface) 278if (!t.IsAbstract && fromType.TypeKind is TypeKind.Interface) 307if (targets != null && fromType.TypeKind != TypeKind.Interface) 335if (toType.TypeKind is not TypeKind.Class and not TypeKind.Array and not TypeKind.Struct)
Microsoft.NetCore.Analyzers\Performance\UseCountProperly.cs (1)
672if (type.TypeKind == TypeKind.Interface)
Microsoft.NetCore.Analyzers\Runtime\AttributeStringLiteralsShouldParseCorrectly.cs (1)
97if (namedType.TypeKind == TypeKind.Delegate && namedType.DelegateInvokeMethod != null)
Microsoft.NetCore.Analyzers\Runtime\AvoidZeroLengthArrayAllocations.cs (1)
117if (elementType.TypeKind != TypeKind.Pointer)
Microsoft.NetCore.Analyzers\Runtime\DetectPreviewFeatureAnalyzer.cs (1)
521return symbol.IsStatic && symbol.IsAbstract && symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Interface && !SymbolIsAnnotatedAsPreview(symbol, requiresPreviewFeaturesSymbols, previewFeatureAttributeSymbol);
Microsoft.NetCore.Analyzers\Runtime\DisposeObjectsBeforeLosingScope.cs (1)
188type.TypeKind == TypeKind.Delegate;
Microsoft.NetCore.Analyzers\Runtime\DoNotCallEnumerableCastOrOfTypeWithIncompatibleTypesAnalyzer.cs (44)
194if (castFrom.TypeKind == TypeKind.Error 195|| castTo.TypeKind == TypeKind.Error) 246if (t.TypeKind == TypeKind.Class) 257case (TypeKind.Dynamic, _): 258case (_, TypeKind.Dynamic): 261case (TypeKind.TypeParameter, _): 274if (castTo.TypeKind == TypeKind.TypeParameter) 280case (_, TypeKind.TypeParameter): 283case (TypeKind.Class, TypeKind.Class): 287case (TypeKind.Interface, TypeKind.Class): 289case (TypeKind.Class, TypeKind.Interface): 292case (TypeKind.Interface, TypeKind.Struct): 294case (TypeKind.Struct, TypeKind.Interface): 297case (TypeKind.Class, TypeKind.Enum): 300case (TypeKind.Enum, TypeKind.Class): 304case (TypeKind.Struct, TypeKind.Enum) 307case (TypeKind.Enum, TypeKind.Struct) 311case (TypeKind.Enum, TypeKind.Enum) 321case (TypeKind.Array, TypeKind.Array) 327case (TypeKind.Array, TypeKind.Class): 329case (TypeKind.Class, TypeKind.Array): 332case (TypeKind.Class, TypeKind.Struct): 334case (TypeKind.Struct, TypeKind.Class): 337case (_, TypeKind.Enum): 338case (TypeKind.Enum, _): 339case (_, TypeKind.Struct): 340case (TypeKind.Struct, _): 343case (TypeKind.Interface, TypeKind.Interface):
Microsoft.NetCore.Analyzers\Runtime\DoNotLockOnObjectsWithWeakIdentity.cs (3)
98case TypeKind.Array: 100case TypeKind.Class: 101case TypeKind.TypeParameter:
Microsoft.NetCore.Analyzers\Runtime\DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.cs (1)
98if (targetType.TypeKind == TypeKind.Interface && targetType.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IReadOnlyList_T)
Microsoft.NetCore.Analyzers\Runtime\PreferTypedStringBuilderAppendOverloads.cs (2)
59s.Parameters[0].Type.TypeKind != TypeKind.Array); 67s.Parameters[1].Type.TypeKind != TypeKind.Array);
Microsoft.NetCore.Analyzers\Runtime\SealInternalTypes.cs (1)
54if (type.TypeKind is TypeKind.Class &&
Microsoft.NetCore.Analyzers\Runtime\SerializationRulesDiagnosticAnalyzer.cs (9)
105if (namedTypeSymbol.TypeKind is TypeKind.Delegate or TypeKind.Interface) 189TypeKind.Array => IsSerializable(((IArrayTypeSymbol)type).ElementType), 190TypeKind.Enum => IsSerializable(((INamedTypeSymbol)type).EnumUnderlyingType!), 191TypeKind.TypeParameter or TypeKind.Interface => true,// The concrete type can't be determined statically, 193TypeKind.Class or TypeKind.Struct => ((INamedTypeSymbol)type).IsSerializable,// Check SerializableAttribute or Serializable flag from metadata. 194TypeKind.Delegate => true,// delegates are always serializable, even if
Microsoft.NetCore.Analyzers\Runtime\UseExceptionThrowHelpers.cs (1)
270p.Type?.TypeKind == TypeKind.Enum;
Microsoft.NetCore.Analyzers\Security\DataSetDataTableInWebSerializableObjectGraphAnalyzer.cs (2)
82if (namedTypeSymbol.TypeKind is not TypeKind.Interface 83and not TypeKind.Class)
Microsoft.NetCore.Analyzers\Security\DoNotCallDangerousMethodsInDeserialization.cs (4)
134fieldSymbol.Type.TypeKind == TypeKind.Delegate)) 161if (possibleDelegateSymbol.TypeKind != TypeKind.Delegate) 182calledSymbol.ContainingType.TypeKind == TypeKind.Interface || 185possibleDelegateSymbol.TypeKind == TypeKind.Delegate)
Microsoft.NetCore.Analyzers\Security\DoNotSerializeTypeWithPointerFields.cs (2)
88if (pointerTypeSymbol.PointedAtType.TypeKind is TypeKind.Struct or 89TypeKind.Pointer)
Microsoft.NetCore.Analyzers\Security\UseAutoValidateAntiforgeryToken.cs (1)
149if (fieldSymbol.Type.TypeKind == TypeKind.Delegate)
Microsoft.NetCore.Analyzers\Tasks\DoNotConfigureAwaitWithSuppressThrowing.cs (1)
44configureAwaitOptionsType.TypeKind != TypeKind.Enum ||
Microsoft.NetCore.Analyzers\Usage\ProvideCorrectArgumentToEnumHasFlag.cs (2)
54invocation.Instance.Type.TypeKind != TypeKind.TypeParameter && 55conversion.Operand.Type?.TypeKind != TypeKind.TypeParameter &&
Microsoft.NetFramework.Analyzers\MarkVerbHandlersWithValidateAntiforgeryTokenAnalyzer.MvcAttributeSymbols.cs (2)
94&& parameterType.TypeKind == TypeKind.Array) 113else if (parameterType.TypeKind == TypeKind.Enum
src\afc74d572e54ec72\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (1)
34Debug.Assert(CollectionNamedTypes.All(ct => ct.TypeKind == TypeKind.Interface));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamedTypeMetricData.cs (5)
133case TypeKind.Class: 134case TypeKind.Interface: 145case TypeKind.Struct: 146case TypeKind.Enum: 147case TypeKind.Delegate:
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
676=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\INamedTypeSymbolExtensions.cs (1)
139if (symbol.TypeKind != TypeKind.Class)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
99if (operation.Type.TypeKind == TypeKind.Enum)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ISymbolExtensions.cs (3)
93typeSymbol.TypeKind == TypeKind.Error; 401if (type1.TypeKind == TypeKind.TypeParameter && 402type2.TypeKind == TypeKind.TypeParameter &&
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (8)
16public const TypeKind ExtensionTypeKind = (TypeKind)14; 54case TypeKind.Class: 55if (type.TypeKind == TypeKind.Interface) 62case TypeKind.Interface: 98if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 113if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter) 347if (invocationTarget.TypeKind == TypeKind.Interface)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
409namedType.TypeKind != TypeKind.Interface ||
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataSymbolMap.cs (1)
122if (namedTypeSymbol.TypeKind == TypeKind.Interface
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (4)
1346static bool IsInterfaceOrTypeParameter(ITypeSymbol? type) => type?.TypeKind is TypeKind.Interface or TypeKind.TypeParameter; 2401if (argument.Parameter?.Type.TypeKind == TypeKind.Delegate || 2408if (argument.Parameter.Type.TypeKind == TypeKind.Delegate)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Workspaces\SyntaxGeneratorExtensions.cs (6)
41if (containingType.TypeKind == TypeKind.Class) 142if (containingType.TypeKind == TypeKind.Class) 194if (containingType.TypeKind == TypeKind.Class) 241if (containingType.TypeKind == TypeKind.Class) 289if (containingType.TypeKind == TypeKind.Class) 355if (containingType.TypeKind == TypeKind.Class)
Microsoft.CodeAnalysis.Razor.Compiler (18)
CSharp\CompilationExtensions.cs (3)
27if (type is null || type.TypeKind == TypeKind.Error) 45byteType.TypeKind == TypeKind.Error) 77if (stringType.TypeKind == TypeKind.Error ||
CSharp\CompilationTagHelperFeature.cs (1)
44return @string != null && @string.TypeKind != TypeKind.Error;
CSharp\DefaultTagHelperDescriptorFactory.cs (1)
227if (property.Type.TypeKind == TypeKind.Enum)
CSharp\Utf8SupportMap.cs (2)
78if (type is not null && type.TypeKind != TypeKind.Error) 172if (symbol is not null && symbol.TypeKind != TypeKind.Error)
Language\Extensions\INamedTypeSymbolExtensions.cs (1)
11=> symbol.TypeKind != TypeKind.Error &&
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (3)
479Parameters: [{ Type.TypeKind: TypeKind.Delegate }] 813return property.Type.TypeKind == TypeKind.Enum; 832return property.Type.TypeKind == TypeKind.Delegate;
Language\TagHelpers\Producers\DefaultTagHelperProducer.Factory.cs (1)
21iTagHelperType.TypeKind == TypeKind.Error)
Mvc.Version1_X\ViewComponentTagHelperDescriptorFactory.cs (1)
196if (parameter.Type.TypeKind == TypeKind.Enum)
Mvc.Version1_X\ViewComponentTagHelperProducer.Factory.cs (1)
22viewComponentAttributeType.TypeKind == TypeKind.Error)
Mvc.Version2_X\ViewComponentTagHelperDescriptorFactory.cs (1)
211if (parameter.Type.TypeKind == TypeKind.Enum)
Mvc.Version2_X\ViewComponentTagHelperProducer.Factory.cs (1)
22viewComponentAttributeType.TypeKind == TypeKind.Error)
Mvc\ViewComponentTagHelperDescriptorFactory.cs (1)
214if (parameter.Type.TypeKind == TypeKind.Enum)
Mvc\ViewComponentTagHelperProducer.Factory.cs (1)
22viewComponentAttributeType.TypeKind == TypeKind.Error)
Microsoft.CodeAnalysis.ResxSourceGenerator (99)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamedTypeMetricData.cs (5)
134case TypeKind.Class: 135case TypeKind.Interface: 146case TypeKind.Struct: 147case TypeKind.Enum: 148case TypeKind.Delegate:
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
520=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
113if (type1.TypeKind == TypeKind.TypeParameter && 114type2.TypeKind == TypeKind.TypeParameter &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (5)
48case TypeKind.Class: 49if (type.TypeKind == TypeKind.Interface) 56case TypeKind.Interface: 71if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 86if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
412namedType.TypeKind != TypeKind.Interface ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (4)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\BasicOverrideEqualsOnOverloadingOperatorEquals.vb (1)
43If type.TypeKind = TypeKind.Interface OrElse type.IsImplicitClass OrElse type.SpecialType = SpecialType.System_Object Then
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\BasicOverrideGetHashCodeOnOverridingEquals.vb (1)
44If type.TypeKind = TypeKind.Interface OrElse type.IsImplicitClass OrElse type.SpecialType = SpecialType.System_Object Then
Microsoft.NetCore.Analyzers\Runtime\BasicForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.vb (2)
57If symbol.ContainingType.TypeKind = TypeKind.Submission Then 64If symbol.TypeKind <> TypeKind.[Error] Then
Microsoft.CodeAnalysis.Workspaces (157)
Classification\ClassificationExtensions.cs (11)
12TypeKind.Class => type.IsRecord ? ClassificationTypeNames.RecordClassName : ClassificationTypeNames.ClassName, 13TypeKind.Module => ClassificationTypeNames.ModuleName, 14TypeKind.Struct => type.IsRecord ? ClassificationTypeNames.RecordStructName : ClassificationTypeNames.StructName, 15TypeKind.Interface => ClassificationTypeNames.InterfaceName, 16TypeKind.Enum => ClassificationTypeNames.EnumName, 17TypeKind.Delegate => ClassificationTypeNames.DelegateName, 18TypeKind.TypeParameter => ClassificationTypeNames.TypeParameterName, 19TypeKind.Dynamic => ClassificationTypeNames.Keyword, 20TypeKind.Array => ClassificationTypeNames.ArrayName, 21TypeKind.Pointer => ClassificationTypeNames.PointerName, 22TypeKind.FunctionPointer => ClassificationTypeNames.FunctionPointerName,
Editing\SymbolEditorExtensions.cs (1)
30if (baseOrInterfaceType.TypeKind != TypeKind.Error)
Editing\SyntaxGenerator.cs (12)
769TypeKind.Class => ClassDeclaration( 778TypeKind.Struct => StructDeclaration( 786TypeKind.Interface => InterfaceDeclaration( 792TypeKind.Enum => EnumDeclaration( 799TypeKind.Delegate => type.GetMembers(WellKnownMemberNames.DelegateInvokeName) is [IMethodSymbol invoke, ..] 808TypeKind.Extension when type.ExtensionParameter is { } extensionParameter => ExtensionBlockDeclaration( 897case TypeKind.Class: 898case TypeKind.Struct: 899case TypeKind.Interface: 900case TypeKind.Enum: 901case TypeKind.Delegate: 903case TypeKind.Extension:
FindSymbols\FindReferences\DependentTypeFinder_ImplementingTypes.cs (5)
22if (type?.TypeKind == TypeKind.Interface) 54t => t.TypeKind is TypeKind.Class or 55TypeKind.Struct or 56TypeKind.Delegate or 57TypeKind.Enum);
FindSymbols\FindReferences\DependentTypeFinder.cs (2)
46private static readonly Func<INamedTypeSymbol, bool> s_isInterface = static t => t is { TypeKind: TypeKind.Interface }; 47private static readonly Func<INamedTypeSymbol, bool> s_isNonSealedClass = static t => t is { TypeKind: TypeKind.Class, IsSealed: false };
FindSymbols\FindReferences\Finders\NamedTypeSymbolReferenceFinder.cs (1)
21=> symbol.TypeKind != TypeKind.Error;
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (1)
38if (symbol.ContainingType.TypeKind == TypeKind.Delegate)
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (1)
121if (searchSymbol.IsConstructor() && searchSymbol.ContainingType.TypeKind == TypeKind.Delegate)
FindSymbols\SymbolFinder_Hierarchy.cs (2)
129if (symbol is { DeclaredAccessibility: Accessibility.Public, ContainingType.TypeKind: TypeKind.Class or TypeKind.Struct })
Recommendations\AbstractRecommendationServiceRunner.cs (3)
458if (originalConstraintType.TypeKind == TypeKind.TypeParameter) 465else if (originalConstraintType.TypeKind == TypeKind.Interface) 490else if (originalConstraintType.TypeKind == TypeKind.Class)
Rename\RenameUtilities.cs (6)
52typeSymbol.TypeKind is TypeKind.Array or TypeKind.Pointer or TypeKind.FunctionPointer or TypeKind.Dynamic; 264symbol.ContainingType.TypeKind == TypeKind.Interface) 391if (symbol is INamedTypeSymbol { IsImplicitlyDeclared: true, TypeKind: TypeKind.Delegate, AssociatedSymbol: not null } typeSymbol)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
108((INamedTypeSymbol)referencedSymbol.ContainingSymbol).TypeKind == TypeKind.Interface &&
Shared\Extensions\IMethodSymbolExtensions.cs (1)
17Contract.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\ISymbolExtensions.cs (2)
489if (typeSymbol.TypeKind == TypeKind.Class) 495else if (typeSymbol.TypeKind == TypeKind.Interface)
Shared\Extensions\ITypeSymbolExtensions.cs (2)
159typeSymbol.TypeKind == TypeKind.Interface) 192if (type.TypeKind == TypeKind.Interface &&
Shared\Extensions\SemanticModelExtensions.cs (1)
144if (namedType.TypeKind == TypeKind.Delegate ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
37if (typeSymbol.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
152if (namedType.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
418TypeKind typeKind, string name, 437bool isRecord, TypeKind typeKind, string name, 488typeKind: TypeKind.Delegate,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
43public override TypeKind TypeKind => TypeKind.Array;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
93public override TypeKind TypeKind => _constructedFrom.TypeKind;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
29TypeKind typeKind, 63public override TypeKind TypeKind { get; } 95return this.TypeKind == TypeKind.Delegate
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
19public override TypeKind TypeKind => TypeKind.Pointer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
60public override TypeKind TypeKind => TypeKind.TypeParameter;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (3)
27public abstract TypeKind TypeKind { get; } 39public bool IsValueType => TypeKind is TypeKind.Struct or TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
518if (containingType?.TypeKind == TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
124member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented)
Microsoft.Diagnostics.DataContractReader.DataGenerator (1)
Parser.cs (1)
464if (type.TypeKind == TypeKind.Enum &&
Microsoft.DotNet.ApiCompatibility (11)
Mapping\AssemblyMapper.cs (1)
110if (symbol.TypeKind != TypeKind.Error)
Rules\CannotAddAbstractMember.cs (1)
34if (leftContainingType.TypeKind != TypeKind.Interface && !leftContainingType.IsEffectivelySealed(_settings.IncludeInternalSymbols))
Rules\CannotAddMemberToInterface.cs (1)
25if (left == null && right != null && right.ContainingType.TypeKind == TypeKind.Interface)
Rules\CannotAddOrRemoveVirtualKeyword.cs (2)
33if (leftContainingType.TypeKind == TypeKind.Interface || rightContainingType.TypeKind == TypeKind.Interface)
Rules\CannotRemoveBaseTypeOrInterface.cs (3)
28if (left.TypeKind != TypeKind.Interface && right.TypeKind != TypeKind.Interface) 81if (!leftInterface.IsVisibleOutsideOfAssembly(_settings.IncludeInternalSymbols) && leftInterface.TypeKind != TypeKind.Error)
Rules\CannotSealType.cs (2)
25if (left == null || right == null || left.TypeKind == TypeKind.Interface || right.TypeKind == TypeKind.Interface)
Rules\EnumsMustMatch.cs (1)
87private static bool IsEnum(ITypeSymbol? sym) => sym is not null && sym.TypeKind == TypeKind.Enum;
Microsoft.DotNet.ApiSymbolExtensions (1)
SymbolExtensions.cs (1)
42if (type.TypeKind == TypeKind.Interface)
Microsoft.Extensions.Configuration.Binder.SourceGeneration (9)
ConfigurationBindingGenerator.Parser.cs (8)
70type.TypeKind is TypeKind.TypeParameter or TypeKind.Pointer or TypeKind.Error || 196else if (type.TypeKind is TypeKind.Array) 663if (!(typeSymbol.IsAbstract || typeSymbol.TypeKind is TypeKind.Interface)) 931if (type.TypeKind is TypeKind.Error) 971if (typeArg.TypeKind is TypeKind.TypeParameter or TypeKind.Error ||
src\runtime\src\libraries\Common\src\SourceGenerators\TypeRef.cs (1)
33public TypeKind TypeKind { get; }
Microsoft.Extensions.Options.SourceGeneration (1)
Parser.cs (1)
328if (ta.TypeKind == TypeKind.TypeParameter)
Microsoft.Extensions.Validation.ValidationsGenerator (3)
src\aspnetcore\src\Shared\RoslynUtils\ParsabilityHelper.cs (1)
26if (typeSymbol.TypeKind == TypeKind.Enum)
src\aspnetcore\src\Shared\RoslynUtils\SymbolExtensions.cs (2)
311return typeSymbol.TypeKind == TypeKind.Enum; 321if (underlyingType?.TypeKind == TypeKind.Enum)
Microsoft.Gen.ContextualOptions (2)
Parser.cs (2)
82.Where(prop => prop.Type.TypeKind != TypeKind.Pointer) 83.Where(prop => prop.Type.TypeKind != TypeKind.FunctionPointer)
Microsoft.Gen.Logging (7)
Parsing\Parser.LogProperties.cs (5)
19private static readonly HashSet<TypeKind> _allowedTypeKinds = [TypeKind.Class, TypeKind.Struct, TypeKind.Interface]; 307|| (property.Type.TypeKind == TypeKind.Delegate)
Parsing\Parser.Records.cs (1)
120if (memberType.TypeKind == TypeKind.Delegate)
Parsing\Parser.TagProvider.cs (1)
161if (target.TypeKind == TypeKind.Interface)
Microsoft.Gen.Logging.Unit.Tests (1)
LogParserUtilitiesTests.cs (1)
155paramTypeMock.SetupGet(x => x.TypeKind).Returns(TypeKind.Class);
Microsoft.Gen.MetadataExtractor (6)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
579returnType.TypeKind != TypeKind.Error) 638if (strongTypeSymbol.TypeKind == TypeKind.Class) 698TypeKind kind; 739if (kind == TypeKind.Enum) 769if (kind == TypeKind.Class) 827if (kind == TypeKind.Struct && specialType == SpecialType.None)
Microsoft.Gen.Metrics (6)
Parser.cs (6)
579returnType.TypeKind != TypeKind.Error) 638if (strongTypeSymbol.TypeKind == TypeKind.Class) 698TypeKind kind; 739if (kind == TypeKind.Enum) 769if (kind == TypeKind.Class) 827if (kind == TypeKind.Struct && specialType == SpecialType.None)
Microsoft.Gen.MetricsReports (6)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
579returnType.TypeKind != TypeKind.Error) 638if (strongTypeSymbol.TypeKind == TypeKind.Class) 698TypeKind kind; 739if (kind == TypeKind.Enum) 769if (kind == TypeKind.Class) 827if (kind == TypeKind.Struct && specialType == SpecialType.None)
Microsoft.Interop.ComInterfaceGenerator (9)
Analyzers\AddGeneratedComClassAnalyzer.cs (1)
42if (type.TypeKind != TypeKind.Class)
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (1)
47if (context.Symbol is not INamedTypeSymbol { TypeKind: TypeKind.Class } classToAnalyze)
Analyzers\ComInterfaceGeneratorDiagnosticsAnalyzer.cs (1)
90if (typeSymbol.TypeKind != TypeKind.Interface)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (3)
52if (type is not { TypeKind: TypeKind.Interface, IsComImport: true } 226public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type is { TypeKind: TypeKind.Array or TypeKind.Delegate } or { SpecialType: SpecialType.System_Array or SpecialType.System_Object };
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (1)
32if (typeSymbol.TypeKind != TypeKind.Interface)
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
269if (methodSymbol.ReturnType is { TypeKind: TypeKind.Struct }
VtableIndexStubGenerator.cs (1)
215if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
Microsoft.Interop.JavaScript.JSImportGenerator (2)
JSExportGenerator.cs (1)
72if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
JSImportGenerator.cs (1)
64if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (1)
325if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
LibraryImportGenerator.cs (1)
171if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
269if (methodSymbol.ReturnType is { TypeKind: TypeKind.Struct }
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (1)
326if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
DownlevelLibraryImportGenerator.cs (1)
158if (attrData.AttributeClass?.TypeKind is null or TypeKind.Error)
Microsoft.Interop.SourceGeneration (21)
BlittableTypeMarshallingInfoProvider.cs (3)
27if (type.TypeKind is TypeKind.Enum or TypeKind.Pointer or TypeKind.FunctionPointer
CustomMarshallingInfoHelper.cs (4)
29if (!(entryPointType.IsStatic && entryPointType.TypeKind == TypeKind.Class) 30&& entryPointType.TypeKind != TypeKind.Struct) 146if (!(entryPointType.IsStatic && entryPointType.TypeKind == TypeKind.Class) 147&& entryPointType.TypeKind != TypeKind.Struct)
ManagedTypeInfo.cs (6)
39if (type.TypeKind == TypeKind.Enum) 43if (type.TypeKind == TypeKind.Pointer) 47if (type.TypeKind == TypeKind.FunctionPointer) 51if (type.TypeKind == TypeKind.Array && type is IArrayTypeSymbol { IsSZArray: true } arraySymbol) 55if (type.TypeKind == TypeKind.Delegate) 59if (type.TypeKind == TypeKind.TypeParameter)
ManualTypeMarshallingHelper.cs (5)
438while (innerType.TypeKind is TypeKind.Array or TypeKind.Pointer) 462if (wrapperType.TypeKind == TypeKind.Pointer) 466else if (wrapperType.TypeKind == TypeKind.Array) 487if (marshallerType is { IsStatic: true, TypeKind: TypeKind.Class })
TypeSymbolExtensions.cs (3)
102if (type.TypeKind == TypeKind.TypeParameter && !type.IsReferenceType) 108if (type.TypeKind is TypeKind.Pointer or TypeKind.FunctionPointer)
Microsoft.ML.InternalCodeAnalyzer (1)
BaseTestClassAnalyzer.cs (1)
68if (namedType.TypeKind != TypeKind.Class)
Roslyn.Diagnostics.Analyzers (145)
AbstractCreateTestAccessor`1.cs (2)
56=> typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct;
AbstractExposeMemberForTesting`1.cs (2)
92=> typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct;
DefaultableTypeShouldHaveDefaultableFieldsAnalyzer.cs (14)
82if (containingType.TypeKind != TypeKind.Struct) 114case TypeKind.Class: 115case TypeKind.Interface: 116case TypeKind.Delegate: 119case TypeKind.Enum: 122case TypeKind.Struct: 132case TypeKind.TypeParameter: 139case TypeKind.Unknown: 140case TypeKind.Array: 141case TypeKind.Dynamic: 142case TypeKind.Error: 143case TypeKind.Module: 144case TypeKind.Pointer: 145case TypeKind.Submission:
ImmutableArrayBoxingAnalyzer.cs (1)
83if (conversionOperation.Type?.TypeKind != TypeKind.Interface)
IRemoteJsonServiceParameterAnalyzer.cs (1)
64if (namedTypeSymbol.TypeKind != TypeKind.Interface ||
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamedTypeMetricData.cs (5)
134case TypeKind.Class: 135case TypeKind.Interface: 146case TypeKind.Struct: 147case TypeKind.Enum: 148case TypeKind.Delegate:
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (1)
520=> methodSymbol.Parameters.Any(p => p.Type.TypeKind == TypeKind.Delegate);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
113if (type1.TypeKind == TypeKind.TypeParameter && 114type2.TypeKind == TypeKind.TypeParameter &&
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (5)
48case TypeKind.Class: 49if (type.TypeKind == TypeKind.Interface) 56case TypeKind.Interface: 71if (!baseTypesOnly && candidateBaseType.TypeKind == TypeKind.Interface) 86if (checkTypeParameterConstraints && symbol.TypeKind == TypeKind.TypeParameter)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (1)
412namedType.TypeKind != TypeKind.Interface ||
src\roslyn\src\RoslynAnalyzers\Utilities\Workspaces\SyntaxGeneratorExtensions.cs (6)
42if (containingType.TypeKind == TypeKind.Class) 143if (containingType.TypeKind == TypeKind.Class) 195if (containingType.TypeKind == TypeKind.Class) 242if (containingType.TypeKind == TypeKind.Class) 290if (containingType.TypeKind == TypeKind.Class) 355if (containingType.TypeKind == TypeKind.Class)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CollectionExpressionUtilities.cs (1)
112if (!(namedType.TypeKind == TypeKind.Struct && noArgConstructor.IsImplicitlyDeclared))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
147if (type.TypeKind == TypeKind.Array && typeArguments.IsEmpty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
410symbol.GetSymbolType()?.TypeKind != TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_SymbolSpec.cs (13)
73private static readonly SymbolKindOrTypeKind s_class = new(TypeKind.Class); 74private static readonly SymbolKindOrTypeKind s_struct = new(TypeKind.Struct); 75private static readonly SymbolKindOrTypeKind s_interface = new(TypeKind.Interface); 76private static readonly SymbolKindOrTypeKind s_enum = new(TypeKind.Enum); 82private static readonly SymbolKindOrTypeKind s_delegate = new(TypeKind.Delegate); 298case TypeKind.Class: 301case TypeKind.Struct: 304case TypeKind.Interface: 307case TypeKind.Enum: 310case TypeKind.Delegate: 313case TypeKind.Module: 316case TypeKind.Pointer: 319case TypeKind.TypeParameter:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
66if (containingType.TypeKind is not TypeKind.Class and not TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (20)
62new SymbolKindOrTypeKind(TypeKind.Class), 63new SymbolKindOrTypeKind(TypeKind.Struct), 64new SymbolKindOrTypeKind(TypeKind.Interface), 65new SymbolKindOrTypeKind(TypeKind.Delegate), 66new SymbolKindOrTypeKind(TypeKind.Enum), 67new SymbolKindOrTypeKind(TypeKind.Module), 68new SymbolKindOrTypeKind(TypeKind.Pointer), 75new SymbolKindOrTypeKind(TypeKind.TypeParameter), 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 344public SymbolKindOrTypeKind(TypeKind typeKind) 355public TypeKind? TypeKind => (_category == SymbolCategory.Type) ? (TypeKind)_kind : null; 362SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind, 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 376private static string GetTypeKindString(TypeKind typeKind) 383CodeAnalysis.TypeKind.Structure => nameof(CodeAnalysis.TypeKind.Struct), 433=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441public static implicit operator SymbolKindOrTypeKind(TypeKind symbolKind)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
407if (namedTypeSymbol.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
22var isError = symbol.TupleUnderlyingType!.TypeKind == TypeKind.Error;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (10)
101if (member.ContainingType.TypeKind == TypeKind.Interface) 172if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 210if (type.TypeKind == TypeKind.Interface) 313if (type.TypeKind == TypeKind.Interface) 351if (classOrStructType.TypeKind is not TypeKind.Class and not TypeKind.Struct) 361if (!interfacesOrAbstractClasses.All(i => i.TypeKind == TypeKind.Interface) && 378return interfacesOrAbstractClasses.First().TypeKind == TypeKind.Interface 555TypeKind: TypeKind.Class or TypeKind.Struct
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (1)
196typeArg.TypeKind != TypeKind.Error &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (9)
181return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 187if (symbol is { ContainingType.TypeKind: TypeKind.Interface }) 226=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 229=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 232=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 271=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum }; 284=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 308=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 740if (!methods.Any(x => x is { Name: WellKnownMemberNames.OnCompleted, ReturnsVoid: true, Parameters: [{ Type.TypeKind: TypeKind.Delegate }] }))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (12)
46return type is INamedTypeSymbol { TypeKind: TypeKind.Interface } namedType && !allInterfaces.Contains(namedType) 52=> symbol?.TypeKind == TypeKind.Class && symbol.IsAbstract; 78=> symbol?.TypeKind == TypeKind.Module; 81=> symbol?.TypeKind == TypeKind.Interface; 84=> symbol?.TypeKind == TypeKind.Delegate; 87=> symbol?.TypeKind == TypeKind.FunctionPointer; 90=> symbol?.TypeKind == TypeKind.Struct; 184IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 262case TypeKind.Array: 263case TypeKind.Delegate: 637if (type != null && type.IsValueType && type.TypeKind == TypeKind.Enum) 694if (type.TypeKind != TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SignatureComparer.cs (2)
186property1.ContainingType.TypeKind == TypeKind.Interface) 196property2.ContainingType.TypeKind == TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (3)
257private static TypeKind GetTypeKind(INamedTypeSymbol x) 261TypeKind.Module => TypeKind.Class,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
284var xTypeKind = GetTypeKind(x); 285var yTypeKind = GetTypeKind(y); 287if (xTypeKind == TypeKind.Error || 288yTypeKind == TypeKind.Error) 305var typeKind1 = GetTypeKind(type1); 308var typeKind2 = GetTypeKind(type2); 513if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
195if (x.TypeKind == TypeKind.Delegate)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
37if (typeSymbol.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
152if (namedType.TypeKind != TypeKind.Enum)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (3)
418TypeKind typeKind, string name, 437bool isRecord, TypeKind typeKind, string name, 488typeKind: TypeKind.Delegate,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
43public override TypeKind TypeKind => TypeKind.Array;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
93public override TypeKind TypeKind => _constructedFrom.TypeKind;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
29TypeKind typeKind, 63public override TypeKind TypeKind { get; } 95return this.TypeKind == TypeKind.Delegate
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
19public override TypeKind TypeKind => TypeKind.Pointer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
60public override TypeKind TypeKind => TypeKind.TypeParameter;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (3)
27public abstract TypeKind TypeKind { get; } 39public bool IsValueType => TypeKind is TypeKind.Struct or TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
518if (containingType?.TypeKind == TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
124member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented)
Roslyn.Diagnostics.CSharp.Analyzers (40)
PreferNullLiteral.cs (2)
57if (type.TypeKind == TypeKind.Pointer) 61else if (type.TypeKind == TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (2)
42if (typeSymbol.TypeKind is TypeKind.Class or TypeKind.Struct)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (2)
211if (containingType != null && containingType.TypeKind == TypeKind.Interface) 445if (parameter.Type.OriginalDefinition.TypeKind != TypeKind.TypeParameter)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (8)
253if (originalDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 270if (rewrittenDelegateCreationOperation.Type?.TypeKind != TypeKind.Delegate) 316if (originalConvertedType is null || originalConvertedType.TypeKind == TypeKind.Error) 375if (rewrittenConvertedType.TypeKind == TypeKind.Error) 594originalConvertedType.IsReferenceType && rewrittenConvertedType.TypeKind == TypeKind.Dynamic) 1116if (!original.IsReferenceType || original.TypeKind == TypeKind.Interface) 1459if (originalMemberSymbol.ContainingType.TypeKind == TypeKind.Interface) 1499rewrittenType.TypeKind == TypeKind.Array ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
260if (declaredType.TypeKind == TypeKind.Dynamic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
60if (type is INamedTypeSymbol { TypeKind: TypeKind.Enum } enumType)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
293if (constraintType.IsReferenceType && constraintType.TypeKind != TypeKind.Interface)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (8)
96if (info.Context.GenerateMembers && namedType.TypeKind != TypeKind.Delegate) 188if (namedType.TypeKind == TypeKind.Enum) 192else if (namedType.TypeKind == TypeKind.Delegate) 200var isRecordClass = namedType.TypeKind is TypeKind.Class; 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration; 293if (namedType.TypeKind == TypeKind.Class) 321if (namedType is { TypeKind: TypeKind.Class, BaseType: not null, BaseType.SpecialType: not SpecialType.System_Object })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
3062return ((INamedTypeSymbol)symbol).TypeKind == TypeKind.Enum; 3065return target.IsType && ((ITypeSymbol)target).TypeKind == TypeKind.Enum;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (4)
59typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Class).Concat( 60typeParameter.ConstraintTypes.Where(t => t.TypeKind == TypeKind.Interface).Concat( 61typeParameter.ConstraintTypes.Where(t => t.TypeKind is not TypeKind.Class and not TypeKind.Interface)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (2)
53if (symbol.ContainingType.TypeKind == TypeKind.Submission) 67if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (4)
197if (symbol is { TypeKind: TypeKind.Error, Name: "var" }) 234if (innerType.TypeKind != TypeKind.Pointer) 269if (symbol.ContainingType.TypeKind != TypeKind.Submission) 288if (symbol.TypeKind != TypeKind.Error)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
447if (type.TypeKind == TypeKind.Delegate) 1037if (parentTypes.Any(static parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate)) 1039return parentTypes.Where(parentType => parentType.InferredType.SpecialType == SpecialType.System_String || parentType.InferredType.TypeKind == TypeKind.Delegate);
System.Text.Json.SourceGeneration (10)
Helpers\RoslynExtensions.cs (7)
131if (type.IsAbstract || type.TypeKind is TypeKind.Interface || type is not INamedTypeSymbol namedType) 162if (baseType.TypeKind is TypeKind.Interface) 207if (baseTypeDefinition.TypeKind is TypeKind.Interface) 668if (type.TypeKind != TypeKind.Interface) 815if (type is not { TypeKind: TypeKind.Class, IsAbstract: true }) 869Debug.Assert(closedType.TypeKind is TypeKind.Class); 1164if (originalSuperType.TypeKind == TypeKind.Interface)
JsonSourceGenerator.Parser.cs (2)
718else if (type.TypeKind is TypeKind.Enum) 1887if (type.TypeKind is TypeKind.Enum)
src\runtime\src\libraries\Common\src\SourceGenerators\TypeRef.cs (1)
33public TypeKind TypeKind { get; }