1 interface inheriting from INamedTypeSymbol
Microsoft.CodeAnalysis (1)
Symbols\IErrorTypeSymbol.cs (1)
20public interface IErrorTypeSymbol : INamedTypeSymbol
5 implementations of INamedTypeSymbol
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
19internal abstract class CodeGenerationAbstractNamedTypeSymbol : CodeGenerationTypeSymbol, INamedTypeSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\NamedTypeSymbol.cs (1)
13internal abstract class NamedTypeSymbol : TypeSymbol, INamedTypeSymbol
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
18private sealed class WrappedNamedTypeSymbol : AbstractWrappedNamespaceOrTypeSymbol, INamedTypeSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\NamedTypeSymbol.vb (1)
25Implements INamedTypeSymbol, INamedTypeSymbolInternal
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
19internal abstract class CodeGenerationAbstractNamedTypeSymbol : CodeGenerationTypeSymbol, INamedTypeSymbol
7572 references to INamedTypeSymbol
Aspire.Hosting.Analyzers (13)
AppHostAnalyzer.cs (3)
99var modelNameParameter = wellKnownTypes.Get(WellKnownTypeData.WellKnownType.Aspire_Hosting_ApplicationModel_IModelNameParameter); 100var resourceNameAttribute = wellKnownTypes.Get(WellKnownTypeData.WellKnownType.Aspire_Hosting_ApplicationModel_ResourceNameAttribute); 101var endpointNameAttribute = wellKnownTypes.Get(WellKnownTypeData.WellKnownType.Aspire_Hosting_ApplicationModel_EndpointNameAttribute);
Infrastructure\WellKnownTypes.cs (10)
17private readonly INamedTypeSymbol?[] _lazyWellKnownTypes; 49_lazyWellKnownTypes = new INamedTypeSymbol?[WellKnownTypeData.WellKnownTypeNames.Length]; 53public INamedTypeSymbol Get(SpecialType type) 58public INamedTypeSymbol Get(WellKnownTypeData.WellKnownType type) 61var symbol = _lazyWellKnownTypes[index]; 72private INamedTypeSymbol GetAndCache(int index) 74var result = GetTypeByMetadataNameInTargetAssembly(WellKnownTypeData.WellKnownTypeNames[index]) 85private INamedTypeSymbol? GetTypeByMetadataNameInTargetAssembly(string metadataName) 100foreach (var type in types) 148foreach (var t in type.AllInterfaces)
ConfigurationSchemaGenerator (102)
ConfigSchemaEmitter.cs (1)
492var typeSymbol = _compilation.GetBestTypeByMetadataName(type.FullName);
ConfigSchemaGenerator.cs (3)
55List<INamedTypeSymbol>? types = null; 77(types ??= new()).Add((INamedTypeSymbol)args[1].Value); 108internal sealed record ConfigSchemaAttributeInfo(List<INamedTypeSymbol>? Types, List<string>? ConfigurationPaths, List<string>? ExclusionPaths, List<string>? LogCategories);
ConfigurationBindingGenerator.ForSchemaGeneration.cs (1)
45foreach (var type in _configSchemaInfo.Types)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (37)
85INamedTypeSymbol? candidateBinderType = targetMethod.ContainingType; 205else if (type is INamedTypeSymbol) 221if (type is INamedTypeSymbol { IsGenericType: true } genericType && 222genericType.ConstructUnboundGenericType() is INamedTypeSymbol { } unboundGeneric && 241if (type is not INamedTypeSymbol namedType) 364INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; 388INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; 445INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; 544type = ((INamedTypeSymbol)type).TypeArguments[0]; // extract the T from a Nullable<T> 564INamedTypeSymbol collectionType = (INamedTypeSymbol)type; 594INamedTypeSymbol typeSymbol = (INamedTypeSymbol)typeParseInfo.TypeSymbol; 663INamedTypeSymbol? current = typeSymbol; 753private bool TryGetElementType(INamedTypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? elementType) 755INamedTypeSymbol? candidate = GetInterface(type, _typeSymbols.GenericIEnumerable_Unbound); 767private bool IsCandidateDictionary(INamedTypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? keyType, [NotNullWhen(true)] out ITypeSymbol? elementType) 769INamedTypeSymbol? candidate = GetInterface(type, _typeSymbols.GenericIDictionary_Unbound) ?? GetInterface(type, _typeSymbols.IReadOnlyDictionary_Unbound); 791type is INamedTypeSymbol namedType && GetInterface(namedType, _typeSymbols.IEnumerable) is not null; 793private static INamedTypeSymbol? GetInterface(INamedTypeSymbol type, INamedTypeSymbol? @interface) 809candidate.ConstructUnboundGenericType() is INamedTypeSymbol unbound 816private static bool IsInterfaceMatch(INamedTypeSymbol type, INamedTypeSymbol? @interface) 825INamedTypeSymbol unbound = type.ConstructUnboundGenericType(); 834if (type is not INamedTypeSymbol { IsGenericType: true } genericType) 851private static bool HasPublicParameterLessCtor(INamedTypeSymbol type) => 854private static bool HasAddMethod(INamedTypeSymbol type, ITypeSymbol element) 856INamedTypeSymbol? current = type; 870private static bool HasAddMethod(INamedTypeSymbol type, ITypeSymbol key, ITypeSymbol element) 872INamedTypeSymbol? current = type; 887private static bool IsEnum(ITypeSymbol type) => type is INamedTypeSymbol { EnumUnderlyingType: INamedTypeSymbol { } };
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
58ContainingType: INamedTypeSymbol
RuntimeSource\Configuration.Binder\Parser\Extensions.cs (1)
105if (type is not INamedTypeSymbol { IsGenericType: true } namedType)
RuntimeSource\Configuration.Binder\Parser\KnownTypeSymbols.cs (48)
18public INamedTypeSymbol String { get; } 19public INamedTypeSymbol? CultureInfo { get; } 20public INamedTypeSymbol? DateOnly { get; } 21public INamedTypeSymbol? DateTimeOffset { get; } 22public INamedTypeSymbol? Guid { get; } 23public INamedTypeSymbol? Half { get; } 24public INamedTypeSymbol? Int128 { get; } 25public INamedTypeSymbol? TimeOnly { get; } 26public INamedTypeSymbol? TimeSpan { get; } 27public INamedTypeSymbol? UInt128 { get; } 28public INamedTypeSymbol? Uri { get; } 29public INamedTypeSymbol? Version { get; } 31public INamedTypeSymbol? ActionOfBinderOptions { get; } 32public INamedTypeSymbol? ConfigurationBinder { get; } 33public INamedTypeSymbol? ConfigurationKeyNameAttribute { get; } 34public INamedTypeSymbol? OptionsBuilderConfigurationExtensions { get; } 35public INamedTypeSymbol? OptionsBuilderOfT { get; } 36public INamedTypeSymbol? OptionsBuilderOfT_Unbound { get; } 37public INamedTypeSymbol? OptionsConfigurationServiceCollectionExtensions { get; } 39public INamedTypeSymbol GenericIList_Unbound { get; } 40public INamedTypeSymbol? GenericICollection_Unbound { get; } 41public INamedTypeSymbol GenericICollection { get; } 42public INamedTypeSymbol GenericIEnumerable_Unbound { get; } 43public INamedTypeSymbol IEnumerable { get; } 44public INamedTypeSymbol? Dictionary { get; } 45public INamedTypeSymbol? GenericIDictionary_Unbound { get; } 46public INamedTypeSymbol? GenericIDictionary { get; } 47public INamedTypeSymbol? HashSet { get; } 48public INamedTypeSymbol? IConfiguration { get; } 49public INamedTypeSymbol? IConfigurationSection { get; } 50public INamedTypeSymbol? IDictionary { get; } 51public INamedTypeSymbol? IReadOnlyCollection_Unbound { get; } 52public INamedTypeSymbol? IReadOnlyDictionary_Unbound { get; } 53public INamedTypeSymbol? IReadOnlyList_Unbound { get; } 54public INamedTypeSymbol? IReadOnlySet_Unbound { get; } 55public INamedTypeSymbol? IServiceCollection { get; } 56public INamedTypeSymbol? ISet_Unbound { get; } 57public INamedTypeSymbol? ISet { get; } 58public INamedTypeSymbol? List { get; } 59public INamedTypeSymbol Enum { get; } 60public INamedTypeSymbol? ArgumentNullException { get; } 61public INamedTypeSymbol? SerializationInfo { get; } 62public INamedTypeSymbol? IntPtr { get; } 63public INamedTypeSymbol? UIntPtr { get; } 64public INamedTypeSymbol? MemberInfo { get; } 65public INamedTypeSymbol? ParameterInfo { get; } 66public INamedTypeSymbol? Delegate { get; } 87INamedTypeSymbol? binderOptions = compilation.GetBestTypeByMetadataName("Microsoft.Extensions.Configuration.BinderOptions");
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (1)
22@params[0].Type is not INamedTypeSymbol { IsGenericType: true } genericType ||
RuntimeSource\Configuration.Binder\Specs\Types\CollectionSpec.cs (1)
40public DictionarySpec(INamedTypeSymbol type) : base(type) { }
RuntimeSource\Configuration.Binder\Specs\Types\ObjectSpec.cs (1)
12INamedTypeSymbol type,
RuntimeSource\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
RuntimeSource\SourceGenerators\TypeModelHelper.cs (3)
13public static List<ITypeSymbol>? GetAllTypeArgumentsInScope(this INamedTypeSymbol type) 24void TraverseContainingTypes(INamedTypeSymbol current) 26if (current.ContainingType is INamedTypeSymbol parent)
ILLink.CodeFixProvider (1)
BaseAttributeCodeFixProvider.cs (1)
139 for (var t = m.ContainingType; t is not null; t = t.ContainingType) {
ILLink.RoslynAnalyzer (62)
CompilationExtensions.cs (5)
40 public static INamedTypeSymbol? GetBestTypeByMetadataName (this Compilation compilation, string fullyQualifiedMetadataName) 43 var type = compilation.GetTypeByMetadataName (fullyQualifiedMetadataName); 52 var currentType = referencedAssembly.GetTypeByMetadataName (fullyQualifiedMetadataName); 165 public static INamedTypeSymbol? TaskType (this Compilation compilation) 167 public static INamedTypeSymbol? TaskOfTType (this Compilation compilation)
DataFlow\DynamicallyAccessedMembersBinder.cs (4)
353 foreach (var i in type.Interfaces) { 390 var baseType = type.BaseType; 400 foreach (var iface in type.Interfaces) { 402 var interfaceType = iface;
DataFlow\LocalDataFlowVisitor.cs (1)
175 var assemblyType = Compilation.GetTypeByMetadataName ("Microsoft.CSharp.RuntimeBinder.Binder");
DynamicallyAccessedMembersAnalyzer.cs (7)
116 var type = (INamedTypeSymbol) context.Symbol; 125 if (type.BaseType is INamedTypeSymbol baseType) 128 foreach (var interfaceType in type.Interfaces) 139 VerifyDamOnInterfaceAndImplementationMethodsMatch (context, (INamedTypeSymbol) context.Symbol); 262 static void VerifyDamOnInterfaceAndImplementationMethodsMatch (SymbolAnalysisContext context, INamedTypeSymbol type) 267 INamedTypeSymbol implementationType = implementationMethod.ContainingType;
DynamicallyAccessedMembersTypeHierarchy.cs (3)
15 public static void ApplyDynamicallyAccessedMembersToTypeHierarchy (Location typeLocation, INamedTypeSymbol type, Action<Diagnostic> reportDiagnostic) 23 if (type.BaseType is INamedTypeSymbol baseType) { 38 foreach (var iface in type.AllInterfaces) {
INamedTypeSymbolExtensions.cs (6)
15 internal static bool HasName (this INamedTypeSymbol type, string typeName) 33 internal static IEnumerable<(ISymbol InterfaceMember, ISymbol ImplementationMember)> GetMemberInterfaceImplementationPairs (this INamedTypeSymbol namedType) 36 foreach (INamedTypeSymbol iface in interfaces) { 43 private static IEnumerable<(ISymbol InterfaceMember, ISymbol ImplementationMember)> GetMatchingMembers (INamedTypeSymbol implementationSymbol, INamedTypeSymbol interfaceSymbol) 51 foreach (var iface in interfaceSymbol.Interfaces) {
ISymbolExtensions.cs (2)
84 if (featureGuardAttribute.ConstructorArguments is [TypedConstant { Value: INamedTypeSymbol featureType }]) 179 if (symbol is not INamedTypeSymbol namedTypeSymbol)
ITypeSymbolExtensions.cs (3)
24 if (type is not INamedTypeSymbol namedType) 31 private static HierarchyFlags GetFlags (INamedTypeSymbol type) 43 foreach (var iface in baseType.Interfaces) {
RequiresAnalyzerBase.cs (6)
68 var typeSymbol = (INamedTypeSymbol) symbolAnalysisContext.Symbol; 81 case INamedTypeSymbol typeSymbol: 99 typeArg is not INamedTypeSymbol { InstanceConstructors: { } typeArgCtors }) 134 INamedTypeSymbol type) 137 var implementationType = memberpair.ImplementationMember switch {
RequiresAssemblyFilesAnalyzer.cs (3)
72 var runtimeFeaturesType = compilation.GetTypeByMetadataName ("ILLink.RoslynAnalyzer.TestFeatures"); 87 var assemblyType = compilation.GetTypeByMetadataName ("System.Reflection.Assembly"); 97 var assemblyNameType = compilation.GetTypeByMetadataName ("System.Reflection.AssemblyName");
RequiresDynamicCodeAnalyzer.cs (1)
131 var runtimeFeaturesType = compilation.GetTypeByMetadataName ("System.Runtime.CompilerServices.RuntimeFeature");
RequiresUnreferencedCodeAnalyzer.cs (3)
33 if (symbolAnalysisContext.Symbol is INamedTypeSymbol typeSymbol && !typeSymbol.HasAttribute (RequiresUnreferencedCodeAttribute) 34 && typeSymbol.BaseType is INamedTypeSymbol baseType 74 var runtimeFeaturesType = compilation.GetTypeByMetadataName ("ILLink.RoslynAnalyzer.TestFeatures");
TrimAnalysis\FlowAnnotations.cs (4)
118 internal static DynamicallyAccessedMemberTypes GetTypeAnnotations (INamedTypeSymbol type) 123 INamedTypeSymbol? baseType = type.BaseType; 130 foreach (INamedTypeSymbol interfaceType in type.AllInterfaces) { 199 foreach (var interfaceType in type.AllInterfaces) {
TrimAnalysis\GenericArgumentDataFlow.cs (5)
15 public static void ProcessGenericArgumentDataFlow (Location location, INamedTypeSymbol type, Action<Diagnostic> reportDiagnostic) 54 if (typeArgument is INamedTypeSymbol namedTypeArgument && namedTypeArgument.IsGenericType) 59 public static bool RequiresGenericArgumentDataFlow (INamedTypeSymbol type) 66 if (typeArgument is INamedTypeSymbol namedTypeSymbol && namedTypeSymbol.IsGenericType 84 if (typeArgument is INamedTypeSymbol namedTypeSymbol && namedTypeSymbol.IsGenericType
TrimAnalysis\HandleCallAction.cs (1)
180 var type = method.Method.ContainingType;
TrimAnalysis\MethodProxy.cs (1)
59 if (type is not INamedTypeSymbol namedType)
TrimAnalysis\ReflectionAccessAnalyzer.cs (4)
18 readonly INamedTypeSymbol? _typeHierarchyType; 20 public ReflectionAccessAnalyzer (Action<Diagnostic>? reportDiagnostic, INamedTypeSymbol? typeHierarchyType) 119 static bool IsDeclaredWithinType (ISymbol member, INamedTypeSymbol type) 121 INamedTypeSymbol containingType = member.ContainingType;
TrimAnalysis\SingleValueExtensions.cs (1)
17 var underlyingType = (type as INamedTypeSymbol)?.TypeArguments.FirstOrDefault ();
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (1)
53 case INamedTypeSymbol type:
TrimAnalysis\TypeProxy.cs (1)
16 if (Type is not INamedTypeSymbol namedType ||
Microsoft.Analyzers.Extra (44)
AsyncCallInsideUsingBlockAnalyzer.cs (4)
28var taskType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.Task"); 29var taskOfTType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.Task`1"); 30var valueTaskType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.ValueTask"); 31var valueTaskOfTType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.ValueTask`1");
AsyncMethodWithoutCancellation.cs (10)
28var taskType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.Task"); 29var taskOfTType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.Task`1"); 30var valueTaskType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.ValueTask"); 31var valueTaskOfTType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.Tasks.ValueTask`1"); 42var cancellationTokenType = compilationContext.Compilation.GetTypeByMetadataName("System.Threading.CancellationToken"); 43var httpContextType = compilationContext.Compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Http.HttpContext"); 44var connectionContextType = 46var obsoleteAttribute = 140var containingType = method.ContainingType; 141foreach (var @interface in containingType.AllInterfaces)
CallAnalysis\Arrays.cs (5)
83var freezer = reg.Compilation.GetTypeByMetadataName("System.Collections.Frozen.FrozenDictionary"); 101static void HandleMethod(OperationAnalysisContext context, IInvocationOperation op) => HandleSuspectType(context, (INamedTypeSymbol)op.TargetMethod.ReturnType, op.Syntax.GetLocation()); 103static void HandleConstructor(OperationAnalysisContext context, IObjectCreationOperation op) => HandleSuspectType(context, (INamedTypeSymbol)op.Type!, op.Syntax.GetLocation()); 105static void HandleSuspectType(OperationAnalysisContext context, INamedTypeSymbol type, Location loc) 114var flagsAttr = context.Compilation.GetTypeByMetadataName("System.FlagsAttribute");
CallAnalysis\CallAnalyzer.Handlers.cs (2)
41var type = target.ContainingType; 60foreach (var iface in type.AllInterfaces)
CallAnalysis\CallAnalyzer.Registrar.cs (5)
70var type = Compilation.GetTypeByMetadataName(pair.Key); 113var type = Compilation.GetTypeByMetadataName(typeName); 148var type = Compilation.GetTypeByMetadataName(pair.Key); 204var type = Compilation.GetTypeByMetadataName(pair.Key); 225var type = Compilation.GetTypeByMetadataName(et);
CallAnalysis\Fixers\LegacyLoggingFixer.cs (7)
42internal Func<Compilation, string, INamedTypeSymbol?> GetTypeByMetadataName1 = (c, n) => c.GetTypeByMetadataName(n); 43internal Func<Compilation, string, INamedTypeSymbol?> GetTypeByMetadataName2 = (c, n) => c.GetTypeByMetadataName(n); 44internal Func<Compilation, string, INamedTypeSymbol?> GetTypeByMetadataName3 = (c, n) => c.GetTypeByMetadataName(n); 89var loggerExtensions = GetTypeByMetadataName1(comp, "Microsoft.Extensions.Logging.LoggerExtensions"); 147var logMethodAttribute = GetTypeByMetadataName2(comp, LoggerMessageAttribute); 620var logMethodAttribute = GetTypeByMetadataName3(comp, LoggerMessageAttribute); 629var targetClassSymbol = semanticModel.GetDeclaredSymbol(targetClass, cancellationToken);
CallAnalysis\LegacyLogging.cs (1)
18var loggerExtensions = reg.Compilation.GetTypeByMetadataName("Microsoft.Extensions.Logging.LoggerExtensions");
CallAnalysis\Split.cs (1)
17var memExt = reg.Compilation.GetTypeByMetadataName("System.MemoryExtensions");
CallAnalysis\StartsEndsWith.cs (2)
19var stringType = reg.Compilation.GetSpecialType(SpecialType.System_String); 20var stringCompType = reg.Compilation.GetTypeByMetadataName("System.StringComparison");
CallAnalysis\ValueTuple.cs (1)
29var type = reg.Compilation.GetTypeByMetadataName("System.Tuple");
ConditionalAccessAnalyzer.cs (1)
30var maybeNull = compilationStartContext.Compilation.GetTypeByMetadataName("System.Diagnostics.CodeAnalysis.MaybeNullAttribute");
MakeExeTypesInternalAnalyzer.cs (3)
62var type = compilationStartContext.Compilation.GetTypeByMetadataName(name); 72var type = compilationStartContext.Compilation.GetTypeByMetadataName(name); 82var type = compilationStartContext.Compilation.GetTypeByMetadataName(name);
Utilities\CompilationExtensions.cs (1)
12var type = compilation.GetTypeByMetadataName("System.Environment");
Utilities\SymbolExtensions.cs (1)
63foreach (var iface in method.ContainingType.AllInterfaces)
Microsoft.Analyzers.Local (28)
ApiLifecycle\ApiLifecycleAnalyzer.cs (6)
54.Cast<INamedTypeSymbol>(); 57foreach (var type in types) 68var obsoleteAttribute = compilation.GetTypeByMetadataName(ObsoleteAttributeFullName); 148.Cast<INamedTypeSymbol>(); 150var obsoleteAttribute = context.Compilation.GetTypeByMetadataName(ObsoleteAttributeFullName); 152foreach (var type in types)
ApiLifecycle\AssemblyAnalysis.cs (5)
129public void AnalyzeType(INamedTypeSymbol type) 142var baseType = type.BaseType; 251var t = fieldSym.GetFieldOrPropertyType() as INamedTypeSymbol; 273private static string PrependModifiers(string typeSignature, INamedTypeSymbol type)
CallAnalysis\CallAnalyzer.Handlers.cs (2)
41var type = target.ContainingType; 60foreach (var iface in type.AllInterfaces)
CallAnalysis\CallAnalyzer.Registrar.cs (5)
70var type = Compilation.GetTypeByMetadataName(pair.Key); 113var type = Compilation.GetTypeByMetadataName(typeName); 148var type = Compilation.GetTypeByMetadataName(pair.Key); 204var type = Compilation.GetTypeByMetadataName(pair.Key); 225var type = Compilation.GetTypeByMetadataName(et);
CallAnalysis\ToInvariantString.cs (2)
26var formatProvider = reg.Compilation.GetTypeByMetadataName("System.IFormatProvider"); 46var cultureInfo = context.Compilation.GetTypeByMetadataName("System.Globalization.CultureInfo");
Utilities\SymbolExtensions.cs (8)
37public static bool HasAttribute(this ISymbol sym, INamedTypeSymbol attribute) 64public static bool IsContaminated(this ISymbol symbol, INamedTypeSymbol? contaminationAttribute) 83var container = symbol.ContainingType; 95if (symbol is INamedTypeSymbol type) 97var baseType = type.BaseType; 133var container = symbol.ContainingType; 145if (symbol is INamedTypeSymbol type) 147var baseType = type.BaseType;
Microsoft.AspNetCore.Analyzers (25)
BuildServiceProviderAnalyzer.cs (2)
23var type = (INamedTypeSymbol)context.Symbol;
ConfigureMethodVisitor.cs (2)
34foreach (var type in symbol.GetTypeMembers()) 45public override void VisitNamedType(INamedTypeSymbol symbol)
MiddlewareAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureMethod.ContainingType;
OptionsAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureServicesMethod.ContainingType;
OptionsItem.cs (1)
16public INamedTypeSymbol OptionsType => Property.ContainingType;
ServicesAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureServicesMethod.ContainingType;
StartupAnalysis.cs (4)
11private readonly ImmutableDictionary<INamedTypeSymbol, ImmutableArray<object>> _analysesByType; 15ImmutableDictionary<INamedTypeSymbol, ImmutableArray<object>> analysesByType) 23public T? GetRelatedSingletonAnalysis<T>(INamedTypeSymbol type) where T : class 39public ImmutableArray<T> GetRelatedAnalyses<T>(INamedTypeSymbol type) where T : class
StartupAnalysisBuilder.cs (3)
12private readonly Dictionary<INamedTypeSymbol, List<object>> _analysesByType; 22_analysesByType = new Dictionary<INamedTypeSymbol, List<object>>(SymbolEqualityComparer.Default); 59private void ReportAnalysisCore(INamedTypeSymbol type, object analysis)
StartupAnalyzer.cs (2)
43var type = (INamedTypeSymbol)context.Symbol;
StartupFacts.cs (1)
11public static bool IsStartupClass(StartupSymbols symbols, INamedTypeSymbol type)
StartupSymbols.cs (3)
19public INamedTypeSymbol IApplicationBuilder { get; } 21public INamedTypeSymbol IServiceCollection { get; } 23public INamedTypeSymbol MvcOptions { get; }
UseAuthorizationAnalyzer.cs (2)
24var type = (INamedTypeSymbol)context.Symbol;
UseMvcAnalyzer.cs (2)
23var type = (INamedTypeSymbol)context.Symbol;
Microsoft.AspNetCore.Analyzers.Test (18)
CompilationFeatureDetectorTest.cs (6)
35var type = (INamedTypeSymbol)compilation.GetSymbolsWithName("StartupWithNoFeatures").Single(); 75var type = (INamedTypeSymbol)compilation.GetSymbolsWithName("StartupWithMapHub").Single(); 115var type = (INamedTypeSymbol)compilation.GetSymbolsWithName("StartupWithMapBlazorHub").Single();
StartupFactsTest.cs (12)
118var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single(); 143var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single(); 166var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single(); 188var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single(); 210var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single(); 227var type = (INamedTypeSymbol)compilation.GetSymbolsWithName(source).Single();
Microsoft.AspNetCore.App.Analyzers (95)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
38var policyServiceCollectionExtensions = wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_DependencyInjection_PolicyServiceCollectionExtensions);
Authorization\AuthorizationOptionsTypes.cs (1)
36public INamedTypeSymbol? AuthorizationOptions { get; }
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
48private static bool IsIHeadersDictionaryType(INamedTypeSymbol type)
Http\RequestDelegateReturnTypeAnalyzer.cs (1)
81((INamedTypeSymbol)returnType).TypeArguments[0].ToString()));
Mvc\DetectOverriddenAuthorizeAttribute.cs (9)
27INamedTypeSymbol controllerSymbol, List<AttributeInfo> authorizeAttributes, out string? allowAnonClass) 114private static bool IsInheritableAttribute(WellKnownTypes wellKnownTypes, INamedTypeSymbol attribute) 117var attributeUsageAttributeType = wellKnownTypes.Get(WellKnownType.System_AttributeUsageAttribute); 135private static bool IsMatchingAttribute(WellKnownTypes wellKnownTypes, INamedTypeSymbol attribute, 136INamedTypeSymbol commonAttribute, ITypeSymbol attributeInterface, bool mustBeInheritable) 166var authInterfaceType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Authorization_IAuthorizeData); 167var authAttributeType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Authorization_AuthorizeAttribute); 182var anonInterfaceType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Authorization_IAllowAnonymous); 183var anonAttributeType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Authorization_AllowAnonymousAttribute);
Mvc\MvcAnalyzer.cs (2)
44var namedTypeSymbol = (INamedTypeSymbol)context.Symbol;
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
199if (methodSymbol?.ContainingType is not INamedTypeSymbol typeSymbol || 394if (parameterTypeSymbol is INamedTypeSymbol typeSymbol)
RouteEmbeddedLanguage\Infrastructure\MvcDetector.cs (2)
15public static bool IsController(INamedTypeSymbol? typeSymbol, WellKnownTypes wellKnownTypes) 30var disposable = wellKnownTypes.Get(SpecialType.System_IDisposable);
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (3)
45var fromRouteMetadata = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromRouteMetadata); 77if (child.GetParameterType() is not INamedTypeSymbol type) 89var attributeClass = attributeData.AttributeClass;
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (4)
138var classSymbol = semanticModel.GetDeclaredSymbol(classDeclarationSyntax, cancellationToken); 214if (methodSymbol?.ContainingType is not INamedTypeSymbol typeSymbol) 277var delegateSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_Delegate); 290var stringSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_String);
RouteHandlers\AtMostOneFromBodyAttribute.cs (2)
22var fromBodyMetadataInterfaceType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromBodyMetadata); 23var asParametersAttributeType = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_AsParametersAttribute);
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (9)
27var fromServiceMetadataTypeSymbol = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_Metadata_IFromServiceMetadata); 33var parameterTypeSymbol = ResovleParameterTypeSymbol(handlerDelegateParameter); 97static bool ReportFromAttributeDiagnostic(OperationAnalysisContext context, WellKnownType fromMetadataInterfaceType, WellKnownTypes wellKnownTypes, IParameterSymbol parameter, INamedTypeSymbol parameterTypeSymbol, Location location) 99var fromMetadataInterfaceTypeSymbol = wellKnownTypes.Get(fromMetadataInterfaceType); 116static INamedTypeSymbol? ResovleParameterTypeSymbol(IParameterSymbol parameterSymbol) 118INamedTypeSymbol? parameterTypeSymbol = null; 123parameterTypeSymbol = arrayTypeSymbol.ElementType as INamedTypeSymbol; 125else if (parameterSymbol.Type is INamedTypeSymbol namedTypeSymbol) 133parameterTypeSymbol = parameterTypeSymbol.TypeArguments[0] as INamedTypeSymbol;
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
91if (returnType is not INamedTypeSymbol { Name: "Task" or "ValueTask", IsGenericType: true, TypeArguments: { Length: 1 } } taskLike)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
109foreach (var @interface in target.AllInterfaces) 177public static INamedTypeSymbol? GetReceiverType( 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol; 200static INamedTypeSymbol? GetReceiverType( 206return typeInfo?.Type as INamedTypeSymbol;
src\Shared\Roslyn\MvcFacts.cs (5)
11public static bool IsController(INamedTypeSymbol type, INamedTypeSymbol controllerAttribute, INamedTypeSymbol nonControllerAttribute) 57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method)
src\Shared\RoslynUtils\ParsabilityHelper.cs (7)
117var iParsableTypeSymbol = wellKnownTypes.Get(WellKnownType.System_IParsable_T); 126var iBindableFromHttpContextTypeSymbol = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IBindableFromHttpContext_T); 127var constructedTypeSymbol = typeSymbol.AllInterfaces.FirstOrDefault( 140methodSymbol.ReturnType is INamedTypeSymbol returnType && 152methodSymbol.ReturnType is INamedTypeSymbol returnType && 156private static bool IsReturningValueTaskOfTOrNullableT(INamedTypeSymbol returnType, ITypeSymbol containingType, WellKnownTypes wellKnownTypes) 214if (bindAsyncMethod.ReturnType is INamedTypeSymbol returnType && !IsReturningValueTaskOfTOrNullableT(returnType, typeSymbol, wellKnownTypes))
src\Shared\RoslynUtils\SymbolExtensions.cs (17)
21INamedTypeSymbol? unwrappedTypeSymbol = null; 26unwrappedTypeSymbol = arrayTypeSymbol.ElementType as INamedTypeSymbol; 28else if (typeSymbol is INamedTypeSymbol namedTypeSymbol) 36unwrappedTypeSymbol = unwrappedTypeSymbol.TypeArguments[0] as INamedTypeSymbol; 52public static bool HasAttribute(this ISymbol symbol, INamedTypeSymbol attributeType) 65public static bool HasAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType) 70public static bool TryGetAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 85public static bool HasAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType) 90public static bool TryGetAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 105public static bool HasAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType) 110public static bool TryGetAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 127foreach (var t in type.AllInterfaces) 137public static bool IsType(this INamedTypeSymbol type, string typeName, SemanticModel semanticModel) 140public static bool IsType(this INamedTypeSymbol type, INamedTypeSymbol otherType) 165parameterSymbol.Type is INamedTypeSymbol 171propertySymbol.Type is INamedTypeSymbol
src\Shared\RoslynUtils\WellKnownTypes.cs (10)
20private readonly INamedTypeSymbol?[] _lazyWellKnownTypes; 52_lazyWellKnownTypes = new INamedTypeSymbol?[WellKnownTypeData.WellKnownTypeNames.Length]; 56public INamedTypeSymbol Get(SpecialType type) 61public INamedTypeSymbol Get(WellKnownTypeData.WellKnownType type) 64var symbol = _lazyWellKnownTypes[index]; 75private INamedTypeSymbol GetAndCache(int index) 77var result = GetTypeByMetadataNameInTargetAssembly(WellKnownTypeData.WellKnownTypeNames[index]); 90private INamedTypeSymbol? GetTypeByMetadataNameInTargetAssembly(string metadataName) 105foreach (var type in types) 153foreach (var t in type.AllInterfaces)
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (13)
41INamedTypeSymbol[] configureTypes = { wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Hosting_WebHostBuilderExtensions) }; 42INamedTypeSymbol[] configureWebHostTypes = { wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_Hosting_GenericHostWebHostBuilderExtensions) }; 43INamedTypeSymbol[] userStartupTypes = 48INamedTypeSymbol[] configureLoggingTypes = 53INamedTypeSymbol[] configureServicesTypes = 58INamedTypeSymbol[] configureAppTypes = 65INamedTypeSymbol[] configureHostTypes = { wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_ConfigureHostBuilder) }; 66INamedTypeSymbol[] useEndpointTypes = 315INamedTypeSymbol disallowedReceiverType, 317INamedTypeSymbol[] disallowedMethodTypes) 324var receiverType = invocation.GetReceiverType(context.CancellationToken); 341INamedTypeSymbol[] disallowedMethodTypes) 351var type = disallowedMethodTypes[i];
Microsoft.AspNetCore.App.SourceGenerators (1)
PublicTopLevelProgramGenerator.cs (1)
29.Select(static (symbol, _) => symbol is INamedTypeSymbol { TypeKind: TypeKind.Class } ? symbol : null)
Microsoft.AspNetCore.Components.Analyzers (25)
ComponentFacts.cs (1)
90public static bool IsComponent(ComponentSymbols symbols, Compilation compilation, INamedTypeSymbol type)
ComponentParameterAnalyzer.cs (2)
54var type = (INamedTypeSymbol)context.Symbol;
ComponentParameterUsageAnalyzer.cs (2)
75var propertyContainingType = componentProperty.ContainingType; 82var assignmentContainingType = startBlockContext.OwningSymbol?.ContainingType;
ComponentSymbols.cs (15)
18var parameterAttribute = compilation.GetTypeByMetadataName(ComponentsApi.ParameterAttribute.MetadataName); 25var cascadingParameterAttribute = compilation.GetTypeByMetadataName(ComponentsApi.CascadingParameterAttribute.MetadataName); 32var icomponentType = compilation.GetTypeByMetadataName(ComponentsApi.IComponent.MetadataName); 39var dictionary = compilation.GetTypeByMetadataName("System.Collections.Generic.Dictionary`2"); 40var @string = compilation.GetSpecialType(SpecialType.System_String); 41var @object = compilation.GetSpecialType(SpecialType.System_Object); 48var parameterCaptureUnmatchedValuesRuntimeType = dictionary.Construct(@string, @object); 59INamedTypeSymbol parameterAttribute, 60INamedTypeSymbol cascadingParameterAttribute, 61INamedTypeSymbol parameterCaptureUnmatchedValuesRuntimeType, 62INamedTypeSymbol icomponentType) 70public INamedTypeSymbol ParameterAttribute { get; } 73public INamedTypeSymbol ParameterCaptureUnmatchedValuesRuntimeType { get; } 75public INamedTypeSymbol CascadingParameterAttribute { get; } 77public INamedTypeSymbol IComponentType { get; }
InternalUsageAnalyzer.cs (5)
84case INamedTypeSymbol type: 86foreach (var @interface in type.Interfaces) 144var containingType = symbol.ContainingType; 173var containingType = symbol as INamedTypeSymbol ?? symbol.ContainingType;
Microsoft.AspNetCore.Components.SdkAnalyzers (25)
ComponentFacts.cs (1)
90public static bool IsComponent(ComponentSymbols symbols, Compilation compilation, INamedTypeSymbol type)
ComponentParameterAnalyzer.cs (2)
48var type = (INamedTypeSymbol)context.Symbol;
ComponentParameterUsageAnalyzer.cs (2)
75var propertyContainingType = componentProperty.ContainingType; 82var assignmentContainingType = startBlockContext.OwningSymbol?.ContainingType;
ComponentSymbols.cs (15)
18var parameterAttribute = compilation.GetTypeByMetadataName(ComponentsApi.ParameterAttribute.MetadataName); 25var cascadingParameterAttribute = compilation.GetTypeByMetadataName(ComponentsApi.CascadingParameterAttribute.MetadataName); 32var icomponentType = compilation.GetTypeByMetadataName(ComponentsApi.IComponent.MetadataName); 39var dictionary = compilation.GetTypeByMetadataName("System.Collections.Generic.Dictionary`2"); 40var @string = compilation.GetSpecialType(SpecialType.System_String); 41var @object = compilation.GetSpecialType(SpecialType.System_Object); 48var parameterCaptureUnmatchedValuesRuntimeType = dictionary.Construct(@string, @object); 59INamedTypeSymbol parameterAttribute, 60INamedTypeSymbol cascadingParameterAttribute, 61INamedTypeSymbol parameterCaptureUnmatchedValuesRuntimeType, 62INamedTypeSymbol icomponentType) 70public INamedTypeSymbol ParameterAttribute { get; } 71public INamedTypeSymbol ParameterCaptureUnmatchedValuesRuntimeType { get; } 73public INamedTypeSymbol CascadingParameterAttribute { get; } 75public INamedTypeSymbol IComponentType { get; }
InternalUsageAnalyzer.cs (5)
84case INamedTypeSymbol type: 86foreach (var @interface in type.Interfaces) 144var containingType = symbol.ContainingType; 173var containingType = symbol as INamedTypeSymbol ?? symbol.ContainingType;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (48)
src\Shared\RoslynUtils\ParsabilityHelper.cs (7)
117var iParsableTypeSymbol = wellKnownTypes.Get(WellKnownType.System_IParsable_T); 126var iBindableFromHttpContextTypeSymbol = wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IBindableFromHttpContext_T); 127var constructedTypeSymbol = typeSymbol.AllInterfaces.FirstOrDefault( 140methodSymbol.ReturnType is INamedTypeSymbol returnType && 152methodSymbol.ReturnType is INamedTypeSymbol returnType && 156private static bool IsReturningValueTaskOfTOrNullableT(INamedTypeSymbol returnType, ITypeSymbol containingType, WellKnownTypes wellKnownTypes) 214if (bindAsyncMethod.ReturnType is INamedTypeSymbol returnType && !IsReturningValueTaskOfTOrNullableT(returnType, typeSymbol, wellKnownTypes))
src\Shared\RoslynUtils\SymbolExtensions.cs (17)
21INamedTypeSymbol? unwrappedTypeSymbol = null; 26unwrappedTypeSymbol = arrayTypeSymbol.ElementType as INamedTypeSymbol; 28else if (typeSymbol is INamedTypeSymbol namedTypeSymbol) 36unwrappedTypeSymbol = unwrappedTypeSymbol.TypeArguments[0] as INamedTypeSymbol; 52public static bool HasAttribute(this ISymbol symbol, INamedTypeSymbol attributeType) 65public static bool HasAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType) 70public static bool TryGetAttribute(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol attributeType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 85public static bool HasAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType) 90public static bool TryGetAttributeImplementingInterface(this ISymbol symbol, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 105public static bool HasAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType) 110public static bool TryGetAttributeImplementingInterface(this ImmutableArray<AttributeData> attributes, INamedTypeSymbol interfaceType, [NotNullWhen(true)] out AttributeData? matchedAttribute) 127foreach (var t in type.AllInterfaces) 137public static bool IsType(this INamedTypeSymbol type, string typeName, SemanticModel semanticModel) 140public static bool IsType(this INamedTypeSymbol type, INamedTypeSymbol otherType) 165parameterSymbol.Type is INamedTypeSymbol 171propertySymbol.Type is INamedTypeSymbol
src\Shared\RoslynUtils\WellKnownTypes.cs (10)
20private readonly INamedTypeSymbol?[] _lazyWellKnownTypes; 52_lazyWellKnownTypes = new INamedTypeSymbol?[WellKnownTypeData.WellKnownTypeNames.Length]; 56public INamedTypeSymbol Get(SpecialType type) 61public INamedTypeSymbol Get(WellKnownTypeData.WellKnownType type) 64var symbol = _lazyWellKnownTypes[index]; 75private INamedTypeSymbol GetAndCache(int index) 77var result = GetTypeByMetadataNameInTargetAssembly(WellKnownTypeData.WellKnownTypeNames[index]); 90private INamedTypeSymbol? GetTypeByMetadataNameInTargetAssembly(string metadataName) 105foreach (var type in types) 153foreach (var t in type.AllInterfaces)
StaticRouteHandlerModel\Emitters\DiagnosticEmitter.cs (4)
34typeSymbol is INamedTypeSymbol && 35((INamedTypeSymbol)typeSymbol).TypeArguments.Any(a => a is ITypeParameterSymbol)) 41typeSymbol is INamedTypeSymbol && 42((INamedTypeSymbol)typeSymbol).TypeArguments.Any(typeArg =>
StaticRouteHandlerModel\EndpointParameter.cs (2)
170Type is not INamedTypeSymbol namedTypeSymbol || 457private static bool TryGetAsParametersConstructor(Endpoint endpoint, INamedTypeSymbol type, out bool? isDefaultConstructor, [NotNullWhen(true)] out IEnumerable<ConstructorParameter>? matchedProperties)
StaticRouteHandlerModel\EndpointResponse.cs (6)
49var task = WellKnownTypes.Get(WellKnownType.System_Threading_Tasks_Task); 50var taskOfT = WellKnownTypes.Get(WellKnownType.System_Threading_Tasks_Task_T); 51var valueTask = WellKnownTypes.Get(WellKnownType.System_Threading_Tasks_ValueTask); 52var valueTaskOfT = WellKnownTypes.Get(WellKnownType.System_Threading_Tasks_ValueTask_T); 58return ((INamedTypeSymbol)returnType).TypeArguments[0]; 81var resultType = WellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IResult);
StaticRouteHandlerModel\Model\EndpointParameterExtensions.cs (2)
44if (handlerParameterType is INamedTypeSymbol { IsGenericType: true, OriginalDefinition: { SpecialType: not SpecialType.System_Nullable_T } }) 55=> ((INamedTypeSymbol?)parameter.BindableMethodSymbol?.ReturnType)?.TypeArguments[0];
Microsoft.AspNetCore.Mvc.Analyzers (59)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (15)
42var declaringType = method.ContainingType; 57var type = (INamedTypeSymbol)context.Symbol; 75private static bool IsPageModel(INamedTypeSymbol type, INamedTypeSymbol pageAttributeModel) 82private static void ReportRouteDiagnosticOnModel(SymbolAnalysisContext context, INamedTypeSymbol typeSymbol, INamedTypeSymbol routeAttribute) 96private static void ReportRouteDiagnostic(SymbolAnalysisContext context, IMethodSymbol method, INamedTypeSymbol routeAttribute) 110private static void ReportFilterDiagnostic(SymbolAnalysisContext context, IMethodSymbol method, INamedTypeSymbol filterAttribute) 124private static AttributeData? GetAttribute(ISymbol symbol, INamedTypeSymbol attributeType) 154public INamedTypeSymbol PageModelAttribute { get; } 156public INamedTypeSymbol IFilterMetadata { get; } 158public INamedTypeSymbol AuthorizeAttribute { get; } 160public INamedTypeSymbol AllowAnonymousAttribute { get; } 162public INamedTypeSymbol IRouteTemplateProvider { get; }
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
109foreach (var @interface in target.AllInterfaces) 177public static INamedTypeSymbol? GetReceiverType( 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol; 200static INamedTypeSymbol? GetReceiverType( 206return typeInfo?.Type as INamedTypeSymbol;
src\Shared\Roslyn\MvcFacts.cs (5)
11public static bool IsController(INamedTypeSymbol type, INamedTypeSymbol controllerAttribute, INamedTypeSymbol nonControllerAttribute) 57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method)
TagHelpersInCodeBlocksAnalyzer.cs (5)
137INamedTypeSymbol taskType) 145public INamedTypeSymbol TaskType { get; } 151if (!TryGetType(SymbolNames.TagHelperRunnerTypeName, out var tagHelperRunnerType)) 156if (!TryGetType(SymbolNames.TaskTypeName, out var taskType)) 172bool TryGetType(string typeName, out INamedTypeSymbol typeSymbol)
TopLevelParameterNameAnalyzer.cs (26)
212INamedTypeSymbol bindAttribute, 213INamedTypeSymbol controllerAttribute, 214INamedTypeSymbol fromBodyAttribute, 215INamedTypeSymbol apiBehaviorMetadata, 216INamedTypeSymbol binderTypeProviderMetadata, 217INamedTypeSymbol modelNameProvider, 218INamedTypeSymbol nonControllerAttribute, 219INamedTypeSymbol nonActionAttribute, 237if (!TryGetType(SymbolNames.BindAttribute, out var bindAttribute)) 242if (!TryGetType(SymbolNames.ControllerAttribute, out var controllerAttribute)) 247if (!TryGetType(SymbolNames.FromBodyAttribute, out var fromBodyAttribute)) 252if (!TryGetType(SymbolNames.IApiBehaviorMetadata, out var apiBehaviorMetadata)) 257if (!TryGetType(SymbolNames.IBinderTypeProviderMetadata, out var iBinderTypeProviderMetadata)) 262if (!TryGetType(SymbolNames.IModelNameProvider, out var iModelNameProvider)) 267if (!TryGetType(SymbolNames.NonControllerAttribute, out var nonControllerAttribute)) 272if (!TryGetType(SymbolNames.NonActionAttribute, out var nonActionAttribute)) 277var disposable = compilation.GetSpecialType(SpecialType.System_IDisposable); 298bool TryGetType(string typeName, out INamedTypeSymbol typeSymbol) 305public INamedTypeSymbol BindAttribute { get; } 306public INamedTypeSymbol ControllerAttribute { get; } 307public INamedTypeSymbol FromBodyAttribute { get; } 308public INamedTypeSymbol IApiBehaviorMetadata { get; } 309public INamedTypeSymbol IBinderTypeProviderMetadata { get; } 310public INamedTypeSymbol IModelNameProvider { get; } 311public INamedTypeSymbol NonControllerAttribute { get; } 312public INamedTypeSymbol NonActionAttribute { get; }
ViewFeaturesAnalyzerContext.cs (3)
22public INamedTypeSymbol HtmlHelperType { get; } 24public INamedTypeSymbol HtmlHelperPartialExtensionsType { get; } 26private INamedTypeSymbol GetType(string name) => Context.Compilation.GetTypeByMetadataName(name);
Microsoft.AspNetCore.Mvc.Api.Analyzers (59)
ActualApiResponseMetadataFactory.cs (1)
65var defaultStatusCodeAttributeSymbol = symbolCache.DefaultStatusCodeAttribute;
AddResponseTypeAttributeCodeFixAction.cs (2)
135var statusCodesType = semanticModel.Compilation.GetTypeByMetadataName(ApiSymbolNames.HttpStatusCodes); 147private static Dictionary<int, string> GetStatusCodeConstants(INamedTypeSymbol statusCodesType)
ApiControllerSymbolCache.cs (46)
15if (!TryGetType(ApiSymbolNames.ApiConventionMethodAttribute, out var apiConventionMethodAttribute)) 20if (!TryGetType(ApiSymbolNames.ApiConventionNameMatchAttribute, out var apiConventionNameMatchAttribute)) 25if (!TryGetType(ApiSymbolNames.ApiConventionTypeAttribute, out var apiConventionTypeAttribute)) 30if (!TryGetType(ApiSymbolNames.ApiConventionTypeMatchAttribute, out var apiConventionTypeMatchAttribute)) 35if (!TryGetType(ApiSymbolNames.ControllerAttribute, out var controllerAttribute)) 40if (!TryGetType(ApiSymbolNames.DefaultStatusCodeAttribute, out var defaultStatusCodeAttribute)) 45if (!TryGetType(ApiSymbolNames.IActionResult, out var iActionResult)) 50if (!TryGetType(ApiSymbolNames.IApiBehaviorMetadata, out var iApiBehaviorMetadata)) 55if (!TryGetType(ApiSymbolNames.ModelStateDictionary, out var modelStateDictionary)) 60if (!TryGetType(ApiSymbolNames.NonActionAttribute, out var nonActionAttribute)) 65if (!TryGetType(ApiSymbolNames.NonControllerAttribute, out var nonControllerAttribute)) 70if (!TryGetType(ApiSymbolNames.ProblemDetails, out var problemDetails)) 75if (!TryGetType(ApiSymbolNames.ProducesDefaultResponseTypeAttribute, out var producesDefaultResponseTypeAttribute)) 80if (!TryGetType(ApiSymbolNames.ProducesErrorResponseTypeAttribute, out var producesErrorResponseTypeAttribute)) 85if (!TryGetType(ApiSymbolNames.ProducesResponseTypeAttribute, out var producesResponseTypeAttribute)) 90var statusCodeActionResult = compilation.GetTypeByMetadataName(ApiSymbolNames.IStatusCodeActionResult); 97var disposable = compilation.GetSpecialType(SpecialType.System_IDisposable); 126bool TryGetType(string typeName, out INamedTypeSymbol typeSymbol) 134INamedTypeSymbol apiConventionMethodAttribute, 135INamedTypeSymbol apiConventionNameMatchAttribute, 136INamedTypeSymbol apiConventionTypeAttribute, 137INamedTypeSymbol apiConventionTypeMatchAttribute, 138INamedTypeSymbol controllerAttribute, 139INamedTypeSymbol defaultStatusCodeAttribute, 140INamedTypeSymbol actionResult, 141INamedTypeSymbol apiBehaviorMetadata, 145INamedTypeSymbol nonActionAttribute, 146INamedTypeSymbol nonControllerAttribute, 147INamedTypeSymbol problemDetails, 148INamedTypeSymbol producesDefaultResponseTypeAttribute, 149INamedTypeSymbol producesResponseTypeAttribute, 150INamedTypeSymbol producesErrorResponseTypeAttribute) 171public INamedTypeSymbol ApiConventionMethodAttribute { get; } 173public INamedTypeSymbol ApiConventionNameMatchAttribute { get; } 175public INamedTypeSymbol ApiConventionTypeAttribute { get; } 177public INamedTypeSymbol ApiConventionTypeMatchAttribute { get; } 179public INamedTypeSymbol ControllerAttribute { get; } 181public INamedTypeSymbol DefaultStatusCodeAttribute { get; } 183public INamedTypeSymbol IActionResult { get; } 185public INamedTypeSymbol IApiBehaviorMetadata { get; } 193public INamedTypeSymbol NonActionAttribute { get; } 195public INamedTypeSymbol NonControllerAttribute { get; } 197public INamedTypeSymbol ProblemDetails { get; } 199public INamedTypeSymbol ProducesDefaultResponseTypeAttribute { get; } 201public INamedTypeSymbol ProducesResponseTypeAttribute { get; } 203public INamedTypeSymbol ProducesErrorResponseTypeAttribute { get; }
src\Shared\Roslyn\CodeAnalysisExtensions.cs (5)
109foreach (var @interface in target.AllInterfaces) 177public static INamedTypeSymbol? GetReceiverType( 194return invocation.TargetMethod.Parameters[0].Type as INamedTypeSymbol; 200static INamedTypeSymbol? GetReceiverType( 206return typeInfo?.Type as INamedTypeSymbol;
src\Shared\Roslyn\MvcFacts.cs (5)
11public static bool IsController(INamedTypeSymbol type, INamedTypeSymbol controllerAttribute, INamedTypeSymbol nonControllerAttribute) 57public static bool IsControllerAction(IMethodSymbol method, INamedTypeSymbol nonActionAttribute, IMethodSymbol disposableDispose) 101private static INamedTypeSymbol GetDeclaringType(IMethodSymbol method)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (16)
HubClientProxyGenerator.Parser.cs (5)
106var hubConnectionSymbol = symbol.Parameters[0].Type as INamedTypeSymbol; 210var registerCallbackProviderClassSymbol = (INamedTypeSymbol)registerCallbackProviderMethodSymbol.ContainingSymbol; 301if (!(member.ReturnsVoid || member.ReturnType is INamedTypeSymbol { Arity: 0, Name: "Task" }))
HubServerProxyGenerator.Parser.cs (11)
96var hubConnectionSymbol = symbol.Parameters[0].Type as INamedTypeSymbol; 199var getProxyClassSymbol = (INamedTypeSymbol)getProxyMethodSymbol.ContainingSymbol; 278if (member.ReturnType is INamedTypeSymbol { Arity: 1 } rtype) 283if (member.ReturnType is INamedTypeSymbol { Arity: 1, Name: "Task" } a 284&& a.TypeArguments[0] is INamedTypeSymbol { Arity: 1, Name: "ChannelReader" } b) 289else if (member.ReturnType is INamedTypeSymbol { Arity: 1, Name: "IAsyncEnumerable" } c) 312case INamedTypeSymbol { Arity: 1, Name: "ChannelReader" }: 315case INamedTypeSymbol { Arity: 1, Name: "IAsyncEnumerable" }: 323member.ReturnType is not INamedTypeSymbol { Name: "Task" or "ValueTask" })
Microsoft.CodeAnalysis (133)
CodeGen\PermissionSetAttribute.cs (1)
85Debug.Assert(((INamedTypeSymbol)iSymbol).GetMembers(HexPropertyName).Any(
Compilation\Compilation.cs (43)
345public INamedTypeSymbol CreateErrorTypeSymbol(INamespaceOrTypeSymbol? container, string name, int arity) 360protected abstract INamedTypeSymbol CommonCreateErrorTypeSymbol(INamespaceOrTypeSymbol? container, string name, int arity); 971public INamedTypeSymbol GetSpecialType(SpecialType specialType) 978return (INamedTypeSymbol)CommonGetSpecialType(specialType).GetITypeSymbol(); 1012public INamedTypeSymbol ObjectType { get { return CommonObjectType; } } 1013protected abstract INamedTypeSymbol CommonObjectType { get; } 1032public INamedTypeSymbol? ScriptClass { get { return CommonScriptClass; } } 1033protected abstract INamedTypeSymbol? CommonScriptClass { get; } 1040protected INamedTypeSymbol? CommonBindScriptClass() 1059foreach (INamedTypeSymbol candidate in container.GetTypeMembers(parts[parts.Length - 1])) 1132ImmutableArray<INamedTypeSymbol> callingConventionTypes = default) 1143ImmutableArray<INamedTypeSymbol> callingConventionTypes); 1149public INamedTypeSymbol CreateNativeIntegerTypeSymbol(bool signed) 1154protected abstract INamedTypeSymbol CommonCreateNativeIntegerTypeSymbol(bool signed); 1162private ConcurrentCache<string, INamedTypeSymbol?>? _getTypeCache; 1164private ConcurrentCache<string, ImmutableArray<INamedTypeSymbol>>? _getTypesCache; 1206public INamedTypeSymbol? GetTypeByMetadataName(string fullyQualifiedMetadataName) 1209ref _getTypeCache, static () => new ConcurrentCache<string, INamedTypeSymbol?>(50, ReferenceEqualityComparer.Instance)); 1211if (!getTypeCache.TryGetValue(fullyQualifiedMetadataName, out INamedTypeSymbol? val)) 1216|| !getTypeCache.TryGetValue(fullyQualifiedMetadataName, out var addedType) // Could fail if the type was already evicted from the cache 1222protected abstract INamedTypeSymbol? CommonGetTypeByMetadataName(string metadataName); 1237public ImmutableArray<INamedTypeSymbol> GetTypesByMetadataName(string fullyQualifiedMetadataName) 1240ref _getTypesCache, static () => new ConcurrentCache<string, ImmutableArray<INamedTypeSymbol>>(50, ReferenceEqualityComparer.Instance)); 1242if (!getTypesCache.TryGetValue(fullyQualifiedMetadataName, out ImmutableArray<INamedTypeSymbol> val)) 1253ImmutableArray<INamedTypeSymbol> getTypesByMetadataNameImpl() 1255ArrayBuilder<INamedTypeSymbol>? typesByMetadataName = null; 1278return typesByMetadataName?.ToImmutableAndFree() ?? ImmutableArray<INamedTypeSymbol>.Empty; 1280void addIfNotNull(INamedTypeSymbol? toAdd) 1284typesByMetadataName ??= ArrayBuilder<INamedTypeSymbol>.GetInstance(); 1295public INamedTypeSymbol CreateTupleTypeSymbol( 1336public INamedTypeSymbol CreateTupleTypeSymbol( 1400protected abstract INamedTypeSymbol CommonCreateTupleTypeSymbol( 1412public INamedTypeSymbol CreateTupleTypeSymbol( 1413INamedTypeSymbol underlyingType, 1432public INamedTypeSymbol CreateTupleTypeSymbol( 1433INamedTypeSymbol underlyingType, 1440protected abstract INamedTypeSymbol CommonCreateTupleTypeSymbol( 1441INamedTypeSymbol underlyingType, 1452public INamedTypeSymbol CreateAnonymousTypeSymbol( 1521public INamedTypeSymbol CreateAnonymousTypeSymbol( 1530protected abstract INamedTypeSymbol CommonCreateAnonymousTypeSymbol( 1612/// compilation. <paramref name="within"/> is required to be an <see cref="INamedTypeSymbol"/> or <see cref="IAssemblySymbol"/>. 1640if (!(within is INamedTypeSymbol || within is IAssemblySymbol))
Compilation\Expression.cs (1)
43return SynthesizeNumeric(((INamedTypeSymbol)type).EnumUnderlyingType!, value);
Compilation\SemanticModel.cs (2)
409/// <item>in the case of type declarations with a primary constructor, both the <see cref="INamedTypeSymbol"/> 430/// <item>in the case of type declarations with a primary constructor, both the <see cref="INamedTypeSymbol"/>
DiagnosticAnalyzer\AnalyzerDriver.cs (3)
313private INamedTypeSymbol? _lazyGeneratedCodeAttribute; 1318static ImmutableHashSet<ISymbol> computeGeneratedCodeSymbolsInTree(SyntaxTree tree, Compilation compilation, INamedTypeSymbol generatedCodeAttribute, CancellationToken cancellationToken) 1699for (var type = symbol.ContainingType; type != null; type = type.ContainingType)
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (2)
188processMembers(((INamedTypeSymbol)symbol).GetMembers()); 213if (member is INamedTypeSymbol typeMember)
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 640INamedTypeSymbol typeSymbol = GetFirstMatchingNamedType(candidateMembers, arity); 821private static INamedTypeSymbol GetFirstMatchingNamedType(ImmutableArray<ISymbol> candidateMembers, int arity) 823return (INamedTypeSymbol)candidateMembers.FirstOrDefault(s => 825((INamedTypeSymbol)s).Arity == arity); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n) 854private static int GetTypeParameterCount(INamedTypeSymbol typeSymbol)
DocumentationCommentId.cs (16)
261private static int GetTotalTypeParameterCount(INamedTypeSymbol? symbol) 267symbol = symbol.ContainingSymbol as INamedTypeSymbol; 323/// This will always succeed for a <see cref="INamespaceSymbol"/> or <see cref="INamedTypeSymbol"/>. It may not 381public override void VisitNamedType(INamedTypeSymbol symbol) 521public override bool VisitNamedType(INamedTypeSymbol symbol) 583public override bool VisitNamedType(INamedTypeSymbol symbol) 657Debug.Assert(symbol.ContainingSymbol is null or INamedTypeSymbol or IMethodSymbol); 674var b = GetTotalTypeParameterCount(container as INamedTypeSymbol); 1001var typeContext = methodContext != null ? methodContext.ContainingType : typeParameterContext as INamedTypeSymbol; 1052results[i] = ((INamedTypeSymbol)results[i]).Construct(typeArgs); 1171var namedType = (INamedTypeSymbol)symbol; 1194if (symbol.Kind == SymbolKind.Namespace || (symbol.Kind == SymbolKind.NamedType && ((INamedTypeSymbol)symbol).Arity == 0)) 1410private static ITypeParameterSymbol? GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n) 1428private static int GetTypeParameterCount(INamedTypeSymbol typeSymbol)
Operations\ControlFlowGraphBuilder.Context.cs (2)
21public readonly INamedTypeSymbol? AnonymousType; 24internal Context(IOperation? implicitInstance, INamedTypeSymbol? anonymousType, ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>> anonymousTypePropertyValues)
Operations\ControlFlowGraphBuilder.cs (9)
2411INamedTypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 2469INamedTypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 2570INamedTypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 3130((INamedTypeSymbol)operation.Target.Type!).TypeArguments[0].Equals(operation.Type)) 5466INamedTypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 6379_currentImplicitInstance = new ImplicitInstanceInfo((INamedTypeSymbol)operation.Type); 7740INamedTypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 8021var type = (INamedTypeSymbol)operation.Type;
Operations\ControlFlowGraphBuilder.ImplicitInstanceInfo.cs (2)
28public INamedTypeSymbol? AnonymousType { get; } 43public ImplicitInstanceInfo(INamedTypeSymbol currentInitializedAnonymousType)
SourceGeneration\GeneratedCodeUtilities.cs (1)
19ISymbol symbol, INamedTypeSymbol generatedCodeAttribute)
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (2)
25/// the <see cref="INamedTypeSymbol"/> for <c>"C"</c>. 65/// cref="SyntaxNode"/>s if that node has an attribute on it that binds to a <see cref="INamedTypeSymbol"/> with the
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (8)
125protected abstract void AddExplicitlyCastedLiteralValue(INamedTypeSymbol namedType, SpecialType type, object value); 144AddEnumConstantValue((INamedTypeSymbol)type, constantValue, preferNumericValueOrExpandedFlagsForEnum); 152private void AddEnumConstantValue(INamedTypeSymbol enumType, object constantValue, bool preferNumericValueOrExpandedFlags) 195var type = ctor.ContainingType; 212private void AddFlagsEnumConstantValue(INamedTypeSymbol enumType, object constantValue, bool preferNumericValueOrExpandedFlags) 231INamedTypeSymbol enumType, object constantValue, 312INamedTypeSymbol enumType, 333private void AddNonFlagsEnumConstantValue(INamedTypeSymbol enumType, object constantValue)
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (2)
21protected bool NameBoundSuccessfullyToSameSymbol(INamedTypeSymbol symbol) 71arity = ((INamedTypeSymbol)candidate).Arity;
Symbols\Attributes\CommonAttributeData.cs (2)
27public INamedTypeSymbol? AttributeClass { get { return CommonAttributeClass; } } 28protected abstract INamedTypeSymbol? CommonAttributeClass { get; }
Symbols\CustomModifier.cs (1)
21public abstract INamedTypeSymbol Modifier { get; }
Symbols\IAssemblySymbol.cs (3)
63INamedTypeSymbol? GetTypeByMetadataName(string fullyQualifiedMetadataName); 76INamedTypeSymbol? ResolveForwardedType(string fullyQualifiedMetadataName); 81ImmutableArray<INamedTypeSymbol> GetForwardedTypes();
Symbols\IMethodSymbol.cs (2)
227ImmutableArray<INamedTypeSymbol> UnmanagedCallingConventionTypes { get; } 290INamedTypeSymbol? AssociatedAnonymousDelegate { get; }
Symbols\INamedTypeSymbol.cs (8)
101new INamedTypeSymbol OriginalDefinition { get; } 116INamedTypeSymbol? EnumUnderlyingType { get; } 123INamedTypeSymbol ConstructedFrom { get; } 130INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments); 135INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations); 140INamedTypeSymbol ConstructUnboundGenericType(); 179INamedTypeSymbol? TupleUnderlyingType { get; } 198INamedTypeSymbol? NativeIntegerUnderlyingType { get; }
Symbols\INamespaceOrTypeSymbol.cs (3)
39ImmutableArray<INamedTypeSymbol> GetTypeMembers(); 47ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name); 55ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name, int arity);
Symbols\ISymbol.cs (2)
85/// Gets the <see cref="INamedTypeSymbol"/> for the containing type. Returns null if the 88INamedTypeSymbol ContainingType { get; }
Symbols\ISymbolExtensions.cs (2)
125return type is INamedTypeSymbol 152if (scopeType is not INamedTypeSymbol { Name: WellKnownMemberNames.LockScopeTypeName, Arity: 0, IsValueType: true, IsRefLikeType: true, DeclaredAccessibility: Accessibility.Public } ||
Symbols\ITypeParameterSymbol.cs (1)
43INamedTypeSymbol? DeclaringType { get; }
Symbols\ITypeSymbol.cs (5)
32INamedTypeSymbol? BaseType { get; } 39ImmutableArray<INamedTypeSymbol> Interfaces { get; } 52ImmutableArray<INamedTypeSymbol> AllInterfaces { get; } 216return ((INamedTypeSymbol)type).TypeArguments[0]; 246return (type as INamedTypeSymbol)?.EnumUnderlyingType;
Symbols\SymbolVisitor.cs (1)
73public virtual void VisitNamedType(INamedTypeSymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
76public virtual TResult? VisitNamedType(INamedTypeSymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
81public virtual TResult VisitNamedType(INamedTypeSymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (495)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
79return typeofOperation.TypeOperand is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 0;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
101var ienumerableOfT = collectionType.AllInterfaces.FirstOrDefault(i => i.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T);
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (3)
11private readonly INamedTypeSymbol? _iSerializableType = compilation.ISerializableType(); 12private readonly INamedTypeSymbol? _serializationInfoType = compilation.SerializationInfoType(); 13private readonly INamedTypeSymbol? _streamingContextType = compilation.StreamingContextType();
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (7)
21private readonly INamedTypeSymbol? _equalityComparerType; 23public readonly INamedTypeSymbol SystemHashCodeType; 27INamedTypeSymbol? equalityComparerType, INamedTypeSymbol systemHashCodeType) 38var objectType = compilation.GetSpecialType(SpecialType.System_Object); 41var equalityComparerType = compilation.GetBestTypeByMetadataName(typeof(EqualityComparer<>).FullName!); 46var systemHashCodeType = compilation.GetBestTypeByMetadataName("System.HashCode");
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (9)
45var threadStaticAttribute = compilation.ThreadStaticAttributeType(); 46var dataContractAttribute = compilation.DataContractAttribute(); 47var dataMemberAttribute = compilation.DataMemberAttribute(); 48var inlineArrayAttribute = compilation.InlineArrayAttributeType(); 62if (!ShouldAnalyze(context, (INamedTypeSymbol)context.Symbol)) 114var members = ((INamedTypeSymbol)symbolEndContext.Symbol).GetMembers(); 136bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 188static bool IsDataContractSerializable(IFieldSymbol symbol, INamedTypeSymbol? dataContractAttribute, INamedTypeSymbol? dataMemberAttribute)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (2)
60var suppressMessageAttributeType = context.Compilation.SuppressMessageAttributeType(); 70protected sealed class CompilationAnalyzer(Compilation compilation, INamedTypeSymbol suppressMessageAttributeType)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
742var suppressMessageAttributeType = semanticModel.Compilation.SuppressMessageAttributeType(); 825INamedTypeSymbol suppressMessageAttributeType,
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (2)
16internal sealed partial class SuppressMessageAttributeState(Compilation compilation, INamedTypeSymbol suppressMessageAttributeType) 24private readonly INamedTypeSymbol _suppressMessageAttributeType = suppressMessageAttributeType;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (25)
65protected abstract IEnumerable<TTypeDeclarationSyntax> GetTypeDeclarations(INamedTypeSymbol namedType, CancellationToken cancellationToken); 113private readonly INamedTypeSymbol? _taskType; 114private readonly INamedTypeSymbol? _genericTaskType; 115private readonly INamedTypeSymbol? _debuggerDisplayAttributeType; 116private readonly INamedTypeSymbol? _structLayoutAttributeType; 117private readonly INamedTypeSymbol? _inlineArrayAttributeType; 118private readonly INamedTypeSymbol? _eventArgsType; 119private readonly INamedTypeSymbol? _iNotifyCompletionType; 121private readonly ImmutableHashSet<INamedTypeSymbol?> _attributeSetForMethodsToIgnore; 138_attributeSetForMethodsToIgnore = ImmutableHashSet.CreateRange<INamedTypeSymbol?>(GetAttributesForMethodsToIgnore(compilation)); 144private static IEnumerable<INamedTypeSymbol> GetAttributesForMethodsToIgnore(Compilation compilation) 148var onDeserializingAttribute = compilation.OnDeserializingAttribute(); 154var onDeserializedAttribute = compilation.OnDeserializedAttribute(); 160var onSerializingAttribute = compilation.OnSerializingAttribute(); 166var onSerializedAttribute = compilation.OnSerializedAttribute(); 172var comRegisterFunctionAttribute = compilation.ComRegisterFunctionAttribute(); 178var comUnregisterFunctionAttribute = compilation.ComUnregisterFunctionAttribute(); 209if (!ShouldAnalyze(symbolStartContext, (INamedTypeSymbol)symbolStartContext.Symbol)) 256bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 474var namedType = (INamedTypeSymbol)symbolEndContext.Symbol; 616private static bool HasSyntaxErrors(INamedTypeSymbol namedTypeSymbol, CancellationToken cancellationToken) 630INamedTypeSymbol namedTypeSymbol, 710private void AddDebuggerDisplayAttributeArguments(INamedTypeSymbol namedTypeSymbol, ArrayBuilder<string> builder) 718case INamedTypeSymbol nestedType:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
488var interpolatedStringHandlerAttribute = context.Compilation.InterpolatedStringHandlerAttributeType();
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (15)
25INamedTypeSymbol? eventArgsType, 26ImmutableHashSet<INamedTypeSymbol> attributeSetForMethodsToIgnore, 28INamedTypeSymbol? iCustomMarshaler, 33private readonly INamedTypeSymbol? _eventArgsType = eventArgsType; 34private readonly ImmutableHashSet<INamedTypeSymbol> _attributeSetForMethodsToIgnore = attributeSetForMethodsToIgnore; 37private readonly INamedTypeSymbol? _iCustomMarshaler = iCustomMarshaler; 52var eventsArgType = context.Compilation.EventArgsType(); 54var iCustomMarshaler = context.Compilation.GetTypeByMetadataName(typeof(ICustomMarshaler).FullName!); 58if (HasSyntaxErrors((INamedTypeSymbol)symbolStartContext.Symbol, symbolStartContext.CancellationToken)) 76static bool HasSyntaxErrors(INamedTypeSymbol namedTypeSymbol, CancellationToken cancellationToken) 111var interpolatedStringHandlerAttribute = context.Compilation.InterpolatedStringHandlerAttributeType(); 124INamedTypeSymbol? interpolatedStringHandlerAttributeType, 177private static IEnumerable<INamedTypeSymbol?> GetAttributesForMethodsToIgnore(Compilation compilation) 196private bool IsUnusedParameterCandidate(IParameterSymbol parameter, INamedTypeSymbol? interpolatedStringHandlerAttributeType, CancellationToken cancellationToken) 293INamedTypeSymbol? interpolatedStringHandlerAttributeType)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (2)
171private static bool IsType<T>(INamedTypeSymbol type, SemanticModel semanticModel) 174private static INamedTypeSymbol? FindType<T>(SemanticModel semanticModel)
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (7)
59if (TryGetEnumerableTypeSymbol(context.Compilation, out var enumerableType) && 69static bool TryGetEnumerableTypeSymbol(Compilation compilation, [NotNullWhen(true)] out INamedTypeSymbol? enumerableType) 75static bool TryGetLinqWhereExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 78static bool TryGetLinqSelectExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 81static bool TryGetLinqExtensionMethod(INamedTypeSymbol enumerableType, string name, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 85if (linqMethodSymbol.Parameters is [_, { Type: INamedTypeSymbol { Arity: 2 } }]) 98static bool TryGetLinqMethodsThatDoNotReturnEnumerables(INamedTypeSymbol enumerableType, out ImmutableArray<IMethodSymbol> linqMethods)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (4)
108var namedType = (INamedTypeSymbol)context.Symbol; 182bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 335INamedTypeSymbol containingType,
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
109var nullableType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Nullable<>).FullName!);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (5)
85INamedTypeSymbol? expressionType, 101var ienumerableType = context.Compilation.IEnumerableType(); 118var expressionType = context.Compilation.ExpressionOfTType(); 127INamedTypeSymbol ienumerableType, 128INamedTypeSymbol? expressionType)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
77INamedTypeSymbol containingType, IFieldSymbol unnamedField, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
34var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object);
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (4)
93var expressionType = context.Compilation.ExpressionOfTType(); 95var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object); 112INamedTypeSymbol? expressionType, 162if (type is not INamedTypeSymbol namedType || namedType.ConstructedFrom.SpecialType != SpecialType.System_Nullable_T)
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (2)
65var expressionType = startContext.Compilation.ExpressionOfTType(); 70private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
73var formatProviderType = startContext.Compilation.GetTypeByMetadataName(typeof(System.IFormatProvider).FullName!); 89private void AnalyzeNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol formatProviderType) 297var containingType = symbolInfo.Symbol.ContainingType;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 640INamedTypeSymbol typeSymbol = GetFirstMatchingNamedType(candidateMembers, arity); 821private static INamedTypeSymbol GetFirstMatchingNamedType(ImmutableArray<ISymbol> candidateMembers, int arity) 823return (INamedTypeSymbol)candidateMembers.FirstOrDefault(s => 825((INamedTypeSymbol)s).Arity == arity); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n) 854private static int GetTypeParameterCount(INamedTypeSymbol typeSymbol)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
19ISymbol symbol, INamedTypeSymbol generatedCodeAttribute)
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (3)
67if (symbol is INamedTypeSymbol or 76var type = symbol as INamedTypeSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CompilationExtensions.cs (5)
36public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 38INamedTypeSymbol? type = null; 40foreach (var currentType in compilation.GetTypesByMetadataName(fullyQualifiedMetadataName)) 75foreach (var candidateTopLevelType in compilation.SourceModule.GlobalNamespace.GetTypeMembers(WellKnownMemberNames.TopLevelStatementsEntryPointTypeName, arity: 0)) 87public static INamedTypeSymbol? TryGetCallingConventionSymbol(this Compilation compilation, string callingConvention)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (67)
72public static INamedTypeSymbol? ArrayType(this Compilation compilation) 75public static INamedTypeSymbol? AttributeType(this Compilation compilation) 78public static INamedTypeSymbol? ExceptionType(this Compilation compilation) 81public static INamedTypeSymbol? DebuggerDisplayAttributeType(this Compilation compilation) 84public static INamedTypeSymbol? StructLayoutAttributeType(this Compilation compilation) 87public static INamedTypeSymbol? InlineArrayAttributeType(this Compilation compilation) 90public static INamedTypeSymbol? DesignerCategoryAttributeType(this Compilation compilation) 93public static INamedTypeSymbol? DesignerGeneratedAttributeType(this Compilation compilation) 96public static INamedTypeSymbol? HideModuleNameAttribute(this Compilation compilation) 99public static INamedTypeSymbol? ThreadStaticAttributeType(this Compilation compilation) 102public static INamedTypeSymbol? EventArgsType(this Compilation compilation) 105public static INamedTypeSymbol? NotImplementedExceptionType(this Compilation compilation) 108public static INamedTypeSymbol? EqualityComparerOfTType(this Compilation compilation) 111public static INamedTypeSymbol? ActionType(this Compilation compilation) 114public static INamedTypeSymbol? ExpressionOfTType(this Compilation compilation) 117public static INamedTypeSymbol? EditorBrowsableAttributeType(this Compilation compilation) 120public static INamedTypeSymbol? EditorBrowsableStateType(this Compilation compilation) 123public static INamedTypeSymbol? TaskType(this Compilation compilation) 126public static INamedTypeSymbol? TaskOfTType(this Compilation compilation) 129public static INamedTypeSymbol? ValueTaskType(this Compilation compilation) 132public static INamedTypeSymbol? ValueTaskOfTType(this Compilation compilation) 135public static INamedTypeSymbol? IEnumerableType(this Compilation compilation) 138public static INamedTypeSymbol? IEnumerableOfTType(this Compilation compilation) 141public static INamedTypeSymbol? IEnumeratorOfTType(this Compilation compilation) 144public static INamedTypeSymbol? IListOfTType(this Compilation compilation) 147public static INamedTypeSymbol? IReadOnlyListOfTType(this Compilation compilation) 150public static INamedTypeSymbol? ISetOfTType(this Compilation compilation) 153public static INamedTypeSymbol? IReadOnlySetOfTType(this Compilation compilation) 156public static INamedTypeSymbol? IAsyncEnumerableOfTType(this Compilation compilation) 159public static INamedTypeSymbol? IAsyncEnumeratorOfTType(this Compilation compilation) 162public static INamedTypeSymbol? ImmutableArrayOfTType(this Compilation compilation) 165public static INamedTypeSymbol? SerializableAttributeType(this Compilation compilation) 168public static INamedTypeSymbol? CoClassType(this Compilation compilation) 171public static INamedTypeSymbol? ComAliasNameAttributeType(this Compilation compilation) 174public static INamedTypeSymbol? SuppressMessageAttributeType(this Compilation compilation) 177public static INamedTypeSymbol? TupleElementNamesAttributeType(this Compilation compilation) 180public static INamedTypeSymbol? NativeIntegerAttributeType(this Compilation compilation) 183public static INamedTypeSymbol? DynamicAttributeType(this Compilation compilation) 186public static INamedTypeSymbol? LazyOfTType(this Compilation compilation) 189public static INamedTypeSymbol? ISerializableType(this Compilation compilation) 192public static INamedTypeSymbol? SerializationInfoType(this Compilation compilation) 195public static INamedTypeSymbol? StreamingContextType(this Compilation compilation) 198public static INamedTypeSymbol? OnDeserializingAttribute(this Compilation compilation) 201public static INamedTypeSymbol? OnDeserializedAttribute(this Compilation compilation) 204public static INamedTypeSymbol? OnSerializingAttribute(this Compilation compilation) 207public static INamedTypeSymbol? OnSerializedAttribute(this Compilation compilation) 210public static INamedTypeSymbol? ComRegisterFunctionAttribute(this Compilation compilation) 213public static INamedTypeSymbol? ComUnregisterFunctionAttribute(this Compilation compilation) 216public static INamedTypeSymbol? ConditionalAttribute(this Compilation compilation) 219public static INamedTypeSymbol? ObsoleteAttribute(this Compilation compilation) 222public static INamedTypeSymbol? SystemCompositionImportingConstructorAttribute(this Compilation compilation) 225public static INamedTypeSymbol? SystemComponentModelCompositionImportingConstructorAttribute(this Compilation compilation) 228public static INamedTypeSymbol? SystemIDisposableType(this Compilation compilation) 231public static INamedTypeSymbol? NotNullAttribute(this Compilation compilation) 234public static INamedTypeSymbol? MaybeNullAttribute(this Compilation compilation) 237public static INamedTypeSymbol? MaybeNullWhenAttribute(this Compilation compilation) 240public static INamedTypeSymbol? AllowNullAttribute(this Compilation compilation) 243public static INamedTypeSymbol? DisallowNullAttribute(this Compilation compilation) 246public static INamedTypeSymbol? DataMemberAttribute(this Compilation compilation) 249public static INamedTypeSymbol? DataContractAttribute(this Compilation compilation) 252public static INamedTypeSymbol? AsyncMethodBuilderAttribute(this Compilation compilation) 255public static INamedTypeSymbol? CancellationTokenType(this Compilation compilation) 258public static INamedTypeSymbol? ValueTupleType(this Compilation compilation, int arity) 261public static INamedTypeSymbol? ListOfTType(this Compilation compilation) 264public static INamedTypeSymbol? ReadOnlySpanOfTType(this Compilation compilation) 267public static INamedTypeSymbol? SpanOfTType(this Compilation compilation) 270public static INamedTypeSymbol? InterpolatedStringHandlerAttributeType(this Compilation compilation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (4)
43public static bool HasEventHandlerSignature(this IMethodSymbol method, [NotNullWhen(returnValue: true)] INamedTypeSymbol? eventArgsType) 102public static bool IsEntryPoint(this IMethodSymbol methodSymbol, INamedTypeSymbol? taskType, INamedTypeSymbol? genericTaskType) 118if (method.ReturnType is not INamedTypeSymbol { Arity: 0 })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (73)
20public static IEnumerable<INamedTypeSymbol> GetBaseTypesAndThis(this INamedTypeSymbol? namedType) 22var current = namedType; 30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol) 36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol) 42private static Stack<INamedTypeSymbol> GetContainmentStack(INamedTypeSymbol? symbol) 44var stack = new Stack<INamedTypeSymbol>(); 45for (var current = symbol; current != null; current = current.ContainingType) 53public static bool IsContainedWithin([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol, INamedTypeSymbol outer) 56for (var current = symbol; current != null; current = current.ContainingType) 67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol) 78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member) 82this INamedTypeSymbol classOrStructType, 84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType) 128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 151this INamedTypeSymbol classOrStructType, 153Func<INamedTypeSymbol, ISymbol, bool> isValid, 176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers( 177this INamedTypeSymbol classOrStructType, 178IEnumerable<INamedTypeSymbol> interfaces, 194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within) 246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis( 247this INamedTypeSymbol classOrStructType, 248IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis( 265this INamedTypeSymbol classOrStructType, 266IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers( 284this INamedTypeSymbol classOrStructType, 285IEnumerable<INamedTypeSymbol> interfaces, 297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within) 324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers( 325this INamedTypeSymbol classOrStructType, 326IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented, 328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 358private static ImmutableArray<INamedTypeSymbol> GetTypesToImplement( 359INamedTypeSymbol classOrStructType, 360IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 369private static ImmutableArray<INamedTypeSymbol> GetAbstractClassesToImplement( 370IEnumerable<INamedTypeSymbol> abstractClasses) 377private static ImmutableArray<INamedTypeSymbol> GetInterfacesToImplement( 378INamedTypeSymbol classOrStructType, 379IEnumerable<INamedTypeSymbol> interfaces, 386var interfacesToImplement = new List<INamedTypeSymbol>( 391var baseType = classOrStructType.BaseType; 402this INamedTypeSymbol classOrStructType, 403INamedTypeSymbol interfaceType, 404Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented, 405Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 406Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 448this INamedTypeSymbol attributeSymbol, 454var systemAttributeType = compilation.AttributeType(); 456foreach (var type in attributeSymbol.GetBaseTypesAndThis()) 516private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within) 530this INamedTypeSymbol containingType, CancellationToken cancellationToken) 547foreach (var type in baseTypes) 568Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken) 589Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken) 611Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, 612INamedTypeSymbol type, ref int index, CancellationToken cancellationToken) 625private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType) 667public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments) 670public static bool IsCollectionBuilderAttribute([NotNullWhen(true)] this INamedTypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (3)
89public static IEnumerable<INamedTypeSymbol> GetAllTypes( 105var namedType = (INamedTypeSymbol)current;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
95foreach (var baseType in symbol.ContainingType.GetBaseTypes()) 104bool TryFindLooseMatch(ISymbol symbol, INamedTypeSymbol baseType, [NotNullWhen(true)] out ISymbol? looseMatch) 153foreach (var iface in symbol.ContainingType.AllInterfaces) 214public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol) 216if (symbol is INamedTypeSymbol namedType) 309=> symbol is INamedTypeSymbol { IsAnonymousType: true }; 352SymbolKind.NamedType => ((INamedTypeSymbol)symbol).Arity, 433INamedTypeSymbol nt => nt.TypeParameters, 454INamedTypeSymbol nt => nt.TypeArguments, 463var containingType = symbol.ContainingType; 504var delegateType = compilation.GetTypeByMetadataName(method.ReturnsVoid 548foreach (var type in namespaceOrType.GetAllTypes(cancellationToken)) 562return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName); 812public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
54public override bool VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (26)
25else if (within is INamedTypeSymbol namedType) 52INamedTypeSymbol within, 65INamedTypeSymbol within, 90Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 122return IsNamedTypeAccessible((INamedTypeSymbol)symbol, within); 174private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within) 176Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 201var containingType = type.ContainingType; 214Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 216var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly; 245INamedTypeSymbol containingType, 251Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 256var originalContainingType = containingType.OriginalDefinition; 257var withinNamedType = within as INamedTypeSymbol; 258var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly; 331INamedTypeSymbol? withinType, 334INamedTypeSymbol originalContainingType, 372var current = withinType.OriginalDefinition; 408INamedTypeSymbol originalContainingType) 410Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 412var withinType = within as INamedTypeSymbol; 426INamedTypeSymbol withinType, 427INamedTypeSymbol originalContainingType) 434var current = withinType.OriginalDefinition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeGenerator.cs (1)
11ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (4)
12public static INamedTypeSymbol? GetNamedTypeSymbolConstraint(this ITypeParameterSymbol typeParameter) 15private static INamedTypeSymbol? GetNamedTypeSymbol(ITypeSymbol type) 17return type is INamedTypeSymbol 18? (INamedTypeSymbol)type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (1)
41public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (1)
52public override void VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CompilationTypeGenerator.cs (1)
19public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (31)
39public static IList<INamedTypeSymbol> GetAllInterfacesIncludingThis(this ITypeSymbol type) 42if (type is INamedTypeSymbol namedType && namedType.TypeKind == TypeKind.Interface && !allInterfaces.Contains(namedType)) 44var result = new List<INamedTypeSymbol>(allInterfaces.Length + 1) 73underlyingType = ((INamedTypeSymbol)symbol).TypeArguments[0]; 96public static bool IsAnonymousType([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol) 99private static HashSet<INamedTypeSymbol> GetOriginalInterfacesAndTheirBaseInterfaces( 101HashSet<INamedTypeSymbol>? symbols = null) 103symbols ??= new HashSet<INamedTypeSymbol>(SymbolEquivalenceComparer.Instance); 105foreach (var interfaceType in type.Interfaces) 124public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol? type) 126var current = type?.BaseType; 144public static IEnumerable<INamedTypeSymbol> GetContainingTypes(this ITypeSymbol type) 146var current = type.ContainingType; 202var currentBaseType = type.BaseType; 231for (var b = symbol.BaseType; b != null; b = b.BaseType) 319INamedTypeSymbol n => ContainsAnonymousType(n), 324private static bool ContainsAnonymousType(INamedTypeSymbol type) 414public static INamedTypeSymbol? GetDelegateType(this ITypeSymbol? typeSymbol, Compilation compilation) 418var expressionOfT = compilation.ExpressionOfTType(); 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 422return typeArgument as INamedTypeSymbol; 427return typeSymbol as INamedTypeSymbol; 580var n1 = t1 as INamedTypeSymbol; 581var n2 = t2 as INamedTypeSymbol; 633public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type, [NotNullWhen(true)] out INamedTypeSymbol? enumType) 637enumType = (INamedTypeSymbol)type; 747=> type is INamedTypeSymbol 755=> symbol is INamedTypeSymbol 763=> type is INamedTypeSymbol namedType &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (2)
40foreach (var callingConventionType in symbol.Signature.UnmanagedCallingConventionTypes) 48public override Accessibility VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (1)
57public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (1)
40public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (1)
39public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
402var notImplementedExceptionType = compilation.NotImplementedExceptionType(); 451static bool IsThrowNotImplementedOperation(INamedTypeSymbol notImplementedExceptionType, IOperation? operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (4)
83return semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(position, cancellationToken) ?? 87public static INamedTypeSymbol? GetEnclosingNamedType(this SemanticModel semanticModel, int position, CancellationToken cancellationToken) 88=> semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(position, cancellationToken); 190var enumerableType = semanticModel.Compilation.IEnumerableOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (3)
67var containingType = symbol.ContainingType; 89var containingType = symbol.ContainingType; 92foreach (var implementedInterface in implementedInterfaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (3)
69bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol); 90bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken); 109bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, [NotNullWhen(true)] INamedTypeSymbol? expressionType, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
65var anonymousDelegate = methodSymbol.AssociatedAnonymousDelegate;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (5)
14private sealed class AnonymousTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 18public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 35SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 41using var propertyTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 65var anonymousType = reader.Compilation.CreateAnonymousTypeSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (5)
42/// <item>Two <see cref="INamedTypeSymbol"/>s are the "same" if they have 45/// equal <see cref="INamedTypeSymbol.Arity"/> and 46/// the "same" <see cref="INamedTypeSymbol.TypeArguments"/>.</item> 299foreach (var containingType in containingTypeResolution.OfType<INamedTypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (8)
13private sealed class ErrorTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 17public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 22case INamedTypeSymbol parentType: 66SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason) 73using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 93using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 98var originalType = reader.Compilation.CreateErrorTypeSymbol(container, name, arity); 111SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
39var callingConventionModifiers = ImmutableArray<INamedTypeSymbol>.Empty; 42using var modifiersBuilder = reader.ReadSymbolKeyArray<IFunctionPointerTypeSymbol, INamedTypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (12)
13private sealed class NamedTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 17public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 40SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 50using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 91INamedTypeSymbol? contextualType, 127using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 155using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 167PooledArrayBuilder<INamedTypeSymbol> result, 175foreach (var type in container.GetTypeMembers(name, arity)) 197private static INamedTypeSymbol Construct(INamedTypeSymbol type, bool isUnboundGenericType, ITypeSymbol[] typeArguments) 199var currentType = typeArguments.Length > 0 ? type.Construct(typeArguments) : type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (1)
65var delegateInvoke = (eventSymbol.Type as INamedTypeSymbol)?.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
408public override void VisitNamedType(INamedTypeSymbol namedTypeSymbol) 415else if (namedTypeSymbol.IsTupleType && namedTypeSymbol.TupleUnderlyingType is INamedTypeSymbol underlyingType && underlyingType != namedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (9)
16private sealed class TupleTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 20public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 55SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 66SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 80using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 83foreach (var namedType in underlyingTypeResolution.OfType<INamedTypeSymbol>()) 94SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason) 98using var elementTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 122var result = reader.Compilation.CreateTupleTypeSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (5)
416var type = methodSymbol.ContainingType; 417var newType = newMethodSymbol.ContainingType; 490private static bool EnumTypesAreCompatible(INamedTypeSymbol type1, INamedTypeSymbol type2) 995var newSymbolContainingType = newSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
20public static object GetNextEnumValue(INamedTypeSymbol enumType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (12)
147public bool ReturnTypeEquals(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 162public bool Equals(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 168private bool EqualsCore(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 189private static bool IsConstructedFromSelf(INamedTypeSymbol symbol) 211private static OneOrMany<INamedTypeSymbol> Unwrap(INamedTypeSymbol namedType) 217using var builder = TemporaryArray<INamedTypeSymbol>.Empty; 222if (candidate is INamedTypeSymbol candidateType) 241private static TypeKind GetTypeKind(INamedTypeSymbol x)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (65)
21public bool AreEquivalent(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 50return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies); 54return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)y, (INamedTypeSymbol)x, equivalentTypesWithDifferingAssemblies); 64private bool AreArrayAndReadOnlySpanEquivalent(IArrayTypeSymbol array, INamedTypeSymbol readOnlySpanType, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 72internal bool AreEquivalent(CustomModifier x, CustomModifier y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 75internal bool AreEquivalent(ImmutableArray<CustomModifier> x, ImmutableArray<CustomModifier> y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 111private bool AreEquivalentWorker(ISymbol x, ISymbol y, SymbolKind k, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 125SymbolKind.NamedType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies), 126SymbolKind.ErrorType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies), 139private bool ArrayTypesAreEquivalent(IArrayTypeSymbol x, IArrayTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 151private bool FieldsAreEquivalent(IFieldSymbol x, IFieldSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false) 280private bool NamedTypesAreEquivalent(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 300private bool NamedTypesAreEquivalentError(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 302foreach (var type1 in Unwrap(x)) 305foreach (var type2 in Unwrap(y)) 329private bool HandleNamedTypesWorker(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 418private bool HandleTupleTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 463Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, 486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 511private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 564private bool ParametersAreEquivalent(IParameterSymbol x, IParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 574private bool PointerTypesAreEquivalent(IPointerTypeSymbol x, IPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 581private bool FunctionPointerTypesAreEquivalent(IFunctionPointerTypeSymbol x, IFunctionPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 608private bool EventsAreEquivalent(IEventSymbol x, IEventSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 615private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (5)
67SymbolKind.NamedType => CombineHashCodes((INamedTypeSymbol)x, currentHash), 143private int CombineHashCodes(INamedTypeSymbol x, int currentHash) 151if (candidate is INamedTypeSymbol candidateNamedType) 161private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash) 190private int CombineAnonymousTypeHashCode(INamedTypeSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (2)
21Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.SignatureTypeSymbolEquivalenceComparer.cs (2)
16public bool Equals(ITypeSymbol? x, ITypeSymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
Microsoft.CodeAnalysis.CodeStyle.Fixes (286)
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (1)
70foreach (var interfaceType in derivedType.Interfaces)
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (4)
38var attribute = await GetObsoleteAttributeAsync(document, cancellationToken).ConfigureAwait(false); 58private static async Task<INamedTypeSymbol?> GetObsoleteAttributeAsync(Document document, CancellationToken cancellationToken) 61var attribute = compilation.GetTypeByMetadataName(typeof(ObsoleteAttribute).FullName!); 75var obsoleteAttribute = await GetObsoleteAttributeAsync(document, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (3)
164var type = symbol switch 167INamedTypeSymbol namedTypeSymbol => namedTypeSymbol, // Standard object creation expressions 411Document invocationDocument, TArgumentSyntax argument, INamedTypeSymbol containingType, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
28protected abstract bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType); 33protected abstract bool TryInitializeImplicitObjectCreation(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 34protected abstract bool TryInitializeSimpleNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 35protected abstract bool TryInitializeConstructorInitializerGeneration(SemanticDocument document, SyntaxNode constructorInitializer, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 36protected abstract bool TryInitializeSimpleAttributeNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (6)
46public INamedTypeSymbol? TypeToGenerateIn { get; private set; } 306out var token, out var arguments, out var typeToGenerateIn)) 324out var token, out var arguments, out var typeToGenerateIn)) 343out var token, out var arguments, out var typeToGenerateIn)) 404INamedTypeSymbol original, CancellationToken cancellationToken) 407TypeToGenerateIn = definition as INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (2)
136INamedTypeSymbol typeToGenerateIn, 301private static IEnumerable<string> GetUnavailableMemberNames(INamedTypeSymbol typeToGenerateIn)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (1)
23[NotNullWhen(true)] out INamedTypeSymbol? classType);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (5)
19public INamedTypeSymbol? ClassType { get; private set; } 50if (!service.TryInitializeState(semanticDocument, textSpan, cancellationToken, out var classType)) 55var baseType = ClassType.BaseType; 89private static bool FixesError(INamedTypeSymbol classType, INamedTypeSymbol baseType)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (3)
59var classType = _state.ClassType; 74IParameterSymbol parameter, INamedTypeSymbol classType) 80private static Accessibility DetermineAccessibility(IMethodSymbol baseConstructor, INamedTypeSymbol classType)
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.State.cs (4)
19public INamedTypeSymbol TypeToGenerateIn { get; private set; } = null!; 66var sourceType = SymbolFinderInternal.FindSourceDefinition(TypeToGenerateIn, document.Project.Solution, cancellationToken) as INamedTypeSymbol; 115out var typeToGenerateIn, out var isStatic, out var isColorColorCase))
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (13)
33[NotNullWhen(true)] INamedTypeSymbol? typeToGenerateIn, 57INamedTypeSymbol containingType, 60[NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn, 74INamedTypeSymbol containingType, 77out INamedTypeSymbol? typeToGenerateIn, 112underlyingType is INamedTypeSymbol underlyingNamedType) 130typeToGenerateIn = pointerType.PointedAtType as INamedTypeSymbol; 146typeToGenerateIn = attributeType.Type as INamedTypeSymbol; 154typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol; 166typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol; 181out INamedTypeSymbol? typeToGenerateIn, 191: typeInfo.Type as INamedTypeSymbol; 193isStatic = semanticInfo.Symbol is INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn); 27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.State.cs (2)
62out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 86out var identifierToken, out var methodSymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.cs (1)
27INamedTypeSymbol typeToGenerateIn,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (2)
29INamedTypeSymbol typeToGenerateIn, 45INamedTypeSymbol typeToGenerateIn,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
26protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
89out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 218out var typeToGenerateIn, out var isStatic, out _))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
33protected virtual bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
278private bool DerivesFrom(INamedTypeSymbol containingType) 281.OfType<INamedTypeSymbol>()
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (3)
24public INamedTypeSymbol ContainingType { get; protected set; } 25public INamedTypeSymbol TypeToGenerateIn { get; protected set; } 61TypeToGenerateIn = SymbolFinderInternal.FindSourceDefinition(TypeToGenerateIn, document.Project.Solution, cancellationToken) as INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateDeconstructMemberService.cs (1)
17Document document, SyntaxNode targetVariables, INamedTypeSymbol typeToGenerateIn, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (9)
50public override async ValueTask VisitNamedType(INamedTypeSymbol symbol) 74if (symbol.ConstraintTypes.ElementAt(0) is INamedTypeSymbol namedType) 87if (!symbol.ConstraintTypes.All(t => t is INamedTypeSymbol)) 94(INamedTypeSymbol)symbol.ConstraintTypes[0], projects).ConfigureAwait(false); 99(INamedTypeSymbol)symbol.ConstraintTypes[i], projects).ConfigureAwait(false); 110var commonType = commonTypes.First(); 125private async Task<ISet<INamedTypeSymbol>> GetDerivedAndImplementedTypesAsync( 126INamedTypeSymbol constraintType, IImmutableSet<Project> projects) 130var symbol = constraintType;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
175private static bool DerivesFrom(State state, INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (2)
27protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn); 83protected virtual bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (6)
29public INamedTypeSymbol ContainingType { get; private set; } 30public INamedTypeSymbol TypeToGenerateIn { get; private set; } 153TypeToGenerateIn, _document.Project.Solution, cancellationToken) as INamedTypeSymbol; 191out var identifierToken, out var propertySymbol, out var typeToGenerateIn)) 213if (!ContainingType.Interfaces.OfType<INamedTypeSymbol>().Contains(TypeToGenerateIn)) 285out var typeToGenerateIn, out var isStatic, out _))
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (9)
34INamedTypeSymbol classType, INamedTypeSymbol abstractClassType, 35ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers) 41private readonly ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> _unimplementedMembers = unimplementedMembers; 43public readonly INamedTypeSymbol ClassType = classType; 44public readonly INamedTypeSymbol AbstractClassType = abstractClassType; 50if (semanticModel.GetDeclaredSymbol(classNode, cancellationToken) is not INamedTypeSymbol classType) 56var abstractClassType = classType.BaseType; 321constraints.OfType<INamedTypeSymbol>().FirstOrDefault() ??
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (3)
31protected abstract bool TryInitializeState(Document document, SemanticModel model, SyntaxNode interfaceNode, CancellationToken cancellationToken, out SyntaxNode classOrStructDecl, out INamedTypeSymbol classOrStructType, out ImmutableArray<INamedTypeSymbol> interfaceTypes); 35protected abstract SyntaxNode CreateFinalizer(SyntaxGenerator generator, INamedTypeSymbol classType, string disposeMethodDisplayString);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (7)
17INamedTypeSymbol classOrStructType, 18ImmutableArray<INamedTypeSymbol> interfaceTypes, 29public INamedTypeSymbol ClassOrStructType => Info.ClassOrStructType; 30public ImmutableArray<INamedTypeSymbol> InterfaceTypes => Info.InterfaceTypes; 36public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented => Info.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented; 37public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitOrImplicitImplementation => Info.MembersWithoutExplicitOrImplicitImplementation; 40public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitImplementation => Info.MembersWithoutExplicitImplementation;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (6)
20INamedTypeSymbol namedType, 120ISymbol? first, INamedTypeSymbol second, bool supportsImplicitImplementationOfNonPublicInterfaceMembers) 174private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, HashSet<ITypeSymbol> alreadyCheckingTypes) 202if (first is INamedTypeSymbol namedType) 236var idisposableType = disposeMethod.ContainingType; 251var idisposable = compilation.GetSpecialType(SpecialType.System_IDisposable);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (3)
76ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 109ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 352IEnumerable<INamedTypeSymbol> baseTypes)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (5)
46ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 206var gcType = compilation.GetTypeByMetadataName(typeof(GC).FullName!); 236INamedTypeSymbol containingType, 244var boolType = compilation.GetSpecialType(SpecialType.System_Boolean); 258private static string GenerateUniqueNameForDisposedValueField(INamedTypeSymbol containingType, NamingRule rule)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
87private static INamedTypeSymbol[] AttributesToRemove(Compilation compilation) 101INamedTypeSymbol[] attributesToRemove) 135INamedTypeSymbol[] attributesToRemove)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
249private static SyntaxNode TypeExpressionForStaticMemberAccess(SyntaxGenerator generator, INamedTypeSymbol typeSymbol)
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
39if (semanticModel.GetSymbolInfo(node, cancellationToken).Symbol is INamedTypeSymbol type &&
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
58SyntaxEditor editor, SemanticModel semanticModel, INamedTypeSymbol? expressionTypeOpt,
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
74var containingType = accessesBase ? method!.ContainingType : null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (15)
60public TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 89public SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 128protected abstract TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 151public abstract SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 350INamedTypeSymbol namedType => CreateNamedTypeDeclaration(namedType, codeGenerationDestination, info, cancellationToken), 368INamedTypeSymbol namedType => AddNamedType(currentDestination, namedType, info, availableIndices, cancellationToken), 393CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken) 411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken) 420public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken) 456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken) 478return AddNamedTypeAsync(context, destination, (INamedTypeSymbol)namespaceOrType, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (10)
15protected abstract SyntaxNode CreateExplicitlyCastedLiteralValue(SyntaxGenerator generator, INamedTypeSymbol enumType, SpecialType underlyingSpecialType, object constantValue); 16protected abstract bool IsValidName(INamedTypeSymbol enumType, string name); 18public SyntaxNode CreateEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue) 34private static bool IsFlagsEnum(INamedTypeSymbol typeSymbol) 46var type = ctor.ContainingType; 63private SyntaxNode CreateFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue) 75INamedTypeSymbol enumType, 141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType) 171INamedTypeSymbol enumType, 188private SyntaxNode CreateNonFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
150public static IEnumerable<ISymbol> GetMembers(INamedTypeSymbol namedType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (14)
48INamedTypeSymbol? containingType, 153INamedTypeSymbol? containingType, 227INamedTypeSymbol? containingType = null, 255INamedTypeSymbol? containingType = null, 409INamedTypeSymbol attributeClass, 419public static INamedTypeSymbol CreateNamedTypeSymbol( 425INamedTypeSymbol? baseType = null, 426ImmutableArray<INamedTypeSymbol> interfaces = default, 438public static INamedTypeSymbol CreateNamedTypeSymbol( 444INamedTypeSymbol? baseType = null, 445ImmutableArray<INamedTypeSymbol> interfaces = default, 456members.WhereAsArray(m => m is not INamedTypeSymbol), 457members.OfType<INamedTypeSymbol>().Select(n => n.ToCodeGenerationSymbol()).ToImmutableArray(), 524INamedTypeSymbol? containingType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (8)
30public static Task<Document> AddEventDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 37public static Task<Document> AddFieldDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken) 44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken) 51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken) 58public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 86public static Task<Document> AddMemberDeclarationsAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (10)
44SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 74TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 134Task<Document> AddEventAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken); 139Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken); 144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken); 149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken); 154Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (2)
11public static CodeGenerationAbstractNamedTypeSymbol ToCodeGenerationSymbol(this INamedTypeSymbol namedType) 32namedType.GetMembers().WhereAsArray(s => s is not INamedTypeSymbol),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (3)
28INamedTypeSymbol containingType, 103public INamedTypeSymbol AssociatedAnonymousDelegate => null; 109public ImmutableArray<INamedTypeSymbol> UnmanagedCallingConventionTypes => [];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (10)
21public new INamedTypeSymbol OriginalDefinition { get; protected set; } 29INamedTypeSymbol containingType, 58public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 69public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 82public abstract INamedTypeSymbol EnumUnderlyingType { get; } 84INamedTypeSymbol INamedTypeSymbol.ConstructedFrom => this.ConstructedFrom; 85public abstract INamedTypeSymbol ConstructUnboundGenericType(); 124public INamedTypeSymbol NativeIntegerUnderlyingType => null; 126public INamedTypeSymbol TupleUnderlyingType => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (2)
13INamedTypeSymbol attributeClass, 20protected override INamedTypeSymbol CommonAttributeClass => attributeClass;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (4)
51public override INamedTypeSymbol EnumUnderlyingType 57public override INamedTypeSymbol ConstructUnboundGenericType() 87public override ImmutableArray<INamedTypeSymbol> GetTypeMembers() 90return ImmutableArray.CreateRange(_constructedFrom.TypeMembers.Cast<INamedTypeSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorSymbol.cs (1)
12INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
16INamedTypeSymbol? containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
28INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (11)
24private readonly ImmutableArray<INamedTypeSymbol> _interfaces; 29INamedTypeSymbol containingType, 37INamedTypeSymbol baseType, 38ImmutableArray<INamedTypeSymbol> interfaces, 43INamedTypeSymbol enumUnderlyingType) 106public override INamedTypeSymbol EnumUnderlyingType { get; } 116public override INamedTypeSymbol ConstructUnboundGenericType() 152public override INamedTypeSymbol BaseType { get; } 154public override ImmutableArray<INamedTypeSymbol> Interfaces 165public override ImmutableArray<INamedTypeSymbol> GetTypeMembers() 166=> ImmutableArray.CreateRange(this.TypeMembers.Cast<INamedTypeSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceOrTypeSymbol.cs (4)
21INamedTypeSymbol containingType, 36public virtual ImmutableArray<INamedTypeSymbol> GetTypeMembers() 39public ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name) 42public ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name, int arity)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceSymbol.cs (1)
57public static INamedTypeSymbol ImplicitType => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
19INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (3)
32public INamedTypeSymbol ContainingType { get; protected set; } 36INamedTypeSymbol containingType, 167public ImmutableArray<AttributeData> GetAttributes(INamedTypeSymbol attributeType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (3)
12INamedTypeSymbol containingType, 80public INamedTypeSymbol DeclaringType 84return this.ContainingSymbol as INamedTypeSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
19INamedTypeSymbol containingType, 32public virtual INamedTypeSymbol BaseType => null; 34public virtual ImmutableArray<INamedTypeSymbol> Interfaces 37public ImmutableArray<INamedTypeSymbol> AllInterfaces
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\TypeGenerator.cs (1)
21public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
199foreach (var namedType in SymbolAnnotation.GetSymbols(annotation, model.Compilation).OfType<INamedTypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (3)
21this IMethodSymbol method, INamedTypeSymbol containingType, ISyntaxFactsService syntaxFacts) 145params INamedTypeSymbol[] removeAttributeTypes) 174static bool shouldRemoveAttribute(AttributeData a, (INamedTypeSymbol[] removeAttributeTypes, ISymbol accessibleWithin) arg)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
41this IPropertySymbol property, ISymbol accessibleWithin, params INamedTypeSymbol[] attributesToRemove) 69static bool ShouldRemoveAttribute(AttributeData a, (INamedTypeSymbol[] attributesToRemove, ISymbol accessibleWithin) arg)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (3)
27public static INamedTypeSymbol? InferDelegateType( 37public static INamedTypeSymbol? InferDelegateType( 47private static INamedTypeSymbol? GetFirstDelegateType(SemanticModel semanticModel, ImmutableArray<ITypeSymbol> types)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\KnownTypes.cs (8)
9public readonly INamedTypeSymbol? TaskType = compilation.TaskType(); 10public readonly INamedTypeSymbol? TaskOfTType = compilation.TaskOfTType(); 11public readonly INamedTypeSymbol? ValueTaskType = compilation.ValueTaskType(); 12public readonly INamedTypeSymbol? ValueTaskOfTType = compilation.ValueTaskOfTType(); 14public readonly INamedTypeSymbol? IEnumerableOfTType = compilation.IEnumerableOfTType(); 15public readonly INamedTypeSymbol? IEnumeratorOfTType = compilation.IEnumeratorOfTType(); 17public readonly INamedTypeSymbol? IAsyncEnumerableOfTType = compilation.IAsyncEnumerableOfTType(); 18public readonly INamedTypeSymbol? IAsyncEnumeratorOfTType = compilation.IAsyncEnumeratorOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (3)
46var notImplementedExceptionTypeSyntax = compilation.NotImplementedExceptionType() is INamedTypeSymbol symbol 184var classOrStructType = throughMember.ContainingType; 449var type = compilation.GetTypeByMetadataName(typeof(ArgumentNullException).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (11)
37INamedTypeSymbol containingType, 68INamedTypeSymbol containingType, 70INamedTypeSymbol constructedEquatableType, 114INamedTypeSymbol containingType, 223var iequatableType = compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName); 276INamedTypeSymbol containingType, 387private static bool ImplementsIEquatable(ITypeSymbol memberType, INamedTypeSymbol iequatableType) 393var constructed = iequatableType.Construct(memberType); 438private static bool HasExistingBaseEqualsMethod(INamedTypeSymbol containingType) 461INamedTypeSymbol? containingType, 495INamedTypeSymbol? containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateGetHashCodeMethod.cs (5)
21INamedTypeSymbol? containingType, 43INamedTypeSymbol hashCodeType, ImmutableArray<SyntaxNode> memberReferences) 83INamedTypeSymbol containingType, 179this SyntaxGenerator generator, SyntaxGeneratorInternal generatorInternal, INamedTypeSymbol namedTypeSymbol, 192public static IMethodSymbol? GetBaseGetHashCodeMethod(INamedTypeSymbol containingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
448var containingType = property.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (5)
66var containingType = parameter.ContainingType; 84var containingType = parameter.ContainingType; 146IOperation? operation, INamedTypeSymbol containingType, 163public static bool IsFieldOrPropertyAssignment(IOperation statement, INamedTypeSymbol containingType, [NotNullWhen(true)] out IAssignmentOperation? assignmentExpression) 167IOperation statement, INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (4)
162(INamedTypeSymbol?, IMethodSymbol?) GetIDisposableInterfaceAndDisposeMethod(string typeName, string methodName) 200public bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol) 224public bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken) 251public bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, INamedTypeSymbol expressionTypeOpt, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
116public abstract SyntaxNode DeclarationPattern(INamedTypeSymbol type, string name);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
107protected static IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedTypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (1)
81var typeSymbol = semanticModel.Compilation.GetSpecialType(specialType);
Microsoft.CodeAnalysis.CSharp (163)
Binder\Binder_InterpolatedString.cs (1)
998var expected = builderPatternExpectsBool == true ? Compilation.GetSpecialType(SpecialType.System_Boolean) : Compilation.GetSpecialType(SpecialType.System_Void);
Binder\Binder_Operators.cs (1)
1066var booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean);
Binder\Binder_Patterns.cs (2)
1114var objectType = Compilation.GetSpecialType(SpecialType.System_Object); 1141var objectType = Compilation.GetSpecialType(SpecialType.System_Object);
Binder\Binder_QueryErrors.cs (2)
89var ienumerable_t = Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T); 127var ienumerable = Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable);
Binder\DecisionDagBuilder.cs (1)
326var objectType = this._compilation.GetSpecialType(SpecialType.System_Object);
Binder\ForEachLoopBinder.cs (1)
1767var implementedNonGeneric = this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable);
Binder\InMethodBinder.cs (1)
155var objectType = compilation.GetSpecialType(SpecialType.System_Object);
Binder\Semantics\Conversions\ConversionsBase.cs (1)
1703var specialType = compilation.GetSpecialType(specialInterface);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (2)
527var boolean = Compilation.GetSpecialType(SpecialType.System_Boolean); 785var @object = Compilation.GetSpecialType(SpecialType.System_Object);
Compilation\CSharpCompilation.cs (12)
323protected override INamedTypeSymbol CommonCreateErrorTypeSymbol(INamespaceOrTypeSymbol? container, string name, int arity) 4019protected override INamedTypeSymbol? CommonGetTypeByMetadataName(string metadataName) 4024protected override INamedTypeSymbol? CommonScriptClass 4045ImmutableArray<INamedTypeSymbol> callingConventionTypes) 4109static CustomModifier getCustomModifierForType(INamedTypeSymbol type, CSharpCompilation @this, int index) 4126protected override INamedTypeSymbol CommonCreateNativeIntegerTypeSymbol(bool signed) 4136protected override INamedTypeSymbol CommonCreateTupleTypeSymbol( 4162protected override INamedTypeSymbol CommonCreateTupleTypeSymbol( 4163INamedTypeSymbol underlyingType, 4191protected override INamedTypeSymbol CommonCreateAnonymousTypeSymbol( 4531protected override INamedTypeSymbol CommonObjectType 4685var typeSymbol = GetSpecialType(type);
Compilation\CSharpSemanticModel.cs (4)
2979public abstract INamedTypeSymbol GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 2987public abstract INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3113public abstract INamedTypeSymbol GetDeclaredSymbol(AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3121public abstract INamedTypeSymbol GetDeclaredSymbol(TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken));
Compilation\MemberSemanticModel.cs (4)
603public override INamedTypeSymbol GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 609public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1099public override INamedTypeSymbol GetDeclaredSymbol(AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1106public override INamedTypeSymbol GetDeclaredSymbol(TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (4)
265public override INamedTypeSymbol GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 270public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 430public override INamedTypeSymbol GetDeclaredSymbol(AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 435public override INamedTypeSymbol GetDeclaredSymbol(TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (6)
452public override INamedTypeSymbol GetDeclaredSymbol(AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 459public override INamedTypeSymbol GetDeclaredSymbol(TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 512var symbol = this.GetDeclaredSymbol(decl); 1357public override INamedTypeSymbol GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1370public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 2088var delegateType = (GetDeclaredSymbol(memberDecl, cancellationToken) as INamedTypeSymbol).GetSymbol();
Compiler\MethodBodySynthesizer.cs (2)
94var intType = compilation.GetSpecialType(SpecialType.System_Int32); 95var objectType = compilation.GetSpecialType(SpecialType.System_Object);
CSharpExtensions.cs (4)
1382public static INamedTypeSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1391public static INamedTypeSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1463public static INamedTypeSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1472public static INamedTypeSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (2)
328var stringType = Compilation.GetSpecialType(SpecialType.System_String); 329var intType = Compilation.GetSpecialType(SpecialType.System_Int32);
Emitter\Model\PEAssemblyBuilder.cs (1)
617var result = _sourceAssembly.DeclaringCompilation.GetSpecialType(type);
Lowering\IteratorRewriter\IteratorConstructor.cs (1)
26var intType = container.DeclaringCompilation.GetSpecialType(SpecialType.System_Int32);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (1)
646var boolean = _compilation.GetSpecialType(SpecialType.System_Boolean);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (2)
203var iCollectionOfTType = _compilation.GetSpecialType(SpecialType.System_Collections_Generic_ICollection_T); 204var iCollectionOfElementType = iCollectionOfTType.Construct(((NamedTypeSymbol)targetEnumerableType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
102var boolType = _compilation.GetSpecialType(SpecialType.System_Boolean);
SymbolDisplay\SymbolDisplayVisitor.cs (2)
368INamedTypeSymbol containingType = symbol.ContainingType; 442private bool IncludeNamedType([NotNullWhen(true)] INamedTypeSymbol? namedType)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (3)
616foreach (var conventionType in conventionTypes) 923INamedTypeSymbol containingType = symbol.ContainingType; 1053INamedTypeSymbol containingType = implementedMember.ContainingType;
SymbolDisplay\SymbolDisplayVisitor.Types.cs (20)
176public override void VisitNamedType(INamedTypeSymbol symbol) 200private void VisitNamedTypeWithoutNullability(INamedTypeSymbol symbol) 310private bool ShouldDisplayAsValueTuple(INamedTypeSymbol symbol) 322private void AddNameAndTypeArgumentsOrParameters(INamedTypeSymbol symbol) 446private void AddDelegateParameters(INamedTypeSymbol symbol) 462private void AddAnonymousTypeName(INamedTypeSymbol symbol) 484private bool CanUseTupleSyntax(INamedTypeSymbol tupleSymbol) 491INamedTypeSymbol currentUnderlying = GetTupleUnderlyingTypeOrSelf(tupleSymbol); 499tupleSymbol = (INamedTypeSymbol)currentUnderlying.TypeArguments[NamedTypeSymbol.ValueTupleRestPosition - 1]; 514bool containsModopt(INamedTypeSymbol symbol) 527private static INamedTypeSymbol GetTupleUnderlyingTypeOrSelf(INamedTypeSymbol type) 532private static bool HasNonDefaultTupleElements(INamedTypeSymbol tupleSymbol) 537private void AddTupleTypeName(INamedTypeSymbol symbol) 585private bool CanShowDelegateSignature(INamedTypeSymbol symbol) 594private static SymbolDisplayPartKind GetPartKind(INamedTypeSymbol symbol) 621private bool AddSpecialTypeKeyword(INamedTypeSymbol symbol) 635private static string? GetSpecialTypeName(INamedTypeSymbol symbol) 680private void AddTypeKind(INamedTypeSymbol symbol) 790typeArguments = ((INamedTypeSymbol)owner).TypeArguments;
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (1)
34protected override void AddExplicitlyCastedLiteralValue(INamedTypeSymbol namedType, SpecialType type, object value)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
116private void MinimallyQualify(INamedTypeSymbol symbol) 284private string RemoveAttributeSuffixIfNecessary(INamedTypeSymbol symbol, string symbolName)
Symbols\Attributes\AttributeData.cs (2)
189/// Gets the attribute class being applied as an <see cref="INamedTypeSymbol"/> 191protected override INamedTypeSymbol? CommonAttributeClass
Symbols\Compilation_WellKnownMembers.cs (4)
462var systemByte = GetSpecialType(SpecialType.System_Byte); 465var systemUnit32 = GetSpecialType(SpecialType.System_UInt32); 800var stringType = GetSpecialType(SpecialType.System_String); 814var boolType = GetSpecialType(SpecialType.System_Boolean);
Symbols\CustomModifier.cs (1)
28public override INamedTypeSymbol Modifier
Symbols\PublicModel\AssemblySymbol.cs (3)
52INamedTypeSymbol IAssemblySymbol.ResolveForwardedType(string fullyQualifiedMetadataName) 57ImmutableArray<INamedTypeSymbol> IAssemblySymbol.GetForwardedTypes() 99INamedTypeSymbol? IAssemblySymbol.GetTypeByMetadataName(string metadataName)
Symbols\PublicModel\MethodSymbol.cs (2)
273ImmutableArray<INamedTypeSymbol> IMethodSymbol.UnmanagedCallingConventionTypes => _underlying.UnmanagedCallingConventionTypes.SelectAsArray(t => t.GetPublicSymbol()); 303INamedTypeSymbol IMethodSymbol.AssociatedAnonymousDelegate
Symbols\PublicModel\NamedTypeSymbol.cs (36)
24int INamedTypeSymbol.Arity 32ImmutableArray<IMethodSymbol> INamedTypeSymbol.InstanceConstructors 40ImmutableArray<IMethodSymbol> INamedTypeSymbol.StaticConstructors 48ImmutableArray<IMethodSymbol> INamedTypeSymbol.Constructors 56IEnumerable<string> INamedTypeSymbol.MemberNames 64ImmutableArray<ITypeParameterSymbol> INamedTypeSymbol.TypeParameters 72ImmutableArray<ITypeSymbol> INamedTypeSymbol.TypeArguments 86ImmutableArray<CodeAnalysis.NullableAnnotation> INamedTypeSymbol.TypeArgumentNullableAnnotations 94ImmutableArray<CustomModifier> INamedTypeSymbol.GetTypeArgumentCustomModifiers(int ordinal) 99INamedTypeSymbol INamedTypeSymbol.OriginalDefinition 107IMethodSymbol INamedTypeSymbol.DelegateInvokeMethod 115INamedTypeSymbol INamedTypeSymbol.EnumUnderlyingType 123INamedTypeSymbol INamedTypeSymbol.ConstructedFrom 131INamedTypeSymbol INamedTypeSymbol.Construct(params ITypeSymbol[] typeArguments) 136INamedTypeSymbol INamedTypeSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations) 141INamedTypeSymbol INamedTypeSymbol.ConstructUnboundGenericType() 146ISymbol INamedTypeSymbol.AssociatedSymbol 159ImmutableArray<IFieldSymbol> INamedTypeSymbol.TupleElements 171INamedTypeSymbol INamedTypeSymbol.TupleUnderlyingType 183bool INamedTypeSymbol.IsComImport => UnderlyingNamedTypeSymbol.IsComImport; 185bool INamedTypeSymbol.IsGenericType => UnderlyingNamedTypeSymbol.IsGenericType; 187bool INamedTypeSymbol.IsUnboundGenericType => UnderlyingNamedTypeSymbol.IsUnboundGenericType; 189bool INamedTypeSymbol.IsScriptClass => UnderlyingNamedTypeSymbol.IsScriptClass; 191bool INamedTypeSymbol.IsImplicitClass => UnderlyingNamedTypeSymbol.IsImplicitClass; 193bool INamedTypeSymbol.MightContainExtensionMethods => UnderlyingNamedTypeSymbol.MightContainExtensionMethods; 195bool INamedTypeSymbol.IsSerializable => UnderlyingNamedTypeSymbol.IsSerializable; 197bool INamedTypeSymbol.IsFileLocal => 203INamedTypeSymbol INamedTypeSymbol.NativeIntegerUnderlyingType => UnderlyingNamedTypeSymbol.NativeIntegerUnderlyingType.GetPublicSymbol();
Symbols\PublicModel\NamespaceOrTypeSymbol.cs (3)
23ImmutableArray<INamedTypeSymbol> INamespaceOrTypeSymbol.GetTypeMembers() 28ImmutableArray<INamedTypeSymbol> INamespaceOrTypeSymbol.GetTypeMembers(string name) 33ImmutableArray<INamedTypeSymbol> INamespaceOrTypeSymbol.GetTypeMembers(string name, int arity)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
25INamedTypeSymbol? ISymbol.ContainingType => null;
Symbols\PublicModel\Symbol.cs (1)
71INamedTypeSymbol ISymbol.ContainingType
Symbols\PublicModel\TypeParameterSymbol.cs (1)
57INamedTypeSymbol ITypeParameterSymbol.DeclaringType
Symbols\PublicModel\TypeSymbol.cs (3)
86INamedTypeSymbol ITypeSymbol.BaseType 94ImmutableArray<INamedTypeSymbol> ITypeSymbol.Interfaces 102ImmutableArray<INamedTypeSymbol> ITypeSymbol.AllInterfaces
Symbols\Source\SourceAssemblySymbol.cs (5)
1830var boolType = _compilation.GetSpecialType(SpecialType.System_Boolean); 1968var int32Type = _compilation.GetSpecialType(SpecialType.System_Int32); 1988var boolType = _compilation.GetSpecialType(SpecialType.System_Boolean); 2022var stringType = _compilation.GetSpecialType(SpecialType.System_String); 2032var stringType = _compilation.GetSpecialType(SpecialType.System_String);
Symbols\Source\SourceFixedFieldSymbol.cs (1)
46var intType = compilation.GetSpecialType(SpecialType.System_Int32);
Symbols\SymbolExtensions.cs (6)
426internal static NamedTypeSymbol? EnsureCSharpSymbolOrNull(this INamedTypeSymbol? symbol, string paramName) 581internal static INamedTypeSymbol? GetPublicSymbol(this NamedTypeSymbol? symbol) 583return symbol.GetPublicSymbol<INamedTypeSymbol>(); 719internal static ImmutableArray<INamedTypeSymbol> GetPublicSymbols(this ImmutableArray<NamedTypeSymbol> symbols) 721return GetPublicSymbols<INamedTypeSymbol>(StaticCast<Symbol>.From(symbols)); 784internal static NamedTypeSymbol? GetSymbol(this INamedTypeSymbol? symbol)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorTypeSymbol.cs (3)
34var iDisposable = compilation.GetSpecialType(SpecialType.System_IDisposable); 35var iEnumerator = compilation.GetSpecialType(SpecialType.System_Collections_IEnumerator); 36var iEnumeratorT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerator_T).Construct(typeArgs);
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (6)
286var iEnumerable = compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 289var iEnumerableT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T).Construct(typeArgs); 290var iReadOnlyCollectionT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IReadOnlyCollection_T).Construct(typeArgs); 291var iReadOnlyListT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IReadOnlyList_T).Construct(typeArgs); 292var iCollectionT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_ICollection_T).Construct(typeArgs); 293var iListT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IList_T).Construct(typeArgs);
Symbols\TypedConstantExtensions.cs (1)
52SpecialType splType = ((INamedTypeSymbol)constant.Type!).EnumUnderlyingType!.SpecialType;
Microsoft.CodeAnalysis.CSharp.CodeStyle (133)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
91private static bool TypeCanBeConverted(INamedTypeSymbol containingType, TypeDeclarationSyntax typeDeclaration)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
51var expressionType = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName!); 64private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (6)
40private readonly INamedTypeSymbol _namedTypeSymbol; 43private SymbolAnalyzer(INamedTypeSymbol namedTypeSymbol) 54var namedTypeSymbol = (INamedTypeSymbol)context.Symbol; 73private static Location GetDiagnosticLocation(INamedTypeSymbol namedTypeSymbol) 76private static bool HasReadonlyField(INamedTypeSymbol namedTypeSymbol)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
58if (context.Symbol is not INamedTypeSymbol
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (2)
77var typeSymbol = (INamedTypeSymbol)context.Symbol;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (2)
56private void AnalyzeSyntax(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType, INamedTypeSymbol? conditionalAttributeType)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
148else if (symbolInfo.Symbol is INamedTypeSymbol { IsValueType: true, IsGenericType: false })
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
26protected override IEnumerable<TypeDeclarationSyntax> GetTypeDeclarations(INamedTypeSymbol namedType, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
31var enumerableType = context.Compilation.GetTypeByMetadataName(typeof(Enumerable).FullName!); 178SyntaxNodeAnalysisContext context, INamedTypeSymbol enumerableType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (1)
44protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (7)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 35private void AnalyzeArrayCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 65INamedTypeSymbol? expressionType, 101var ienumerableType = convertedType.OriginalDefinition.SpecialType is SpecialType.System_Collections_Generic_IEnumerable_T 102? (INamedTypeSymbol)convertedType 122INamedTypeSymbol? expressionType, 138private void AnalyzeArrayInitializerExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37INamedTypeSymbol? expressionType) 104INamedTypeSymbol? expressionType, 129var factoryType = semanticModel.GetSymbolInfo(memberAccessExpression.Expression, cancellationToken).Symbol as INamedTypeSymbol;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 26private void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
24protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 27private void AnalyzeMemberAccess(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
66protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 69private void AnalyzeMemberAccess(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 119INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (4)
25protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31private void AnalyzeObjectCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 34private void AnalyzeImplicitObjectCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 38SyntaxNodeAnalysisContext context, BaseObjectCreationExpressionSyntax objectCreationExpression, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (4)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 41private void AnalyzeImplicitStackAllocExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 83private void AnalyzeExplicitStackAllocExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 126INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (11)
64INamedTypeSymbol? expressionType, 83INamedTypeSymbol? expressionType, 327if (type is INamedTypeSymbol namedType) 738INamedTypeSymbol? expressionType, 884if (semanticModel.GetSymbolInfo(memberAccessExpression.Expression, cancellationToken).Symbol is not INamedTypeSymbol factoryType) 934Type: INamedTypeSymbol 981Type: INamedTypeSymbol 1061public static bool EqualsOrImplements(ITypeSymbol type, INamedTypeSymbol? interfaceType) 1068foreach (var baseInterface in type.AllInterfaces) 1110if (expressionSymbol is not INamedTypeSymbol) 1142if (expressionSymbol is not INamedTypeSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
52INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (5)
92[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 122[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 141[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 168if (type is not INamedTypeSymbol { IsTupleType: true, TupleElements.Length: >= 2 } tupleTypeOpt) 202SemanticModel semanticModel, INamedTypeSymbol tupleType,
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (1)
62methodSymbol.ReturnType is INamedTypeSymbol namedType &&
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
61return method.ReturnType is INamedTypeSymbol namedType && namedType.Arity != 0;
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
42if (semanticModel.GetTypeInfo(declaration, cancellationToken).ConvertedType is not INamedTypeSymbol lambdaType || lambdaType.DelegateInvokeMethod == null)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
84var arrayType = compilation.GetSpecialType(SpecialType.System_Array);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (5)
27public readonly INamedTypeSymbol IndexType; 29public readonly INamedTypeSymbol? ExpressionOfTType; 37private InfoCache(INamedTypeSymbol indexType, INamedTypeSymbol? expressionOfTType) 74var containingType = method.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (8)
28public readonly INamedTypeSymbol RangeType; 29public readonly INamedTypeSymbol? ExpressionOfTType; 33private InfoCache(INamedTypeSymbol rangeType, INamedTypeSymbol stringType, INamedTypeSymbol? expressionOfTType) 74var stringType = compilation.GetSpecialType(SpecialType.System_String); 79private static IMethodSymbol? GetSliceLikeMethod(INamedTypeSymbol namedType) 136var containingType = sliceLikeMethod.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
85private void AnalyzeIsTypeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (7)
64var expressionType = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName!); 77private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext, INamedTypeSymbol? expressionType) 114var delegateType = semanticModel.GetTypeInfo(anonymousFunction, cancellationToken).ConvertedType as INamedTypeSymbol; 237SemanticModel semanticModel, INamedTypeSymbol? expressionTypeOpt, ISymbol local, BlockSyntax block, 389INamedTypeSymbol delegateType, 394var delegateContainingType = delegateType.ContainingType;
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
81INamedTypeSymbol? containingType = null;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
52INamedTypeSymbol? expressionOfTType)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (16)
79var namedTypeToAnalyzer = new ConcurrentDictionary<INamedTypeSymbol, Analyzer>(); 85INamedTypeSymbol namedType, 142INamedTypeSymbol namedType, 145ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer) 150private readonly INamedTypeSymbol _namedType = namedType; 154private readonly ConcurrentDictionary<INamedTypeSymbol, Analyzer> _namedTypeToAnalyzer = namedTypeToAnalyzer; 204ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer) 209var startSymbol = (INamedTypeSymbol)context.Symbol; 215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType) 245INamedTypeSymbol namedType) 260Analyzer? TryCreateAnalyzer(INamedTypeSymbol namedType) 340INamedTypeSymbol namedType, 385INamedTypeSymbol namedType, 406INamedTypeSymbol namedType, 463INamedTypeSymbol namedType,
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
79var namedType = (INamedTypeSymbol)context.Symbol;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
55var expressionType = context.Compilation.GetTypeByMetadataName(typeof(System.Linq.Expressions.Expression<>).FullName!); 60private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (5)
45var tupleType = (INamedTypeSymbol)typeInDeclaration; 127if (semanticModel.GetTypeInfo(containingTypeName, cancellationToken).Type is not INamedTypeSymbol containingType) 141INamedTypeSymbol containingType) 188if (symbol is not INamedTypeSymbol namedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
1011lambda.GetTargetType(semanticModel, cancellationToken) is INamedTypeSymbol { DelegateInvokeMethod.ReturnType: var returnType } ? returnType : null; 1047foreach (var iface in collectionTargetType.AllInterfaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
40public static bool TryGetPrimaryConstructor(this INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
460public static INamedTypeSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, BaseTypeDeclarationSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
787[NotNullWhen(true)] INamedTypeSymbol? expressionType, 820static bool TakesExpressionTree(SymbolInfo info, INamedTypeSymbol expressionType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
93public bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol) 230public bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken) 392public bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, [NotNullWhen(true)] INamedTypeSymbol? expressionType, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (9)
127var enumType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type as INamedTypeSymbol; 162var enumType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type as INamedTypeSymbol; 627if (castedType is not INamedTypeSymbol namedCastedType || 628originalConvertedType is not INamedTypeSymbol originalNamedConvertedType) 946if (conversionOperation.Operand.Type is not INamedTypeSymbol original) 955for (var type = original; type != null; type = type.BaseType) 1321var rewrittenContainingType = rewrittenMemberSymbol.ContainingType;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (139)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
65var type = constructorSymbol.ContainingType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
41if (semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol 81INamedTypeSymbol type, 277var iEquatable = ConvertToRecordHelpers.GetIEquatableType(semanticModel.Compilation, type); 376INamedTypeSymbol type, 471INamedTypeSymbol type,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
32var type = methodSymbol.ContainingType; 33var equatableType = GetIEquatableType(compilation, type); 67public static INamedTypeSymbol? GetIEquatableType(Compilation compilation, INamedTypeSymbol containingType) 497var type = methodSymbol.ContainingType; 856MatchedType: INamedTypeSymbol matchedType, 882INamedTypeSymbol type, 959INamedTypeSymbol type, 1100private static bool OverridesEquals(Compilation compilation, IMethodSymbol equals, INamedTypeSymbol? equatableType) 1109var objectType = compilation.GetSpecialType(SpecialType.System_Object);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (4)
37INamedTypeSymbol type, 75INamedTypeSymbol currentType, 78var baseType = currentType.BaseType; 119INamedTypeSymbol containingType)
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
97INamedTypeSymbol? taskType = null;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (8)
29protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 47out INamedTypeSymbol typeToGenerateIn) 85out INamedTypeSymbol typeToGenerateIn) 100typeToGenerateIn = symbolInfo.GetAnySymbol() as INamedTypeSymbol; 117out INamedTypeSymbol typeToGenerateIn) 135typeToGenerateIn = symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol as INamedTypeSymbol; 152out INamedTypeSymbol typeToGenerateIn) 159if (typeInfo.Type is INamedTypeSymbol typeSymbol)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
27[NotNullWhen(true)] out INamedTypeSymbol? classType) 38classType = semanticDocument.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
109var codeActions = await service.GenerateDeconstructMethodAsync(document, target, (INamedTypeSymbol)type, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (12)
39protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 61out INamedTypeSymbol typeToGenerateIn) 87out INamedTypeSymbol typeToGenerateIn) 112out INamedTypeSymbol typeToGenerateIn) 140out INamedTypeSymbol typeToGenerateIn) 143typeToGenerateIn = document.SemanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type as INamedTypeSymbol; 145|| document.SemanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type is not INamedTypeSymbol parameterSymbol 171out INamedTypeSymbol typeToGenerateIn) 174typeToGenerateIn = document.SemanticModel.GetTypeInfo(expression, cancellationToken).ConvertedType as INamedTypeSymbol; 176|| document.SemanticModel.GetTypeInfo(expression, cancellationToken).Type is not INamedTypeSymbol parameterSymbol 197INamedTypeSymbol typeToGenerateIn, INamedTypeSymbol parameterSymbol)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (2)
28protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 61if (targetType is not INamedTypeSymbol { IsTupleType: true, TupleElements: var tupleElements })
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (3)
35protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 53out INamedTypeSymbol typeToGenerateIn) 67typeToGenerateIn = semanticInfo.Type as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (5)
43out SyntaxNode classOrStructDecl, out INamedTypeSymbol classOrStructType, out ImmutableArray<INamedTypeSymbol> interfaceTypes) 62if (interfaceSymbolInfo.GetAnySymbol() is INamedTypeSymbol interfaceType && interfaceType.TypeKind == TypeKind.Interface) 65classOrStructType = model.GetDeclaredSymbol(classOrStructDecl, cancellationToken) as INamedTypeSymbol; 93SyntaxGenerator g, INamedTypeSymbol classType, string disposeMethodDisplayString)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (6)
118var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 119var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!); 120var ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!); 121var ienumeratorGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator<>).FullName!); 191var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 192var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
113[NotNullWhen(true)] out INamedTypeSymbol? ienumerableSymbol, 114[NotNullWhen(true)] out INamedTypeSymbol? ienumerableGenericSymbol)
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (2)
49var structDeclarationSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(structDeclaration, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
123var flagsAttribute = compilation.GetTypeByMetadataName(typeof(FlagsAttribute).FullName!);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
101SemanticModel semanticModel, ExpressionSyntax expression, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (6)
77out var tupleType, out memberAccessExpressions, 93out var tupleType, out memberAccessExpressions, 116private ForEachVariableStatementSyntax CreateForEachVariableStatement(INamedTypeSymbol tupleType, ForEachStatementSyntax forEachStatement) 134INamedTypeSymbol tupleType, LocalDeclarationStatementSyntax declarationStatement, VariableDeclaratorSyntax variableDeclarator) 148private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 159private static DeclarationExpressionSyntax CreateDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode)
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (3)
81var lambdaType = (INamedTypeSymbol)semanticModel.GetTypeInfo(declaration).ConvertedType!; 101var taskType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Task).FullName!);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
177var elements = ((INamedTypeSymbol)typeSymbol).TupleElements;
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
101var delegateType = (INamedTypeSymbol)semanticModel.GetTypeInfo(anonymousFunction, cancellationToken).ConvertedType; 177INamedTypeSymbol delegateType, ParameterListSyntax parameterList,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (3)
320INamedTypeSymbol { ContainingType: { } containingType } => CreateDottedName(originalName, currentName, containingType), 331INamedTypeSymbol containingType) 392semanticModel.GetSymbolInfo(baseType.Type, cancellationToken).GetAnySymbol() is INamedTypeSymbol { TypeKind: TypeKind.Class })
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
65conversion.Type is INamedTypeSymbol { IsGenericType: true } namedType &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
63CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 68var namedType = @event.Type as INamedTypeSymbol; 247protected override TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 729INamedTypeSymbol namedType, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpFlagsEnumGenerator.cs (2)
21INamedTypeSymbol enumType, 38protected override bool IsValidName(INamedTypeSymbol enumType, string name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (3)
160var namedType = enumMember.Type as INamedTypeSymbol; 161var underlyingType = namedType?.EnumUnderlyingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
62if (type is INamedTypeSymbol { TypeKind: TypeKind.Enum } enumType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
366if (method.IsReadOnly && (method.ContainingSymbol as INamedTypeSymbol)?.IsReadOnly != true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
28INamedTypeSymbol namedType, 42INamedTypeSymbol namedType, 57INamedTypeSymbol namedType, 69INamedTypeSymbol namedType, 152INamedTypeSymbol namedType, 182INamedTypeSymbol namedType, 226INamedTypeSymbol namedType, 244INamedTypeSymbol namedType, 261INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info) 267INamedTypeSymbol namedType, 311INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info) 316private static BaseListSyntax? GenerateBaseList(INamedTypeSymbol namedType) 322foreach (var type in namedType.Interfaces) 331private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateConstraintClauses(INamedTypeSymbol namedType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (1)
112foreach (var type in ns.GetTypeMembers())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1034INamedTypeSymbol nt => nt.Arity > 0, 1043return symbols.All(static s => s is INamedTypeSymbol or IMethodSymbol); 3046return ((INamedTypeSymbol)symbol).TypeKind == TypeKind.Enum;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
41public override ExpressionSyntax VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (5)
118public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 174public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 224private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 250private static TupleTypeSyntax CreateTupleTypeSyntax(INamedTypeSymbol symbol) 263public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
209public override SyntaxNode DeclarationPattern(INamedTypeSymbol type, string name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (18)
330if (types.Any(t => t is INamedTypeSymbol)) 332return types.OfType<INamedTypeSymbol>().SelectMany(t => 363.OfType<INamedTypeSymbol>() 440if (info.Type is not INamedTypeSymbol type) 461if (info.Type is not INamedTypeSymbol type) 567if (info.Type is INamedTypeSymbol type) 704var inferredNamedType = (INamedTypeSymbol)inferredType; 705var returnNamedType = (INamedTypeSymbol)returnType; 1408if (types.Any(t => t is INamedTypeSymbol)) 1410return types.OfType<INamedTypeSymbol>().SelectMany(t => 1431if (types.Any(t => t is INamedTypeSymbol)) 1438return types.OfType<INamedTypeSymbol>().SelectMany(t => 1583var type = Compilation.CreateTupleTypeSymbol( 1994return memberType is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1 2008var namedTypeSymbol = (INamedTypeSymbol)type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
103var namedType = parameter.ContainingType;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (32)
SymbolKey\SymbolKeyCompilationsTests.cs (11)
131var type = ns.GetTypeMembers("C1").FirstOrDefault(); 158var type = ns.GetTypeMembers("C1").FirstOrDefault(); 186var type = ns.GetTypeMembers("C1").FirstOrDefault(); 228var type = compilation.SourceModule.GlobalNamespace.GetTypeMembers("C").Single(); 464var typeSym00 = namespace1.GetTypeMembers("C1").FirstOrDefault(); 467var typeSym01 = namespace2.GetTypeMembers("C1").FirstOrDefault(); 468var typeSym02 = namespace2.GetTypeMembers("C2").Single(); 546var typeSym1 = comp1.SourceModule.GlobalNamespace.GetTypeMembers("Test").Single(); 549var typeSym2 = comp2.SourceModule.GlobalNamespace.GetTypeMembers("Test").Single(); 572var typeSym01 = namespace1.GetTypeMembers("C1").FirstOrDefault(); 575var typeSym02 = namespace2.GetTypeMembers("C1").FirstOrDefault();
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (4)
71var typesym = comp2.SourceModule.GlobalNamespace.GetTypeMembers("App").FirstOrDefault(); 80var member03 = typesym.BaseType; 239var typeA = comp20.SourceModule.GlobalNamespace.GetTypeMembers("A").Single(); 254var typeTest = comp40.SourceModule.GlobalNamespace.GetTypeMembers("Test").FirstOrDefault();
SymbolKey\SymbolKeyTests.cs (1)
168var type = compilation.GetTypeByMetadataName("ConditionalWeakTableTest`2");
Workspaces\WorkspaceTests_EditorFeatures.cs (16)
438var classD = compilation2.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 439var classC = classD.BaseType; 466var classD = compilation2.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 467var classC = classD.BaseType; 500var classD = compilation2.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 501var classC = classD.BaseType; 518var classDz = compilation2Z.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 519var classCz = classDz.BaseType; 554var classDy = compilation2y.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 555var classCy = classDy.BaseType; 622var classDy = compilation2y.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 623var classCy = classDy.BaseType; 652var classDz = compilation2Z.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 653var classCz = classDz.BaseType; 673var classDz = compilation2Z.SourceModule.GlobalNamespace.GetTypeMembers("D").Single(); 674var classCz = classDz.BaseType;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (229)
CodeGen\CodeGenDeconstructTests.cs (2)
1567var underlying = ((INamedTypeSymbol)tupleType).TupleUnderlyingType;
CodeGen\CodeGenFunctionPointersTests.cs (14)
295var c = comp.GetTypeByMetadataName("C"); 371var c = comp.GetTypeByMetadataName("C"); 562var c = ((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C"); 684var testClass = compilation.GetTypeByMetadataName("Test1")!; 984var c = comp.GetTypeByMetadataName("C"); 5704var a = comp.GetTypeByMetadataName("A"); 7669var @string = comp1.GetSpecialType(SpecialType.System_String); 7754var @string = comp2.GetSpecialType(SpecialType.System_String); 8064var c = comp.GetTypeByMetadataName("C"); 8740var c = comp.GetTypeByMetadataName("C"); 10338var c = compilation.GetTypeByMetadataName("C"); 10406var c = compilation.GetTypeByMetadataName("C"); 10516var c = comp.GetTypeByMetadataName("C"); 10518var callConvCdecl = comp.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConvCdecl");
CodeGen\CodeGenLocalFunctionTests.cs (11)
2611var program = verify.Compilation.GetTypeByMetadataName("Program"); 3133var program = verify.Compilation.GetTypeByMetadataName("Program"); 3168var gooFrame = (INamedTypeSymbol)goo.Parameters[0].Type; 3169var barFrame = (INamedTypeSymbol)bar.Parameters[1].Type; 3204var program = verify.Compilation.GetTypeByMetadataName("Program"); 3250var program = verify.Compilation.GetTypeByMetadataName("Program"); 3276var program = verify.Compilation.GetTypeByMetadataName("Program"); 3309var program = verify.Compilation.GetTypeByMetadataName("Program"); 3397var program = verify.Compilation.GetTypeByMetadataName("Program");
CodeGen\CodeGenReadonlyStructTests.cs (2)
897INamedTypeSymbol iNamedType = comp.CreateAnonymousTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol()), ImmutableArray.Create("qq")); 1061INamedTypeSymbol iNamedType = comp.CreateAnonymousTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol()), ImmutableArray.Create("qq"));
CodeGen\CodeGenTupleTest.cs (198)
3345var c = comp.GetTypeByMetadataName("C"); 3639var type = (INamedTypeSymbol)model.GetTypeInfo(node).Type; 3689var yType = (INamedTypeSymbol)model.GetTypeInfo(yTuple).Type; 4475var vt2 = comp.GetTypeByMetadataName("System.ValueTuple`2"); 5817var tupleWithoutNames = comp.CreateTupleTypeSymbol(vt0, ImmutableArray<string>.Empty); 5855var tupleWithoutNames = comp.CreateTupleTypeSymbol(vt1, ImmutableArray.Create(new[] { (string)null })); 5873var tupleWithoutNames = comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create<string>(null, null)); 5887private static ImmutableArray<string> GetTupleElementNames(INamedTypeSymbol tuple) 5905var intType = comp.GetSpecialType(SpecialType.System_Int32); 5906var stringType = comp.GetSpecialType(SpecialType.System_String); 5912var tuple = comp.CreateTupleTypeSymbol( 5951var tupleWithoutNames = comp.CreateTupleTypeSymbol(vt2, default(ImmutableArray<string>)); 5972var tupleWithNames = comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create("Alice", "Bob")); 5991var tupleWithSomeNames = comp.CreateTupleTypeSymbol(vt3, ImmutableArray.Create(null, "Item2", "Charlie")); 6009var tupleWithNames = comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create("Item2", "Item1")); 6030var tuple8WithoutNames = comp.CreateTupleTypeSymbol(vt8, default(ImmutableArray<string>)); 6056var tuple8WithoutNames = comp.CreateTupleTypeSymbol(vt8, elementNames: default); 6083var tuple8WithNames = comp.CreateTupleTypeSymbol(vt8, ImmutableArray.Create("Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8")); 6108var tuple9WithoutNames = comp.CreateTupleTypeSymbol(vt9, default(ImmutableArray<string>)); 6133var tuple9WithNames = comp.CreateTupleTypeSymbol(vt9, ImmutableArray.Create("Alice1", "Alice2", "Alice3", "Alice4", "Alice5", "Alice6", "Alice7", "Alice8", "Alice9")); 6165var tuple9WithNames = comp.CreateTupleTypeSymbol(vt9, ImmutableArray.Create("Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9")); 6211var vt2 = comp.CreateErrorTypeSymbol(null, "ValueTuple", 2).Construct(intType, intType); 6275var tuple2 = comp.CreateTupleTypeSymbol(vt3, ImmutableArray.Create("123", " ", null)); 6279var tuple3 = comp.CreateTupleTypeSymbol(vt2, ImmutableArray.Create("return", "class")); 6311INamedTypeSymbol vbType = (INamedTypeSymbol)vbComp.GlobalNamespace.GetMembers("C").Single(); 6367var tupleWithoutNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType), ImmutableArray.Create<string>(null, null)); 6383var intType = comp.GetSpecialType(SpecialType.System_Int32); 6384var stringType = comp.GetSpecialType(SpecialType.System_String); 6389var tuple = comp.CreateTupleTypeSymbol( 6403private static IEnumerable<string> ElementTypeNames(INamedTypeSymbol tuple) 6415var tupleWithoutNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType), default(ImmutableArray<string>)); 6431var tupleWithNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType), ImmutableArray.Create("Alice", "Bob")); 6446var tupleWithNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, intType), ImmutableArray.Create("Item2", "Item1")); 6462var tuple8WithoutNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType, intType, stringType, intType, stringType, intType, stringType), 6482var tuple8WithNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType, intType, stringType, intType, stringType, intType, stringType), 6502var tuple9WithoutNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType, intType, stringType, intType, stringType, intType, stringType, intType), 6523var tuple9WithNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType, intType, stringType, intType, stringType, intType, stringType, intType), 6545var tupleWithoutNames = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, ErrorTypeSymbol.UnknownResultType), default(ImmutableArray<string>)); 6563var tuple2 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, intType), ImmutableArray.Create("123", " ")); 6567var tuple3 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, intType), ImmutableArray.Create("return", "class")); 6584INamedTypeSymbol intType = comp.GetSpecialType(SpecialType.System_String).GetPublicSymbol(); 6600var tuple1 = (INamedTypeSymbol)comp.SourceModule.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IFieldSymbol>("F").Type; 6602var intType = comp.GetSpecialType(SpecialType.System_Int32); 6603var stringType = comp.GetSpecialType(SpecialType.System_String); 6606var twoStringsWithNames = comp.CreateTupleTypeSymbol(twoStrings, ImmutableArray.Create("a", "b")); 6608var tuple2 = comp.CreateTupleTypeSymbol(tuple2Underlying); 6610var tuple3 = comp.CreateTupleTypeSymbol(ImmutableArray.Create<ITypeSymbol>(intType, intType, intType, intType, intType, intType, intType, stringType, stringType), 6613var tuple4 = comp.CreateTupleTypeSymbol(tuple1, ImmutableArray.Create("Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "a", "b")); 6635var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6637var underlyingType = tuple1; 6639var tuple2 = comp.CreateTupleTypeSymbol(underlyingType); 6677var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6679var underlyingType = tuple1; 6681var tuple2 = comp.CreateTupleTypeSymbol(underlyingType); 6716var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6719var tuple2 = comp.CreateTupleTypeSymbol(elementTypes); 6757var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6760var tuple2 = comp.CreateTupleTypeSymbol(elementTypes); 6795var tuple1 = (INamedTypeSymbol)((FieldSymbol)comp.GetMember("Program.F")).GetPublicSymbol().Type; 6797var underlyingType = tuple1; 6799var tuple2 = comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: default); 6835var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6836var underlyingType = tuple1.TupleUnderlyingType; 6838var tuple2 = comp.CreateTupleTypeSymbol(underlyingType, elementNullableAnnotations: default); 6865var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6868var tuple2 = comp.CreateTupleTypeSymbol(elementTypes, elementNullableAnnotations: default); 6904var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type; 6907var tuple2 = comp.CreateTupleTypeSymbol(elementTypes, elementNullableAnnotations: default); 11025var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 11346var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 11738var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 11886var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 12170var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 12460var c = comp.GetTypeByMetadataName("C"); 12539var c = comp.GetTypeByMetadataName("C"); 12932var c = comp.GetTypeByMetadataName("C"); 13014var c = comp.GetTypeByMetadataName("C"); 13135var c = comp.GetTypeByMetadataName("C"); 13298var valuetuple = comp.GetTypeByMetadataName("System.ValueTuple`2"); 13345var valuetuple = comp.GetTypeByMetadataName("System.ValueTuple`2"); 13377var valuetuple = comp.GetTypeByMetadataName("System.ValueTuple`2"); 13526var c = comp.GetTypeByMetadataName("C"); 13584var c = comp.GetTypeByMetadataName("C"); 13933var test = comp.GetTypeByMetadataName("Test"); 14006Assert.True(((INamedTypeSymbol)typeInfo.Type).IsUnboundGenericType); 14097var test = comp.GetTypeByMetadataName("Test"); 14229var test = comp.Compilation.GetTypeByMetadataName("Test`1"); 14231var m1Tuple = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M1").ReturnType; 14236m1Tuple = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M1").Parameters[0].Type; 14247m1Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14254m1Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).Parameters[0].Type; 14263var m2Tuple = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14270var f1Tuple = (INamedTypeSymbol)test.GetMember<IFieldSymbol>("F1").Type; 14277f1Tuple = (INamedTypeSymbol)((IFieldSymbol)symbolInfo.Symbol).Type; 14284var p1Tuple = (INamedTypeSymbol)test.GetMember<IPropertySymbol>("P1").Type; 14291p1Tuple = (INamedTypeSymbol)((IPropertySymbol)symbolInfo.Symbol).Type; 14316var m4TupleList = (INamedTypeSymbol)test.GetMember<IMethodSymbol>("M4").ReturnType; 14326m4TupleList = (INamedTypeSymbol)((IMethodSymbol)symbolInfo.Symbol).ReturnType; 14423var test = comp.GetTypeByMetadataName("Test`1"); 14425var e1Tuple = (INamedTypeSymbol)test.GetMember<IEventSymbol>("E1").Type; 14435e1Tuple = (INamedTypeSymbol)((IEventSymbol)symbolInfo.CandidateSymbols.Single()).Type; 14459var v1Tuple = v1Type.BaseType; 15787var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 16014var c = ((CSharpCompilation)comp.Compilation).GetTypeByMetadataName("C"); 16569var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 16606var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 18846var int_string1 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18847var int_string2 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18848var int_stringNamed = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType), ImmutableArray.Create("a", "b")); 18865var int_string2 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18866var int_stringNamed = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType), ImmutableArray.Create("a", "b")); 18884var int_int = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, intType)); 18885var int_int_int = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, intType, intType)); 18886var string_string = comp.CreateTupleTypeSymbol(ImmutableArray.Create(stringType, stringType)); 18908var int_string = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18909var int_object = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 18925var int_string1 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18926var int_object1 = comp.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 18951var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18952var int_string2 = tupleComp2.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18954var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 18976var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18977var int_string2 = tupleComp2.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 18978var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 19001var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19002var int_string2 = tupleComp2.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19003var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 19027var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19028var int_string2 = tupleComp2.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19029var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 19069var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19070var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 19071var int_object_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType, objectType)); 19108var int_string1 = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, stringType)); 19109var int_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType)); 19110var int_object_object = tupleComp1.CreateTupleTypeSymbol(ImmutableArray.Create(intType, objectType, objectType)); 20450var c1 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C1"); 20462var c2 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C2"); 20474var c3 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C3"); 20485var c4 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C4"); 20498void assertExplicitInterfaceImplementations(INamedTypeSymbol c) 20666var c1 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C1`1"); 20678var c2 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C2`1"); 20690var c3 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C3`1"); 20701var c4 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C4`1"); 20714void assertExplicitInterfaceImplementations(INamedTypeSymbol c) 20750var c3 = (INamedTypeSymbol)comp.GetTypeByMetadataName("C3`2"); 20761void assertExplicitInterfaceImplementations(INamedTypeSymbol c) 20799var c3 = comp.GetTypeByMetadataName("C3"); 24260var derivedSymbol = model.GetDeclaredSymbol(derived); 24323var derivedSymbol = model.GetDeclaredSymbol(derived); 24387var derivedSymbol = model.GetDeclaredSymbol(derived); 24460var derivedSymbol = model.GetDeclaredSymbol(derived) as INamedTypeSymbol; 24533var derivedSymbol = model.GetDeclaredSymbol(derived); 24607var derivedSymbol = model.GetDeclaredSymbol(derived); 27396var containingType = comp.GlobalNamespace.GetTypeMembers("Program").Single(); 27418var containingType = comp.GlobalNamespace.GetTypeMembers("Program").Single(); 27419VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F0").Single()).Type, TupleUnderlyingTypeValue.Null, "System.ValueTuple", "System.ValueTuple"); 27420VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F1").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Int32, System.Int32)", "(System.Int32, System.Int32)"); 27421VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F2").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Int32 A, System.Int32 B)", "(A As System.Int32, B As System.Int32)"); 27422VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F3").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)", "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)"); 27423VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F4").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object B, System.Object, System.Object D, System.Object, System.Object F, System.Object, System.Object H)", "(System.Object, B As System.Object, System.Object, D As System.Object, System.Object, F As System.Object, System.Object, H As System.Object)"); 27451INamedTypeSymbol type, 27461private static void VerifyDisplay(INamedTypeSymbol type, string expectedCSharp, string expectedVisualBasic) 27491private static void VerifyPublicType(INamedTypeSymbol type, TupleUnderlyingTypeValue expectedValue) 27493var underlyingType = type.TupleUnderlyingType; 28988var @object = comp.GetSpecialType(SpecialType.System_Object);
Emit\DeterministicTests.cs (2)
360foreach (var type in getForwardedTypes(retargeting)) 370static ImmutableArray<INamedTypeSymbol> getForwardedTypes(AssemblySymbol assembly)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (10)
Emit\EditAndContinue\EditAndContinueTests.cs (2)
73Edit(SemanticEditKind.Delete, symbolProvider: c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.FirstOrDefault(c => c.Parameters.Length == 1), newSymbolProvider: c => c.GetMember("C")), 158Edit(SemanticEditKind.Delete, symbolProvider: c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.FirstOrDefault(c => c.Parameters.Length == 1), newSymbolProvider: c => c.GetMember("C")),
Emit\NumericIntPtrTests.cs (7)
9331var type = comp.GetTypeByMetadataName("I"); 9365var type = comp.GetTypeByMetadataName("A"); 10357var fromAPI = comp.CreateNativeIntegerTypeSymbol(signed: true); 11177var nintSymbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol; 11200var symbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol;
PDB\PDBTests.cs (1)
709var stInt = c1.GetSpecialType(SpecialType.System_Int32);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (54)
Attributes\AttributeTests.cs (6)
4898var goo = compilation.GetTypeByMetadataName("Goo"); 8854var type = compilation.GetTypeByMetadataName("Library1.Goo"); 9913var typeInAttribute = (INamedTypeSymbol)type.GetAttributes()[0].ConstructorArguments.First().Value; 9923typeInAttribute = (INamedTypeSymbol)type.GetAttributes()[0].ConstructorArguments.First().Value; 11064var d = comp2.GetMember<INamedTypeSymbol>("D");
Attributes\AttributeTests_NativeInteger.cs (6)
278var type = comp.GetTypeByMetadataName("B"); 352var type = comp.GetTypeByMetadataName("B"); 435var type = comp.GetTypeByMetadataName("B"); 512var type = comp.GetTypeByMetadataName("B"); 630var type = comp.GetTypeByMetadataName("B"); 738var type = comp.GetTypeByMetadataName("B");
Attributes\AttributeTests_Nullable.cs (1)
578var attributeType = attribute.AttributeClass;
Attributes\AttributeTests_Synthesized.cs (1)
648var c1OfInt = comp.GetTypeByMetadataName("C1`1").Construct(comp.GetSpecialType(SpecialType.System_Int32));
Attributes\AttributeTests_WellKnownAttributes.cs (1)
5017var scriptClass = script.GetTypeByMetadataName("Script");
Diagnostics\GetDiagnosticsTests.cs (2)
1720var namedType = (INamedTypeSymbol)symbolContext.Symbol;
OverloadResolutionPriorityTests.cs (6)
693var c = comp3.GetTypeByMetadataName("C")!; 753var c = comp3.GetTypeByMetadataName("C")!; 801var derived = comp3.GetTypeByMetadataName("Derived")!; 904var c = ((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("C"); 986var attr = ((CSharpCompilation)verifier.Compilation).GetTypeByMetadataName("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute"); 1567var c = comp.GetTypeByMetadataName("C")!;
RefReadonlyParameterTests.cs (3)
1484var modifier = verify(m); 1496var modifier = verify(m); 1500static INamedTypeSymbol verify(ModuleSymbol m)
Semantics\ExperimentalAttributeTests.cs (6)
593var c = comp.GetTypeByMetadataName("C"); 634var c = comp.GetTypeByMetadataName("C"); 948var derived = comp.GetTypeByMetadataName("Derived"); 976var derived = comp.GetTypeByMetadataName("Derived"); 1013var derived = comp.GetTypeByMetadataName("Derived"); 1041var derived = comp.GetTypeByMetadataName("Derived");
Semantics\InlineArrayTests.cs (1)
114var t = comp.GetSpecialType(SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute);
Semantics\PrimaryConstructorTests.cs (21)
3248var c = comp.GetTypeByMetadataName("C"); 3378var c = comp.GetTypeByMetadataName("C"); 3399var c = comp.GetTypeByMetadataName("C"); 20615var namedType = symbols.OfType<INamedTypeSymbol>().Single(); 20649var namedType1 = symbols1.OfType<INamedTypeSymbol>().Single(); 20659var namedType2 = symbols2.OfType<INamedTypeSymbol>().Single(); 20693var namedType1 = symbols1.OfType<INamedTypeSymbol>().Single(); 20703var namedType2 = symbols2.OfType<INamedTypeSymbol>().Single(); 20740var namedType1 = symbols1.OfType<INamedTypeSymbol>().Single(); 20748var namedType2 = symbols2.OfType<INamedTypeSymbol>().Single(); 20790var namedType1 = symbols1.OfType<INamedTypeSymbol>().Single(); 20800var namedType2 = symbols2.OfType<INamedTypeSymbol>().Single();
Microsoft.CodeAnalysis.CSharp.Features (298)
ChangeSignature\CSharpChangeSignatureService.cs (2)
921protected override bool TryGetRecordPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor) 927if (declarationSymbol is INamedTypeSymbol namedTypeSymbol &&
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (2)
102INamedTypeSymbol suppressMessageAttribute, 130SyntaxNode targetNode, ISymbol targetSymbol, INamedTypeSymbol suppressMessageAttribute, Diagnostic diagnostic)
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (3)
225if (within != null && semanticModel.GetTypeInfo(attribute, cancellationToken).Type is INamedTypeSymbol attributeType) 241var attributeType = (INamedTypeSymbol?)semanticModel.GetTypeInfo(attribute, cancellationToken).Type;
Completion\CompletionProviders\CrefCompletionProvider.cs (2)
190var type = semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken); 221if (container is INamedTypeSymbol namedTypeContainer)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (3)
128if (type is INamedTypeSymbol namedType && namedType.OriginalDefinition != null) 157var originalDefinition = namedType.OriginalDefinition; 317static ImmutableArray<IMethodSymbol> GetOverloads(INamedTypeSymbol namedType, BaseMethodDeclarationSyntax baseMethod)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (1)
36((INamedTypeSymbol)alias.Target).IsInterfaceType() &&
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (5)
319private static INamedTypeSymbol? TryGetCompletionListType(ITypeSymbol type, INamedTypeSymbol? within, Compilation compilation) 337? DocumentationCommentId.GetSymbolsForDeclarationId(documentation.CompletionListCref, compilation).OfType<INamedTypeSymbol>().FirstOrDefault() 345private static INamedTypeSymbol? TryGetTypeWithStaticMembers(ITypeSymbol type) 350return type.WithNullableAnnotation(NullableAnnotation.NotAnnotated) as INamedTypeSymbol;
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (1)
42INamedTypeSymbol containingType,
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.ItemGetter.cs (1)
109if (containingType is not INamedTypeSymbol { TypeKind: TypeKind.Class or TypeKind.Struct or TypeKind.Interface })
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (5)
174if (semanticModel.GetTypeInfo(objectCreationExpression, cancellationToken).Type is INamedTypeSymbol type && within != null && type.TypeKind != TypeKind.Delegate) 242var type = semanticModel.GetTypeInfo(baseType.Type, cancellationToken).Type as INamedTypeSymbol; 258var expressionType = semanticModel.GetTypeInfo(invocationExpression.Expression, cancellationToken).Type as INamedTypeSymbol;
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (1)
188protected override bool IsInitializableFieldOrProperty(ISymbol fieldOrProperty, INamedTypeSymbol containingType)
Completion\CompletionProviders\ObjectCreationCompletionProvider.cs (1)
129var namedTypeSymbol = symbols.Length > 0 ? symbols[0].Symbol as INamedTypeSymbol : null;
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
148if (symbols is [INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType])
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (4)
60protected override (string displayText, string suffix, string insertionText) GetDisplayAndSuffixAndInsertionText(INamedTypeSymbol symbol, CSharpSyntaxContext context) 66protected override IEnumerable<INamedTypeSymbol>? LookupCandidateSymbols(CSharpSyntaxContext context, INamedTypeSymbol declaredSymbol, CancellationToken cancellationToken) 78protected override ImmutableArray<KeyValuePair<string, string>> GetProperties(INamedTypeSymbol symbol, CSharpSyntaxContext context)
Completion\CompletionProviders\TupleNameCompletionProvider.cs (3)
61.Cast<INamedTypeSymbol>() 91private static void AddItems(ImmutableArray<INamedTypeSymbol> inferredTypes, int index, CompletionContext context, int spanStart) 93foreach (var type in inferredTypes)
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (1)
391if (declarationSymbol is INamedTypeSymbol namedTypeSymbol)
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
76var programType = mainMethod.ContainingType;
Debugging\BreakpointResolver.cs (1)
22protected override IEnumerable<ISymbol> GetMembers(INamedTypeSymbol type, string name)
DecompiledSource\CSharpDecompiledSourceService.cs (1)
107private static string GetFullReflectionName(INamedTypeSymbol? containingType)
DocumentHighlighting\CSharpDocumentHighlightsService.cs (1)
47if (symbol is INamedTypeSymbol && symbol.Name != "var")
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (7)
990internal override bool IsPartial(INamedTypeSymbol type) 1027var recordType = (INamedTypeSymbol?)model.GetDeclaredSymbol(declaration.Parent, cancellationToken); 1273if (oldSymbol is not INamedTypeSymbol oldType || newSymbol is not INamedTypeSymbol newType) 1967internal override string GetDisplayName(INamedTypeSymbol symbol) 2530INamedTypeSymbol => RudeEditKind.None,
EditAndContinue\SyntaxUtilities.cs (1)
65RecordDeclarationSyntax recordDeclarationSyntax when symbol is not INamedTypeSymbol
EncapsulateField\CSharpEncapsulateFieldService.cs (2)
196private static string MakeUnique(string baseName, INamedTypeSymbol containingType) 202protected override IEnumerable<ConstructorDeclarationSyntax> GetConstructorNodes(INamedTypeSymbol containingType)
ExtractInterface\CSharpExtractInterfaceService.cs (3)
50internal override string GetContainingNamespaceDisplay(INamedTypeSymbol typeSymbol, CompilationOptions compilationOptions) 68INamedTypeSymbol extractedInterface, INamedTypeSymbol typeToExtractFrom,
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
131private static bool IsCoClassImplicitConversion(TypeInfo info, Conversion conversion, INamedTypeSymbol? coclassSymbol)
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (2)
44protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 58var containingType = property.ContainingType;
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (3)
60protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 65out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn) 77typeToGenerateIn = info.Type as INamedTypeSymbol;
GenerateType\CSharpGenerateTypeService.cs (4)
67if (symbol is INamedTypeSymbol type) 438return ((INamedTypeSymbol)expressionType).DelegateInvokeMethod; 509protected override INamedTypeSymbol DetermineTypeToGenerateIn(SemanticModel semanticModel, SimpleNameSyntax simpleName, CancellationToken cancellationToken) 544INamedTypeSymbol namedTypeSymbol, string[] containers, Document selectedDocument, SyntaxNode selectedDocumentRoot, CancellationToken cancellationToken)
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (4)
44protected abstract Task UpdateReferencesAsync(Project project, SolutionEditor solutionEditor, ISymbol implMember, INamedTypeSymbol containingType, CancellationToken cancellationToken); 188private MemberImplementationMap GetImplementedMembers(INamedTypeSymbol containingType, ImmutableArray<INamedTypeSymbol> interfaceTypes) 191foreach (var interfaceType in interfaceTypes)
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (2)
41ISymbol implMember, INamedTypeSymbol interfaceType, CancellationToken cancellationToken) 88SemanticModel semanticModel, INamedTypeSymbol interfaceType,
ImplementInterface\CSharpImplementImplicitlyCodeRefactoringProvider.cs (1)
45protected override Task UpdateReferencesAsync(Project project, SolutionEditor solutionEditor, ISymbol implMember, INamedTypeSymbol containingType, CancellationToken cancellationToken)
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (1)
32protected override Accessibility DetermineDefaultFieldAccessibility(INamedTypeSymbol containingType)
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
91INamedTypeSymbol tupleType, 99var tupleUnderlyingType = tupleType.TupleUnderlyingType ?? tupleType;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
124if (document.SemanticModel.GetTypeInfo(oldLambda, cancellationToken).ConvertedType is INamedTypeSymbol delegateType &&
LanguageServices\CSharpStructuralTypeDisplayService.cs (1)
33INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position)
NavigationBar\CSharpNavigationBarItemService.cs (6)
57Solution solution, SyntaxTree tree, IEnumerable<INamedTypeSymbol> types, CancellationToken cancellationToken) 63foreach (var type in types) 123private static async Task<IEnumerable<INamedTypeSymbol>> GetTypesInFileAsync(Document document, CancellationToken cancellationToken) 130private static IEnumerable<INamedTypeSymbol> GetTypesInFile(SemanticModel semanticModel, CancellationToken cancellationToken) 134var types = new HashSet<INamedTypeSymbol>(); 148types.Add((INamedTypeSymbol)type);
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
83if (semanticModel.GetTypeInfo(attribute, cancellationToken).Type is not INamedTypeSymbol attributeType)
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (2)
64if (expressionSymbol is INamedTypeSymbol namedType) 78if (expressionSymbol is not null and INamedTypeSymbol)
SignatureHelp\GenericNameSignatureHelpProvider.cs (2)
122.WhereAsArray(s => s is INamedTypeSymbol or IMethodSymbol) 178if (symbol is INamedTypeSymbol namedType)
SignatureHelp\GenericNameSignatureHelpProvider_Method.cs (1)
64if (result is not INamedTypeSymbol namedTypeSymbol || !namedTypeSymbol.IsScriptClass)
SignatureHelp\GenericNameSignatureHelpProvider_NamedType.cs (1)
12INamedTypeSymbol namedType,
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (2)
83if (invokedType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } or IFunctionPointerTypeSymbol) 131if (invokedType is INamedTypeSymbol { TypeKind: TypeKind.Delegate } expressionType)
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_DelegateAndFunctionPointerInvoke.cs (1)
20INamedTypeSymbol delegateType, CancellationToken cancellationToken)
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (3)
61semanticModel.LookupSymbols(throughExpression.SpanStart, name: throughSymbol?.Name).Any(static s => s is not INamedTypeSymbol) || 62(throughSymbol is not INamespaceOrTypeSymbol && semanticModel.LookupSymbols(throughExpression.SpanStart, container: throughSymbol?.ContainingType).Any(static s => s is not INamedTypeSymbol)); 64var includeStatic = throughSymbol is INamedTypeSymbol ||
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
71if (semanticModel.GetTypeInfo(objectCreationExpression, cancellationToken).Type is not INamedTypeSymbol type) 112INamedTypeSymbol type, CancellationToken cancellationToken)
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (1)
87if (semanticModel.GetTypeInfo(baseTypeSyntax.Type, cancellationToken).Type is not INamedTypeSymbol baseType)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (5)
125private IEnumerable<INamedTypeSymbol>? FindNearestTupleConstructionWithInferrableType(SyntaxNode root, SemanticModel semanticModel, int position, SignatureHelpTriggerInfo triggerInfo, 137var tupleTypes = inferredTypes.Where(t => t.IsTupleType).OfType<INamedTypeSymbol>().ToList(); 151SyntaxNode targetExpression, SemanticModel semanticModel, IEnumerable<INamedTypeSymbol> tupleTypes, CancellationToken cancellationToken) 165private static SignatureHelpItem Convert(INamedTypeSymbol tupleType, ImmutableArray<TaggedText> prefixParts, ImmutableArray<TaggedText> suffixParts, 179private static IEnumerable<SignatureHelpParameter> ConvertTupleMembers(INamedTypeSymbol tupleType, SemanticModel semanticModel, int position)
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
34var enclosingTypeSymbol = semanticModel.GetDeclaredSymbol(syntaxContext.ContainingTypeDeclaration!, cancellationToken);
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
91private static bool TypeCanBeConverted(INamedTypeSymbol containingType, TypeDeclarationSyntax typeDeclaration)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
51var expressionType = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName!); 64private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (6)
40private readonly INamedTypeSymbol _namedTypeSymbol; 43private SymbolAnalyzer(INamedTypeSymbol namedTypeSymbol) 54var namedTypeSymbol = (INamedTypeSymbol)context.Symbol; 73private static Location GetDiagnosticLocation(INamedTypeSymbol namedTypeSymbol) 76private static bool HasReadonlyField(INamedTypeSymbol namedTypeSymbol)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
58if (context.Symbol is not INamedTypeSymbol
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (2)
77var typeSymbol = (INamedTypeSymbol)context.Symbol;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (2)
56private void AnalyzeSyntax(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType, INamedTypeSymbol? conditionalAttributeType)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
148else if (symbolInfo.Symbol is INamedTypeSymbol { IsValueType: true, IsGenericType: false })
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
26protected override IEnumerable<TypeDeclarationSyntax> GetTypeDeclarations(INamedTypeSymbol namedType, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
31var enumerableType = context.Compilation.GetTypeByMetadataName(typeof(Enumerable).FullName!); 178SyntaxNodeAnalysisContext context, INamedTypeSymbol enumerableType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (1)
44protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (7)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 35private void AnalyzeArrayCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 65INamedTypeSymbol? expressionType, 101var ienumerableType = convertedType.OriginalDefinition.SpecialType is SpecialType.System_Collections_Generic_IEnumerable_T 102? (INamedTypeSymbol)convertedType 122INamedTypeSymbol? expressionType, 138private void AnalyzeArrayInitializerExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37INamedTypeSymbol? expressionType) 104INamedTypeSymbol? expressionType, 129var factoryType = semanticModel.GetSymbolInfo(memberAccessExpression.Expression, cancellationToken).Symbol as INamedTypeSymbol;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 26private void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
24protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 27private void AnalyzeMemberAccess(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
66protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 69private void AnalyzeMemberAccess(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 119INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (4)
25protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31private void AnalyzeObjectCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 34private void AnalyzeImplicitObjectCreationExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 38SyntaxNodeAnalysisContext context, BaseObjectCreationExpressionSyntax objectCreationExpression, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (4)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 41private void AnalyzeImplicitStackAllocExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 83private void AnalyzeExplicitStackAllocExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) 126INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (11)
64INamedTypeSymbol? expressionType, 83INamedTypeSymbol? expressionType, 327if (type is INamedTypeSymbol namedType) 738INamedTypeSymbol? expressionType, 884if (semanticModel.GetSymbolInfo(memberAccessExpression.Expression, cancellationToken).Symbol is not INamedTypeSymbol factoryType) 934Type: INamedTypeSymbol 981Type: INamedTypeSymbol 1061public static bool EqualsOrImplements(ITypeSymbol type, INamedTypeSymbol? interfaceType) 1068foreach (var baseInterface in type.AllInterfaces) 1110if (expressionSymbol is not INamedTypeSymbol) 1142if (expressionSymbol is not INamedTypeSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
52INamedTypeSymbol? expressionType,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (5)
92[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 122[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 141[NotNullWhen(true)] out INamedTypeSymbol? tupleType, 168if (type is not INamedTypeSymbol { IsTupleType: true, TupleElements.Length: >= 2 } tupleTypeOpt) 202SemanticModel semanticModel, INamedTypeSymbol tupleType,
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (1)
62methodSymbol.ReturnType is INamedTypeSymbol namedType &&
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (1)
61return method.ReturnType is INamedTypeSymbol namedType && namedType.Arity != 0;
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
42if (semanticModel.GetTypeInfo(declaration, cancellationToken).ConvertedType is not INamedTypeSymbol lambdaType || lambdaType.DelegateInvokeMethod == null)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
84var arrayType = compilation.GetSpecialType(SpecialType.System_Array);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (5)
27public readonly INamedTypeSymbol IndexType; 29public readonly INamedTypeSymbol? ExpressionOfTType; 37private InfoCache(INamedTypeSymbol indexType, INamedTypeSymbol? expressionOfTType) 74var containingType = method.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (8)
28public readonly INamedTypeSymbol RangeType; 29public readonly INamedTypeSymbol? ExpressionOfTType; 33private InfoCache(INamedTypeSymbol rangeType, INamedTypeSymbol stringType, INamedTypeSymbol? expressionOfTType) 74var stringType = compilation.GetSpecialType(SpecialType.System_String); 79private static IMethodSymbol? GetSliceLikeMethod(INamedTypeSymbol namedType) 136var containingType = sliceLikeMethod.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
85private void AnalyzeIsTypeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (7)
64var expressionType = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName!); 77private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext, INamedTypeSymbol? expressionType) 114var delegateType = semanticModel.GetTypeInfo(anonymousFunction, cancellationToken).ConvertedType as INamedTypeSymbol; 237SemanticModel semanticModel, INamedTypeSymbol? expressionTypeOpt, ISymbol local, BlockSyntax block, 389INamedTypeSymbol delegateType, 394var delegateContainingType = delegateType.ContainingType;
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
81INamedTypeSymbol? containingType = null;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (1)
52INamedTypeSymbol? expressionOfTType)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (16)
79var namedTypeToAnalyzer = new ConcurrentDictionary<INamedTypeSymbol, Analyzer>(); 85INamedTypeSymbol namedType, 142INamedTypeSymbol namedType, 145ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer) 150private readonly INamedTypeSymbol _namedType = namedType; 154private readonly ConcurrentDictionary<INamedTypeSymbol, Analyzer> _namedTypeToAnalyzer = namedTypeToAnalyzer; 204ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer) 209var startSymbol = (INamedTypeSymbol)context.Symbol; 215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType) 245INamedTypeSymbol namedType) 260Analyzer? TryCreateAnalyzer(INamedTypeSymbol namedType) 340INamedTypeSymbol namedType, 385INamedTypeSymbol namedType, 406INamedTypeSymbol namedType, 463INamedTypeSymbol namedType,
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
79var namedType = (INamedTypeSymbol)context.Symbol;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
55var expressionType = context.Compilation.GetTypeByMetadataName(typeof(System.Linq.Expressions.Expression<>).FullName!); 60private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
65var type = constructorSymbol.ContainingType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (5)
41if (semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol 81INamedTypeSymbol type, 277var iEquatable = ConvertToRecordHelpers.GetIEquatableType(semanticModel.Compilation, type); 376INamedTypeSymbol type, 471INamedTypeSymbol type,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
32var type = methodSymbol.ContainingType; 33var equatableType = GetIEquatableType(compilation, type); 67public static INamedTypeSymbol? GetIEquatableType(Compilation compilation, INamedTypeSymbol containingType) 497var type = methodSymbol.ContainingType; 856MatchedType: INamedTypeSymbol matchedType, 882INamedTypeSymbol type, 959INamedTypeSymbol type, 1100private static bool OverridesEquals(Compilation compilation, IMethodSymbol equals, INamedTypeSymbol? equatableType) 1109var objectType = compilation.GetSpecialType(SpecialType.System_Object);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (4)
37INamedTypeSymbol type, 75INamedTypeSymbol currentType, 78var baseType = currentType.BaseType; 119INamedTypeSymbol containingType)
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
97INamedTypeSymbol? taskType = null;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (8)
29protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 47out INamedTypeSymbol typeToGenerateIn) 85out INamedTypeSymbol typeToGenerateIn) 100typeToGenerateIn = symbolInfo.GetAnySymbol() as INamedTypeSymbol; 117out INamedTypeSymbol typeToGenerateIn) 135typeToGenerateIn = symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol as INamedTypeSymbol; 152out INamedTypeSymbol typeToGenerateIn) 159if (typeInfo.Type is INamedTypeSymbol typeSymbol)
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
27[NotNullWhen(true)] out INamedTypeSymbol? classType) 38classType = semanticDocument.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
109var codeActions = await service.GenerateDeconstructMethodAsync(document, target, (INamedTypeSymbol)type, cancellationToken).ConfigureAwait(false);
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (12)
39protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 61out INamedTypeSymbol typeToGenerateIn) 87out INamedTypeSymbol typeToGenerateIn) 112out INamedTypeSymbol typeToGenerateIn) 140out INamedTypeSymbol typeToGenerateIn) 143typeToGenerateIn = document.SemanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type as INamedTypeSymbol; 145|| document.SemanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type is not INamedTypeSymbol parameterSymbol 171out INamedTypeSymbol typeToGenerateIn) 174typeToGenerateIn = document.SemanticModel.GetTypeInfo(expression, cancellationToken).ConvertedType as INamedTypeSymbol; 176|| document.SemanticModel.GetTypeInfo(expression, cancellationToken).Type is not INamedTypeSymbol parameterSymbol 197INamedTypeSymbol typeToGenerateIn, INamedTypeSymbol parameterSymbol)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (2)
28protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 61if (targetType is not INamedTypeSymbol { IsTupleType: true, TupleElements: var tupleElements })
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (3)
35protected override bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType) 53out INamedTypeSymbol typeToGenerateIn) 67typeToGenerateIn = semanticInfo.Type as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (5)
43out SyntaxNode classOrStructDecl, out INamedTypeSymbol classOrStructType, out ImmutableArray<INamedTypeSymbol> interfaceTypes) 62if (interfaceSymbolInfo.GetAnySymbol() is INamedTypeSymbol interfaceType && interfaceType.TypeKind == TypeKind.Interface) 65classOrStructType = model.GetDeclaredSymbol(classOrStructDecl, cancellationToken) as INamedTypeSymbol; 93SyntaxGenerator g, INamedTypeSymbol classType, string disposeMethodDisplayString)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (6)
118var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 119var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!); 120var ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!); 121var ienumeratorGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator<>).FullName!); 191var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 192var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
113[NotNullWhen(true)] out INamedTypeSymbol? ienumerableSymbol, 114[NotNullWhen(true)] out INamedTypeSymbol? ienumerableGenericSymbol)
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (2)
49var structDeclarationSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(structDeclaration, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
123var flagsAttribute = compilation.GetTypeByMetadataName(typeof(FlagsAttribute).FullName!);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
101SemanticModel semanticModel, ExpressionSyntax expression, INamedTypeSymbol? expressionType)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (6)
77out var tupleType, out memberAccessExpressions, 93out var tupleType, out memberAccessExpressions, 116private ForEachVariableStatementSyntax CreateForEachVariableStatement(INamedTypeSymbol tupleType, ForEachStatementSyntax forEachStatement) 134INamedTypeSymbol tupleType, LocalDeclarationStatementSyntax declarationStatement, VariableDeclaratorSyntax variableDeclarator) 148private ExpressionSyntax CreateTupleOrDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode) 159private static DeclarationExpressionSyntax CreateDeclarationExpression(INamedTypeSymbol tupleType, TypeSyntax typeNode)
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (3)
81var lambdaType = (INamedTypeSymbol)semanticModel.GetTypeInfo(declaration).ConvertedType!; 101var taskType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Task).FullName!);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
177var elements = ((INamedTypeSymbol)typeSymbol).TupleElements;
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
101var delegateType = (INamedTypeSymbol)semanticModel.GetTypeInfo(anonymousFunction, cancellationToken).ConvertedType; 177INamedTypeSymbol delegateType, ParameterListSyntax parameterList,
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (3)
320INamedTypeSymbol { ContainingType: { } containingType } => CreateDottedName(originalName, currentName, containingType), 331INamedTypeSymbol containingType) 392semanticModel.GetSymbolInfo(baseType.Type, cancellationToken).GetAnySymbol() is INamedTypeSymbol { TypeKind: TypeKind.Class })
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
65conversion.Type is INamedTypeSymbol { IsGenericType: true } namedType &&
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (2)
63INamedTypeSymbol? expressionType) 111INamedTypeSymbol? expressionType,
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (196)
EditAndContinue\ActiveStatementTests.cs (3)
11992SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F2")), 12018SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), 12041SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")),
EditAndContinue\Helpers\EditingTestBase.cs (2)
112=> new(kind, symbolProvider, (partialType != null) ? c => c.GetMember<INamedTypeSymbol>(partialType) : null, syntaxMap, rudeEdits, hasSyntaxMap: syntaxMap != null, deletedSymbolContainerProvider: null); 115=> new(kind, symbolProvider, (partialType != null) ? c => c.GetMember<INamedTypeSymbol>(partialType) : null, syntaxMap: null, rudeEdits: null, preserveLocalVariables, deletedSymbolContainerProvider);
EditAndContinue\LineEditTests.cs (15)
779SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters is [{ Type.SpecialType: SpecialType.System_Boolean }]), preserveLocalVariables: true) 830semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)]); 1113semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)]); 1170semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)], 1245semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)]); 1379semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true)]); 1424SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 1495SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1519SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1543SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1567SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1591SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1614SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1643SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) 1880semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)]);
EditAndContinue\StatementEditingTests.cs (9)
3768SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("F").Single(), preserveLocalVariables: true) 4782SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "x" }]), preserveLocalVariables: true)); 4807SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); 4820SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); 4834SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); 5300[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "x" }]), preserveLocalVariables: true)], 5324[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)], 5337[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)], 5352[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)],
EditAndContinue\TopLevelEditingTests.cs (166)
887SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")) 2218SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("M")) 2528SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("M")), 2540[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C"), preserveLocalVariables: false)], 2560SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G"), preserveLocalVariables: false) 2608SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), 2609SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember("F")), 2610SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), 2669SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), 2670SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), 2671SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), 2672SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), 2673SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), 2674SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), 2723SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), 2724SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), 2725SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), 2726SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), 2727SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), 2728SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), 3462SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Length == 0), preserveLocalVariables: true)); 3474SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); 6175semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F"))]), 6178semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G"))]), 6290semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F1"))]), 6298semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F2"))]), 6733SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("M.C"), partialType: "M.C"), 6738SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("M.C"), partialType: "M.C"), 7004SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F"), preserveLocalVariables: false) 7110SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("Finalize"), preserveLocalVariables: false), 7305SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 7306SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 7326SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) 7386SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) 7514SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); 7529SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); 7570SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IMethodSymbol>("M"))); 10627SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Addition")) 10633SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Implicit")) 11005SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), deletedSymbolContainerProvider: c => c.GetMember("C")), 11006SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single()) 11133SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), deletedSymbolContainerProvider: c => c.GetMember("C")), 11134SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single()), 11535SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), deletedSymbolContainerProvider: c => c.GetMember("C")), 11536SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single()) 11686SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single()) 12221SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "a"}]), partialType: "C", preserveLocalVariables: true) 12250SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "P"}]), partialType: "C", preserveLocalVariables: true), 12274SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "P" }]), partialType: "C", preserveLocalVariables: true), 12303SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "P" }]), partialType: "C", preserveLocalVariables: true), 12340SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "P" }]), partialType: "C", preserveLocalVariables: true), 12371SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "P" }])), 12372SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters is []), partialType: "C", preserveLocalVariables: true), 12448SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)); 12477SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12534SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12682SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12712SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12742SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12772SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 12810SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("C").PartialImplementationPart, partialType: "C")); 12840SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X" }])) 12855SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X" }])) 12887SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X"}])), 13058SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters.Length == 1), partialType: "C") 13065SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters.Length == 2), partialType: "C") 13297SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X" }]), deletedSymbolContainerProvider: c => c.GetMember("C")) 13312SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X" }]), deletedSymbolContainerProvider: c => c.GetMember("C")) 13352SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "X"}]), deletedSymbolContainerProvider: c => c.GetMember("C")), 13470[SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "x" }]), deletedSymbolContainerProvider: c => c.GetMember("C"))], 13483[SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [{ Name: "b" }]), deletedSymbolContainerProvider: c => c.GetMember("C"))], 13496[SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.FirstOrDefault(c => c.Parameters.Length == 1), deletedSymbolContainerProvider: c => c.GetMember("C"))], 13564SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is []), preserveLocalVariables: true)); 13627semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters.Length == 1), deletedSymbolContainerProvider: c => c.GetMember("C"))]), 13630semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.Parameters.Length == 2), deletedSymbolContainerProvider: c => c.GetMember("C"))]) 13980[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 14025[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 14084[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 14130[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])], 14242SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Int32"), partialType: "C", syntaxMap: syntaxMapB), 14243SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Boolean"), partialType: "C", syntaxMap: syntaxMapB), 14244SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "UInt32"), partialType: "C", syntaxMap: syntaxMapB), 14245SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Byte"), partialType: "C"), 14347SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), 14368SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), 14450[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single())], 14472SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) 14492SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) 14753SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true)); 14772SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), partialType: "C", preserveLocalVariables: true) 14857SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 14876[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true)]); 14889[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true)]); 14959[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true)]); 14972[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true)]); 15068SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), 15069SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(string)"), preserveLocalVariables: true), 15087SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), 15088SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), 15103SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), 15104SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), 15119SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), 15120SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), 15138SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true) 15155[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single())]); 15172[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single())], 15585SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) 15600SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) 15618SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) 15633SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) 15718[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 15751[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 15788[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 15825[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0])]); 15865SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), 15866SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) 15907SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), 15908SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) 15949SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), 15950SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) 15991SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) 16032SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) 16073SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) 16114SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) 16155SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) 16195SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) 16252SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) 16291SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) 16330SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) 16392SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters is [_, _]), preserveLocalVariables: true), 16430SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), 16431SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]), 16465SemanticEdit(SemanticEditKind.Update, c => ((IPropertySymbol)c.GetMember<INamedTypeSymbol>("C").GetMembers("P").First()).GetMethod), 17079SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) 17119SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) 17262SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single()), 17728SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 17744SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod, preserveLocalVariables: false), 18356[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod)], 18373[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18386[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18526[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18539[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18552[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18573[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))], 18977SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 18978SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 19000SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), 19001SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod) 19025SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 19026SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 19027SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), 19028SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod), 19051SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 19052SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 19073semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod)]), 19153SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), 19154SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P3").SetMethod, preserveLocalVariables: false) 20381[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod)], 20802SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("E")) 20964SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").AddMethod), 20965SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").RemoveMethod) 21521SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) 21683SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true)
ExtractClass\ExtractClassTests.cs (1)
3108INamedTypeSymbol originalSymbol,
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (3)
IOperation\IOperationTests_ICompoundAssignmentOperation.cs (1)
84var typeSymbol = compilation.GetTypeByMetadataName("C");
IOperation\IOperationTests_IFieldReferenceExpression.cs (2)
708var classSym = (INamedTypeSymbol)model.GetDeclaredSymbol(classDecl);
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (8)
InteractiveSessionTests.cs (8)
489var c2C2 = (INamedTypeSymbol)lookupMember(compilation2, "Submission#1", "C2"); 490var c2C1 = c2C2.BaseType; 500var c3C3 = (INamedTypeSymbol)lookupMember(compilation3, "Submission#2", "C3"); 501var c3C1 = c3C3.BaseType; 505INamedTypeSymbol lookupType(Compilation c, string name) 507return c.GlobalNamespace.GetMembers(name).Single() as INamedTypeSymbol;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (268)
Semantics\AccessCheckTests.cs (33)
740INamedTypeSymbol classA = globalNS.GetMembers("A").Single() as INamedTypeSymbol; 744INamedTypeSymbol classADerived = globalNS.GetMembers("ADerived").Single() as INamedTypeSymbol; 745INamedTypeSymbol classADerived2 = globalNS.GetMembers("ADerived2").Single() as INamedTypeSymbol; 746INamedTypeSymbol classB = globalNS.GetMembers("B").Single() as INamedTypeSymbol; 747INamedTypeSymbol classK = classA.GetMembers("K").Single() as INamedTypeSymbol; 860INamedTypeSymbol classOther = otherGlobalNS.GetMembers("Other").Single() as INamedTypeSymbol; 901INamedTypeSymbol Outer = globalNS.GetMembers("Outer").Single() as INamedTypeSymbol; 902INamedTypeSymbol Outer_Inner = Outer.GetMembers("Inner").Single() as INamedTypeSymbol; 908INamedTypeSymbol Other = globalNS.GetMembers("Other").Single() as INamedTypeSymbol; 909INamedTypeSymbol Private = globalNS.GetMembers("Private").Single() as INamedTypeSymbol; 912INamedTypeSymbol Derived = globalNS.GetMembers("Derived").Single() as INamedTypeSymbol; 936INamedTypeSymbol InOtherCompilation = c2.GlobalNamespace.GetMember("InOtherCompilation") as INamedTypeSymbol; 943INamedTypeSymbol InFriendCompilation = c3.GlobalNamespace.GetMember("InFriendCompilation") as INamedTypeSymbol; 959var classC = compilation.GlobalNamespace.GetMembers("C").OfType<INamedTypeSymbol>().Single(); 960var classQ = compilation.GlobalNamespace.GetMembers("Q").OfType<INamedTypeSymbol>().Single(); 969var c2 = ((Compilation)c).GlobalNamespace.GetMembers("C").OfType<INamedTypeSymbol>().Single(); 973classQ = ((Compilation)c).GlobalNamespace.GetMembers("Q").OfType<INamedTypeSymbol>().Single();
Semantics\BindingTests.cs (3)
2599var c = comp.GlobalNamespace.GetTypeMembers("C").Single(); 2630var c = comp.GlobalNamespace.GetTypeMembers("C").Single(); 2659var c = comp.GlobalNamespace.GetTypeMembers("C").Single();
Semantics\DeconstructionTests.cs (4)
4273Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[0].TypeKind); 4274Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[1].TypeKind); 4532Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[0].TypeKind); 4533Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[1].TypeKind);
Semantics\DelegateTypeTests.cs (10)
905Assert.True(HaveMatchingSignatures(((INamedTypeSymbol)typeInfo.Type!).DelegateInvokeMethod!, method)); 948Assert.True(HaveMatchingSignatures(((INamedTypeSymbol)typeInfo.Type!).DelegateInvokeMethod!, method)); 8059Assert.True(HaveMatchingSignatures(((INamedTypeSymbol)typeInfo.Type!).DelegateInvokeMethod!, method)); 14381var expectedBaseType = ((CSharpCompilation)model.Compilation).GetSpecialType(SpecialType.System_MulticastDelegate); 14384var delegateType = (INamedTypeSymbol)local.Type; 14401var type = (INamedTypeSymbol)model.GetTypeInfo(variable).Type!; 15591var objectType = comp.GetSpecialType(SpecialType.System_Object); 15592var stringType = comp.GetSpecialType(SpecialType.System_String);
Semantics\DynamicTests.cs (1)
4157var typeObject = comp.GetSpecialType(SpecialType.System_Object);
Semantics\FunctionPointerTests.cs (2)
2006var derived = comp.GetTypeByMetadataName("Derived"); 2123var d = comp.GetTypeByMetadataName("D");
Semantics\InitOnlyMemberTests.cs (6)
4259var s = verifier.Compilation.GetTypeByMetadataName("S"); 4298var s = verifier.Compilation.GetTypeByMetadataName("S"); 4338var s = verifier.Compilation.GetTypeByMetadataName("S"); 4380var s = ((Compilation)comp).GetTypeByMetadataName("S"); 4403var s = ((Compilation)comp).GetTypeByMetadataName("S"); 4434var s = verifier.Compilation.GetTypeByMetadataName("S");
Semantics\InteractiveSemanticModelTests.cs (2)
43var symbol = model.GetDeclaredSymbol(classB); 44var baseType = symbol?.BaseType;
Semantics\InterpolationTests.cs (12)
6953var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7028var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7106var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7181var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7289var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7329var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7369var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7409var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7486var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7563var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7644var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 7806var customHandler = comp.GetTypeByMetadataName("CustomHandler");
Semantics\LocalFunctionTests.cs (2)
556var aAttribute = comp.GetTypeByMetadataName("A"); 820var aAttribute = comp.GetTypeByMetadataName("A");
Semantics\LockTests.cs (5)
510var symbol = compilation.GetTypeByMetadataName("Test"); 529var symbol = compilation.GetTypeByMetadataName("Test"); 648var symbol = compilation.GetTypeByMetadataName("System.Type"); 667var symbol = compilation.GetSpecialType(SpecialType.System_String); 688var symbol = compilation.GetSpecialType(SpecialType.System_String);
Semantics\LookupTests.cs (6)
690var baseExprType = (INamedTypeSymbol)baseExprInfo.Type; 1529INamedTypeSymbol typeInnerZ = namespaceY.GetTypeMembers("InnerZ").Single(); 1533var typeA = (INamedTypeSymbol)actual_lookupSymbols.Where((sym) => sym.Name.Equals("A") && sym.Kind == SymbolKind.NamedType).Single(); 1534INamedTypeSymbol typeB = typeA.GetTypeMembers("B").Single();
Semantics\MultiDimensionalArrayTests.cs (2)
1092var test = compilation.GetTypeByMetadataName("Test"); 1680var p = compilation.GetTypeByMetadataName("Program");
Semantics\NativeIntegerTests.cs (38)
106var type = comp.GetTypeByMetadataName("System.IntPtr"); 202var type = comp.GetTypeByMetadataName("System.IntPtr"); 235private static void VerifyType(INamedTypeSymbol type, bool signed, bool isNativeInt) 250private static void VerifyTypes(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed) 275private static void VerifyInterfaces(INamedTypeSymbol underlyingType, ImmutableArray<INamedTypeSymbol> underlyingInterfaces, INamedTypeSymbol nativeIntegerType, ImmutableArray<INamedTypeSymbol> nativeIntegerInterfaces) 284void verifyInterface(INamedTypeSymbol underlyingInterface, INamedTypeSymbol nativeIntegerInterface) 297private static void VerifyMembers(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed) 508private static void VerifyMembers(INamedTypeSymbol type) 527static void verifyMembers(INamedTypeSymbol type, ImmutableArray<ISymbol> allMembers, ImmutableArray<ISymbol> members) 536static void verifyMember(INamedTypeSymbol type, ISymbol member) 732private static void VerifyErrorType(INamedTypeSymbol type, SpecialType specialType, bool isNativeInt) 754private static void VerifyErrorTypes(INamedTypeSymbol underlyingType, INamedTypeSymbol nativeIntegerType, bool signed) 1615var type = comp.CreateNativeIntegerTypeSymbol(signed); 1621var type = comp.CreateNativeIntegerTypeSymbol(signed); 1624var underlyingType = type.NativeIntegerUnderlyingType; 1627Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.None)).NativeIntegerUnderlyingType); 1628Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.Annotated)).NativeIntegerUnderlyingType); 1629Assert.Same(underlyingType, ((INamedTypeSymbol)type.WithNullableAnnotation(CodeAnalysis.NullableAnnotation.NotAnnotated)).NativeIntegerUnderlyingType); 3636var underlyingType = model.GetDeclaredSymbol(nodes.OfType<ClassDeclarationSyntax>().Single()); 13572var type = comp.GetTypeByMetadataName("I"); 13608var type = comp.GetTypeByMetadataName("A"); 13667var type = comp.GetTypeByMetadataName("A"); 13730var type = comp.GetTypeByMetadataName("A"); 15321var nintSymbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol; 15342var nintSymbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol; 15365var symbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol; 15416var symbol = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol;
Semantics\NullableConversionTests.cs (1)
812var nullableIntType = compilation.GetSpecialType(SpecialType.System_Nullable_T).Construct(compilation.GetSpecialType(SpecialType.System_Int32));
Semantics\NullableReferenceTypesTests.cs (93)
6467var c = comp.GetTypeByMetadataName("C"); 6489var c = comp.GetTypeByMetadataName("C"); 11453var b = compilation.GetTypeByMetadataName("B"); 11504var b = compilation.GetTypeByMetadataName("B"); 11567var b = compilation.GetTypeByMetadataName("B"); 11626var b = compilation.GetTypeByMetadataName("B"); 11631var d = compilation.GetTypeByMetadataName("D"); 11698var b = compilation.GetTypeByMetadataName("B"); 11731var b = compilation.GetTypeByMetadataName("B"); 11766var b = compilation.GetTypeByMetadataName("B"); 11847var b = compilation.GetTypeByMetadataName("B"); 11891var b = compilation.GetTypeByMetadataName("B"); 11929var b = compilation.GetTypeByMetadataName("B"); 12014var b = compilation.GetTypeByMetadataName("B"); 12097var b = compilation.GetTypeByMetadataName("B"); 12185var b = compilation.GetTypeByMetadataName("B"); 12257var b = compilation.GetTypeByMetadataName("B"); 12329var type = compilation.GetTypeByMetadataName(typeName); 12343var type = compilation.GetTypeByMetadataName(typeName); 12411var b1 = compilation.GetTypeByMetadataName("B1"); 12418var b2 = compilation.GetTypeByMetadataName("B2"); 12684var ia = compilation.GetTypeByMetadataName("IA"); 12692var type = compilation.GetTypeByMetadataName(typeName); 12703var type = compilation.GetTypeByMetadataName(typeName); 12711var type = compilation.GetTypeByMetadataName(typeName); 12780var ia = compilation.GetTypeByMetadataName("IA"); 12781var b1 = compilation.GetTypeByMetadataName("B1"); 12799var type = compilation.GetTypeByMetadataName(typeName); 12895var type = compilation.GetTypeByMetadataName(typeName); 13031var b = compilation.GetTypeByMetadataName("B"); 13047var type = compilation.GetTypeByMetadataName(typeName); 13122var b = compilation.GetTypeByMetadataName("B"); 13138var type = compilation.GetTypeByMetadataName(typeName); 13203var b = compilation.GetTypeByMetadataName("B"); 13319var ia = compilation.GetTypeByMetadataName("IA"); 13320var b = compilation.GetTypeByMetadataName("B"); 13408var ia = compilation.GetTypeByMetadataName("IA"); 13409var b = compilation.GetTypeByMetadataName("B"); 13685var b = compilation.GetTypeByMetadataName("B"); 13896var b = compilation.GetTypeByMetadataName("B"); 13965var b = compilation.GetTypeByMetadataName("B"); 14024var b = compilation.GetTypeByMetadataName("B"); 14131var b = compilation.GetTypeByMetadataName("B"); 14227var b = compilation.GetTypeByMetadataName("B"); 14232var d = compilation.GetTypeByMetadataName("D"); 14283var b = compilation.GetTypeByMetadataName("B"); 14288var d = compilation.GetTypeByMetadataName("D"); 16496var ia = compilation.GetTypeByMetadataName("IA"); 16497var b = compilation.GetTypeByMetadataName("B"); 16646var type = compilation.GetTypeByMetadataName(typeName); 16731var type = compilation.GetTypeByMetadataName(typeName); 16816var type = compilation.GetTypeByMetadataName(typeName); 17726var ia = compilation.GetTypeByMetadataName("IA"); 17727var b = compilation.GetTypeByMetadataName("B"); 17794var ia = compilation.GetTypeByMetadataName("IA"); 17795var b = compilation.GetTypeByMetadataName("B"); 17835var c = compilation.GetTypeByMetadataName("C"); 17874var c1 = compilation.GetTypeByMetadataName("C1"); 76966var b = compilation.GetTypeByMetadataName("B"); 76989var f = compilation.GetTypeByMetadataName("F"); 111007var c = comp.GetTypeByMetadataName("C`2"); 112806var b = comp.GetTypeByMetadataName("A`2+B"); 112891var b = comp.GetTypeByMetadataName("A`2+B"); 112910var b = comp.GetTypeByMetadataName("A`1+B"); 112930var b = comp.GetTypeByMetadataName("A`1+B"); 113007var b = comp.GetTypeByMetadataName("A`2+B"); 113087var b = comp.GetTypeByMetadataName("A`2+B"); 113108var a = comp.GetTypeByMetadataName("A"); 113649var a = comp.GetTypeByMetadataName("A`1"); 113668var a = comp.GetTypeByMetadataName("A`1"); 113692var a = comp.GetTypeByMetadataName("A`1"); 113714var a = comp.GetTypeByMetadataName("A`1"); 113747var a = comp.GetTypeByMetadataName("A`1"); 113768var a = comp.GetTypeByMetadataName("A`1"); 116670var a = compilation4.GetTypeByMetadataName("A"); 116671var b = compilation4.GetTypeByMetadataName("B"); 116672var c = compilation4.GetTypeByMetadataName("C"); 116673var d = compilation4.GetTypeByMetadataName("D"); 116674var i1 = compilation4.GetTypeByMetadataName("I1"); 157921var i3 = comp.GetTypeByMetadataName("I3"); 157955var i3 = comp.GetTypeByMetadataName("I3"); 157993var i3 = comp.GetTypeByMetadataName("I3"); 158021var i3 = comp.GetTypeByMetadataName("I3"); 158053var i3 = comp.GetTypeByMetadataName("I3"); 158222var i3 = comp.GetTypeByMetadataName("I3"); 158263var i3 = comp.GetTypeByMetadataName("I3"); 158303var i3 = comp.GetTypeByMetadataName("I3"); 158481var i3 = comp.GetTypeByMetadataName("I3"); 158517var i3 = comp.GetTypeByMetadataName("I3"); 158559var i3 = comp.GetTypeByMetadataName("I3"); 158640var i3 = comp.GetTypeByMetadataName("I3"); 158672var i3 = comp.GetTypeByMetadataName("I3"); 158706var i3 = comp.GetTypeByMetadataName("I3");
Semantics\NullCoalesceAssignmentTests.cs (6)
33var cType = comp.GetTypeByMetadataName("C"); 70var cType = comp.GetTypeByMetadataName("C"); 71var dType = comp.GetTypeByMetadataName("D"); 113var cType = comp.GetTypeByMetadataName("C"); 114var dType = comp.GetTypeByMetadataName("D"); 160var int32 = comp.GetSpecialType(SpecialType.System_Int32);
Semantics\RawInterpolationTests_Handler.cs (11)
5228var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5315var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5405var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5492var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5579var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5626var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5673var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5762var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5851var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5944var customHandler = comp.GetTypeByMetadataName("CustomHandler"); 5974var customHandler = comp.GetTypeByMetadataName("CustomHandler");
Semantics\ReadOnlyStructsTests.cs (6)
1190var s1 = (INamedTypeSymbol)comp.GetSymbolsWithName("S1").Single(); 1211var s2 = comp.GetMember<INamedTypeSymbol>("S2"); 1227static IMethodSymbol getMethod(INamedTypeSymbol symbol, string name) => (IMethodSymbol)symbol.GetMembers(name).Single(); 1228static IPropertySymbol getProperty(INamedTypeSymbol symbol, string name) => (IPropertySymbol)symbol.GetMembers(name).Single(); 1229static IEventSymbol getEvent(INamedTypeSymbol symbol, string name) => (IEventSymbol)symbol.GetMembers(name).Single();
Semantics\StructConstructorTests.cs (1)
4893private static void VerifyExplicitlyDeclaredInstanceConstructors(INamedTypeSymbol type, params string[] expectedConstructors)
Semantics\TopLevelStatementsTests.cs (7)
1679var testType = ((Compilation)comp).GetTypeByMetadataName("Test"); 1852var testType = ((Compilation)comp).GetTypeByMetadataName("Test"); 2078var testType = ((Compilation)comp).GetTypeByMetadataName("Test"); 2242var testType = ((Compilation)comp).GetTypeByMetadataName("Test"); 2420var testType = ((Compilation)comp).GetTypeByMetadataName("Test"); 3935var testType = ((Compilation)comp).GetTypeByMetadataName("args"); 4084var testType = ((Compilation)comp).GetTypeByMetadataName("args");
Semantics\UnsafeTests.cs (8)
8165var intType = compilation.GetSpecialType(SpecialType.System_Int32); 8232var intType = compilation.GetSpecialType(SpecialType.System_Int32); 8290var intType = compilation.GetSpecialType(SpecialType.System_Int32); 10218var stringSymbol = compilation.GetSpecialType(SpecialType.System_String); 10219var charSymbol = compilation.GetSpecialType(SpecialType.System_Char); 10290var stringSymbol = compilation.GetSpecialType(SpecialType.System_String); 10291var charSymbol = compilation.GetSpecialType(SpecialType.System_Char); 10293var voidSymbol = compilation.GetSpecialType(SpecialType.System_Void);
Semantics\UseSiteErrorTests.cs (5)
2358var a = compilation4.GetTypeByMetadataName("A"); 2359var b = compilation4.GetTypeByMetadataName("B"); 2360var c = compilation4.GetTypeByMetadataName("C"); 2361var d = compilation4.GetTypeByMetadataName("D"); 2362var i1 = compilation4.GetTypeByMetadataName("I1");
SourceGeneration\GeneratorDriverTests.cs (3)
140var generatedClass = outputCompilation.GlobalNamespace.GetTypeMembers("GeneratedClass").Single(); 918INamedTypeSymbol? dSymbol = null; 945INamedTypeSymbol? dSymbol = null;
SourceGeneration\SyntaxAwareGeneratorTests.cs (1)
790var dType = ctx.SemanticModel.Compilation.GetTypeByMetadataName("D");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (951)
Compilation\CompilationAPITests.cs (15)
2461var elementType = comp.GetSpecialType(SpecialType.System_Object); 2490var elementType = comp.GetSpecialType(SpecialType.System_Object); 2606var type = compilation.CreateAnonymousTypeSymbol( 2625var type = compilation.CreateAnonymousTypeSymbol( 2642var type = compilation.CreateAnonymousTypeSymbol( 2661var type = comp.CreateAnonymousTypeSymbol(memberTypes, memberNames); 2688var type = comp.CreateAnonymousTypeSymbol(ImmutableArray<ITypeSymbol>.Empty, ImmutableArray<string>.Empty, memberNullableAnnotations: ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty); 2701var type = comp.CreateAnonymousTypeSymbol(memberTypes, memberNames); 2770var fakeIntType = compilation.CreateErrorTypeSymbol(compilation.CreateErrorNamespaceSymbol(compilation.GlobalNamespace, "System"), "Int32", arity: 0); 2960var fakeIntType = compilation.CreateErrorTypeSymbol(compilation.CreateErrorNamespaceSymbol(compilation.GlobalNamespace, "System"), "Int32", arity: 0); 3031var genericType = (INamedTypeSymbol)comp.GetMember("Pair"); 3037var type = genericType.Construct(typeArguments, default); 3644var type = ((Compilation)current).GetTypeByMetadataName("C"); 3672var type = ((Compilation)current).GetTypeByMetadataName("C");
Compilation\GetSemanticInfoTests.cs (60)
389var tsym = comp.SourceModule.GlobalNamespace.GetTypeMembers("Test").FirstOrDefault(); 1166var systemActionType = GetSystemActionType(comp); 1195var systemActionType = GetSystemActionType(comp); 1220var systemActionType = GetSystemActionType(comp); 1243var systemActionType = GetSystemActionType(comp); 1269var systemActionType = GetSystemActionType(comp); 1272var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); 1297var systemActionType = GetSystemActionType(comp); 1300var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); 1327var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); 1354var eventSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E"); 1383private static INamedTypeSymbol GetSystemActionType(CSharpCompilation comp) 1388private static INamedTypeSymbol GetSystemActionType(Compilation comp) 1390return (INamedTypeSymbol)comp.GlobalNamespace.GetMember<INamespaceSymbol>("System").GetMembers("Action").Where(s => !((INamedTypeSymbol)s).IsGenericType).Single(); 1614Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("A"), symbol.ContainingSymbol); //from the type, not the method 1890var type = (INamedTypeSymbol)bindInfo.Symbol; 2223var classC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 2720var type = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 2791var operatorSymbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(operatorName); 2837var conversions = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("S").GetMembers(WellKnownMemberNames.ExplicitConversionName); 2928var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("UnaryOperator").GetMembers(WellKnownMemberNames.UnaryPlusOperatorName); 3020var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("IncrementOperator").GetMembers(WellKnownMemberNames.IncrementOperatorName); 3094var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); 3168var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName); 3243var operators = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMembers(WellKnownMemberNames.AdditionOperatorName).Cast<IMethodSymbol>(); 3327var gType = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("G"); 3328var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); 3393var gType = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("G"); 3394var mngMethod = (IMethodSymbol)comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Z").GetMembers("MNG").First(); 3790Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); 3850Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), info.CandidateSymbols.Single()); 3917Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("IA").GetMember<IPropertySymbol>("P"), info.Symbol); 4056comp.Assembly.GlobalNamespace.GetMember<INamedTypeSymbol>("Program").GetMembers("Any"). 4117Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info0.Symbol).TypeArguments.Single().SpecialType); 4125Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType); 4176Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType); 4429var classA = global.GetMember<INamedTypeSymbol>("A"); 4430var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); 4431var classAnother = classNested.GetMember<INamedTypeSymbol>("Another"); 4483var classA = global.GetMember<INamedTypeSymbol>("A"); 4484var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); 4529var classA = global.GetMember<INamedTypeSymbol>("A"); 4530var classNested = classA.GetMember<INamedTypeSymbol>("Nested"); 4677var classA = global.GetMember<INamedTypeSymbol>("A"); 4679var classC = global.GetMember<INamedTypeSymbol>("C"); 4722var classA = global.GetMember<INamedTypeSymbol>("A"); 4724var classC = global.GetMember<INamedTypeSymbol>("C"); 5399var objectType = compilation.GetSpecialType(SpecialType.System_Object); 5405var type = (INamedTypeSymbol)model.GetDeclaredSymbol(root.Members[0]); 5417type = (INamedTypeSymbol)model.GetDeclaredSymbol(root.Members[1]); 5584var typeC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 5622var typeB = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("B"); 5669var typeC = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 5723var typeA = global.GetMember<INamedTypeSymbol>("A"); 5724var typeB = global.GetMember<INamedTypeSymbol>("B"); 5725var typeC = global.GetMember<INamedTypeSymbol>("C"); 5727var typeInt = comp.GetSpecialType(SpecialType.System_Int32);
Compilation\QueryClauseInfoTests.cs (2)
21var obj = c.GetSpecialType(SpecialType.System_Object); 22var int32 = c.GetSpecialType(SpecialType.System_Int32);
Compilation\SemanticModelAPITests.cs (32)
462var a = global.GetTypeMembers("A", 0).Single(); 466var b = global.GetTypeMembers("B", 0).Single(); 467var r = b.GetTypeMembers("R", 0).Single(); 468var q = r.GetTypeMembers("Q", 0).Single(); 591var cbasetype = info.Symbol as INamedTypeSymbol; 593var c = comp.GlobalNamespace.GetTypeMembers("C", 1).Single(); 614var at2 = info.Symbol as INamedTypeSymbol; 617var a = comp.GlobalNamespace.GetTypeMembers("A", 1).Single(); 619var b = comp.GlobalNamespace.GetTypeMembers("B", 1).Single(); 734var a = comp.GlobalNamespace.GetTypeMembers("A", 0).Single(); 754var a1 = model.GetDeclaredSymbol(adecl); 755var b1 = model.GetDeclaredSymbol(bdecl); 758var a2 = global.GetTypeMembers("A", 0).Single(); 759var b2 = a2.GetTypeMembers("B", 0).Single(); 824var bOuter = comp.GlobalNamespace.GetTypeMembers("B", 0).Single(); 825var bInner = (comp.GlobalNamespace.GetMembers("N").Single() as INamespaceSymbol).GetTypeMembers("B", 0).Single(); 867var pTypeSym = comp.SourceModule.GlobalNamespace.GetTypeMembers("PC").Single(); 1368Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType); 1720var classQ = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("Q"); 2084Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType); 2101Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType); 3745var stringType = comp.GetSpecialType(SpecialType.System_String); 3923var type1 = comp.GetSpecialType(SpecialType.System_Nullable_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); 3930var type2 = comp.GetSpecialType(SpecialType.System_Nullable_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); 4500var type = (INamedTypeSymbol)typeInfo.Type; 4564var type = (INamedTypeSymbol)typeInfo.Type; 4578var type = (INamedTypeSymbol)typeInfo.Type;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (65)
150var symbol = model.GetDeclaredSymbol(classC); 175var symbol = model.GetDeclaredSymbol(classY); 193var symbol = model.GetDeclaredSymbol(enumE); 216var symbol = model.GetDeclaredSymbol(classY); 239var symbol = model.GetDeclaredSymbol(classY); 259var typeSymbol = model.GetDeclaredSymbol(typeDecl); 942var structSymbol = model.GetDeclaredSymbol(typeDecl); 956var enumSymbol = model.GetDeclaredSymbol(enumDecl); 964var itfcSymbol = model.GetDeclaredSymbol(typeDecl); 1008var symbol = model.GetDeclaredSymbol(typeDecl); 1629var symbolC = model.GetDeclaredSymbol(typeDeclC); 1667var symbolC = model.GetDeclaredSymbol(typeDeclC); 1718var type = model.GetDeclaredSymbol(typeDecl); 1767var baseType = compilation.GetSpecialType(SpecialType.System_Object); 1776var valueType = compilation.GetSpecialType(SpecialType.System_Int32); 1823var type = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IList_T); 1935var method = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("E").GetMember<IMethodSymbol>("M"); 1975method = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"); 2788var typeB = n1.GetTypeMembers("B").First() as INamedTypeSymbol; 2792var classB = model.GetDeclaredSymbol(nsSyntax.Members[0] as TypeDeclarationSyntax); 2971var sym1 = globalNS.GetMembers("CGoo").First() as INamedTypeSymbol; 2980var sym2 = sym1.GetMembers("IGoo").First() as INamedTypeSymbol; 2982var dsym2 = model.GetDeclaredSymbol(node2); 2985var sym3 = sym1.GetMembers("SGoo").First() as INamedTypeSymbol; 2988var dsym3 = model.GetDeclaredSymbol(node3); 3020var srcSym = ns1.GetMembers("A").Single() as INamedTypeSymbol; 3023var declSym = model.GetDeclaredSymbol(nsSyntax.Members[0] as TypeDeclarationSyntax); 3051var dsym1 = model.GetDeclaredSymbol(nsSyntax.Members[0] as TypeDeclarationSyntax); 3052var dsym2 = model.GetDeclaredSymbol(nsSyntax.Members[1] as TypeDeclarationSyntax); 3077var typeA = ns1.GetTypeMembers("A").First() as INamedTypeSymbol; 3080var dsym1 = model.GetDeclaredSymbol(nsSyntax.Members[0] as TypeDeclarationSyntax); 3142var typeA = globalNS.GetTypeMembers("ErrorProp").First() as INamedTypeSymbol; 3638var enumTypeSymbol = model.GetDeclaredSymbol(enumDecl); 3993var typeA = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 3994var typeB = typeA.GetMember<INamedTypeSymbol>("B"); 4082var classM = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("M"); 4434var conversion = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.ImplicitConversionName); 4465var conversion = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.ExplicitConversionName); 4496var @operator = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.AdditionOperatorName); 4693var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4708var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4723var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4746var enumSymbol = model.GetDeclaredSymbol(enumDecl); //Used to assert. 4772var structSymbol = model.GetDeclaredSymbol(structDecl); 4773var interfaceSymbol = model.GetDeclaredSymbol(interfaceDecl); 4799var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4822var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4845var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4868var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl); 4891var type = (INamedTypeSymbol)model.GetDeclaredSymbol(decl);
Compilation\SemanticModelGetSemanticInfoTests.cs (22)
1112var type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 1146type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 1176type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 1206type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 1232type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 1259type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 1355type = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("N2").GetMember<INamedTypeSymbol>("C"); 1393type = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("N").GetMember<INamedTypeSymbol>("C"); 9160Assert.True((type as INamedTypeSymbol).IsUnboundGenericType); 9161Assert.False((type as INamedTypeSymbol).IsErrorType()); 9184Assert.True((type as INamedTypeSymbol).IsUnboundGenericType); 9185Assert.False((type as INamedTypeSymbol).IsErrorType()); 9212Assert.False((type as INamedTypeSymbol).IsUnboundGenericType); 9213Assert.False((type as INamedTypeSymbol).IsErrorType()); 9237Assert.True((type as INamedTypeSymbol).IsUnboundGenericType); 9238Assert.False((type as INamedTypeSymbol).IsErrorType()); 9265var type = (INamedTypeSymbol)semanticInfo.Type; 9271var constructedFrom = type.ConstructedFrom; 9280var a = type.ContainingType; 11401var type = (INamedTypeSymbol)semanticInfo.Type;
Compilation\SymbolVisitorTests.cs (3)
115public override void VisitNamedType(INamedTypeSymbol symbol) 295public override string VisitNamedType(INamedTypeSymbol symbol) 417public override int VisitNamedType(INamedTypeSymbol symbol, StringBuilder argument)
CrossLanguageTests.cs (1)
37var t = comp.GetTypeByMetadataName("I");
DeclarationTests.cs (2)
292var type = compilation.Assembly.GlobalNamespace.GetTypeMembers().First(); 339var type = compilation.Assembly.GlobalNamespace.GetTypeMembers().First();
DocumentationComments\CrefTests.cs (58)
909var typeA = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 912var typeB = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("B"); 1005var typeA = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 1008var typeB = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("B"); 1104var typeA = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 1107var typeB = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("B"); 2218var expectedSymbol = compilation.GetSpecialType(SpecialType.System_Int32); 2967var expectedTypeSymbol = ((Compilation)compilation).GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 3002var typeA = ((Compilation)compilation).GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 3003var typeB = typeA.GetMember<INamedTypeSymbol>("B"); 3006var typeInt = ((Compilation)compilation).GetSpecialType(SpecialType.System_Int32); 3012var actualTypeA = (INamedTypeSymbol)model.GetSymbolInfo(left).Symbol; 3024var actualTypeB = (INamedTypeSymbol)model.GetSymbolInfo(containingTypeSyntax).Symbol; 3054Assert.Equal(typeA.Construct(typeInt).GetMember<INamedTypeSymbol>("B").Construct(actualK), actualParameterTypes[5]); 4788var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4850var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4877var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4938var overridingMethod = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M"); 4981var derivedM1 = global.GetMember<INamedTypeSymbol>("Derived").GetMember<IMethodSymbol>("M1"); 4982var baseM2 = global.GetMember<INamedTypeSymbol>("Base").GetMember<IMethodSymbol>("M2"); 5012var constructor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("G").InstanceConstructors.Single(); 5084var outerCtor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Outer").InstanceConstructors.Single(); 5141var type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("GenericClass"); 5232var type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 5446Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), model.GetSymbolInfo(cref).Symbol); 5472var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("Goo"); 5494var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Outer").GetMember<INamedTypeSymbol>("Inner"); 5560var referencedType = (INamedTypeSymbol)model.GetSymbolInfo(cref).Symbol; 5597var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 5627var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 5847GetMember<INamespaceSymbol>("System").GetMembers("Action").OfType<INamedTypeSymbol>(). 5898var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("GetEnumerator"); 5971var expectedSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(); 6023var expectedSymbolOriginalDefinition = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(); 6110var expectedReturnTypeSymbol = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("X").GetMember<INamedTypeSymbol>("Y"); 6142var classA = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("A"); 6143var classB = classA.GetMember<INamedTypeSymbol>("B"); 6148var expectedParameterTypeSymbol = classA.Construct(classB).GetMember<INamedTypeSymbol>("B"); 6185var outer = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Outer"); 6186var inner = outer.GetMember<INamedTypeSymbol>("Inner"); 6335var accessor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Outer").GetMember<INamedTypeSymbol>("Inner").GetMember<IPropertySymbol>("P").GetMethod; 6336var inheritedType = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Base").GetMember<INamedTypeSymbol>("Inherited"); 6436var derivedInterface = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("IDerived"); 6474var symbol = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("I"); 6500var outer = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"); 6501var inner = outer.GetMember<INamedTypeSymbol>("Inner"); 6539Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), actualSymbol1.OriginalDefinition); 6540Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)actualSymbol1).TypeArguments.Single().TypeKind); 6562Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), model.GetSymbolInfo(cref).Symbol); 6584Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), model.GetSymbolInfo(cref).Symbol); 6607Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Cat"), model.GetSymbolInfo(cref).Symbol);
DocumentationComments\ParameterTests.cs (3)
577AssertEx.SetEqual(model.LookupSymbols(pos4), compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").TypeParameters.Single()); 605AssertEx.SetEqual(model.LookupSymbols(pos4), compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").TypeParameters.Single()); 645var type = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C");
SymbolDisplay\SymbolDisplayTests.cs (7)
5038var outer = (INamedTypeSymbol)vbComp.GlobalNamespace.GetMembers("Outer").Single(); 5287var cTest = comp.GetTypeByMetadataName("CTest"); 5687var type = global.GetTypeMembers("C").Single(); 5691var @delegate = global.GetTypeMembers("D").Single(); 5891var type = global.GetTypeMembers("C").Single(); 5895var @delegate = global.GetTypeMembers("D").Single();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (3)
1024var classDisposable = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Disposable"); 1044var isInterfaceNameBound = semanticModel.GetSymbolInfo(interfaceName).Symbol is INamedTypeSymbol; 1052var type = methodSymbol.ContainingType;
Symbols\AnonymousTypesSemanticsTests.cs (6)
81Assert.False(((INamedTypeSymbol)info0.Type).IsSerializable); 1967var namedType = type as INamedTypeSymbol; 1970var objType = namedType.BaseType; 2007var anonymousType = (INamedTypeSymbol)type;
Symbols\AssemblyAndNamespaceTests.cs (1)
381var objectType = comp.GetSpecialType(SpecialType.System_Object);
Symbols\CompilationCreationTests.cs (1)
2524var typeC5 = c5.Assembly.GlobalNamespace.GetTypeMembers("C5").Single();
Symbols\ConversionTests.cs (3)
2062var destinationType = comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C").Construct(comp.GetSpecialType(SpecialType.System_Int32)); 2145Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), method.ContainingType); 2179Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), method.ContainingType);
Symbols\CorLibrary\Choosing.cs (1)
41var obj = corLib.GetSpecialType(SpecialType.System_Object);
Symbols\CorLibrary\CorTypes.cs (2)
198var t = c1.GetSpecialType((SpecialType)i); 210var t = c1.GetSpecialType((InternalSpecialType)i);
Symbols\CSharpCompilerFeatureRequiredTests.cs (18)
144var onType = comp.GetTypeByMetadataName("OnType"); 148var onMethod = comp.GetTypeByMetadataName("OnMethod"); 152var onMethodReturn = comp.GetTypeByMetadataName("OnMethodReturn"); 156var onParameter = comp.GetTypeByMetadataName("OnParameter"); 162var onField = comp.GetTypeByMetadataName("OnField"); 166var onProperty = comp.GetTypeByMetadataName("OnProperty"); 170var onPropertyGetter = comp.GetTypeByMetadataName("OnPropertyGetter"); 177var onPropertySetter = comp.GetTypeByMetadataName("OnPropertySetter"); 184var onEvent = comp.GetTypeByMetadataName("OnEvent"); 188var onEventAdder = comp.GetTypeByMetadataName("OnEventAdder"); 195var onEventRemover = comp.GetTypeByMetadataName("OnEventRemover"); 202var onEnum = comp.GetTypeByMetadataName("OnEnum"); 205var onEnumMember = comp.GetTypeByMetadataName("OnEnumMember"); 209var onClassTypeParameter = comp.GetTypeByMetadataName("OnClassTypeParameter`1"); 213var onMethodTypeParameter = comp.GetTypeByMetadataName("OnMethodTypeParameter"); 219var onDelegateType = comp.GetTypeByMetadataName("OnDelegateType"); 222var onIndexedPropertyParameter = comp.GetTypeByMetadataName("OnIndexedPropertyParameter"); 227var onThisParameterIndexer = comp.GetTypeByMetadataName("OnThisIndexerParameter");
Symbols\CustomModifiersTests.cs (34)
66var type = (INamedTypeSymbol)test.Parameters.First().Type; 72var nullable = type.OriginalDefinition; 78var i = (INamedTypeSymbol)type.TypeArguments.First(); 136var type = (INamedTypeSymbol)test.Parameters.First().Type; 147var dictionary = type.OriginalDefinition; 290var cl3 = compilation.GetTypeByMetadataName("CL3"); 375var cl3 = compilation.GetTypeByMetadataName("CL3"); 448var cl3 = compilation.GetTypeByMetadataName("CL3"); 521var cl3 = compilation.GetTypeByMetadataName("CL3"); 595var cl3 = compilation.GetTypeByMetadataName("CL3"); 700var cl3 = compilation.GetTypeByMetadataName("CL3"); 704var cl1 = compilation.GetTypeByMetadataName("CL1`1"); 810var cl3 = compilation.GetTypeByMetadataName("CL3"); 814var cl1 = compilation.GetTypeByMetadataName("CL1`1"); 920var cl3 = compilation.GetTypeByMetadataName("CL3"); 924var cl1 = compilation.GetTypeByMetadataName("CL1`1"); 1030var cl3 = compilation.GetTypeByMetadataName("CL3"); 1034var cl1 = compilation.GetTypeByMetadataName("CL1`1"); 1124var cl3 = compilation.GetTypeByMetadataName("CL3"); 1231var cl3 = compilation.GetTypeByMetadataName("CL3"); 1306var cl3 = compilation.GetTypeByMetadataName("CL3"); 1373var cl2 = compilation.GetTypeByMetadataName("CL2"); 2286var cl2 = compilation.GetTypeByMetadataName("CL2"); 2332var cl3 = compilation.GetTypeByMetadataName("CL3"); 2475var cl1 = compilation.GetTypeByMetadataName("CL1`1"); 2596var cl2 = compilation.GetTypeByMetadataName("CL2"); 2601var cl3 = compilation.GetTypeByMetadataName("CL3"); 2710var cl2 = compilation.GetTypeByMetadataName("CL2"); 2715var cl3 = compilation.GetTypeByMetadataName("CL3"); 2804var cl2 = compilation.GetTypeByMetadataName("CL2"); 2809var cl3 = compilation.GetTypeByMetadataName("CL3");
Symbols\DefaultInterfaceImplementationTests.cs (212)
974var test1 = compilation1.GetTypeByMetadataName("Test1"); 1049var test1 = compilation1.GetTypeByMetadataName("Test1"); 1128var test1 = compilation1.GetTypeByMetadataName("Test1"); 1207var test1 = compilation1.GetTypeByMetadataName("Test1"); 1288var test1 = compilation1.GetTypeByMetadataName("Test1"); 1372var test1 = compilation1.GetTypeByMetadataName("Test1"); 1460var test1 = compilation1.GetTypeByMetadataName("Test1"); 1548var test1 = compilation1.GetTypeByMetadataName("Test1"); 1593var test1 = compilation1.GetTypeByMetadataName("Test1"); 1627var test2 = compilation3.GetTypeByMetadataName("Test2"); 1683var test2 = compilation3.GetTypeByMetadataName("Test2"); 1749var test2 = compilation3.GetTypeByMetadataName("Test2"); 1784var test1 = compilation1.GetTypeByMetadataName("Test1"); 1824var test2 = compilation3.GetTypeByMetadataName("Test2"); 1881var test1 = compilation1.GetTypeByMetadataName("Test1"); 1915var test2 = compilation2.GetTypeByMetadataName("Test2"); 2026var test1 = compilation1.GetTypeByMetadataName("Test1"); 2112var test1 = compilation1.GetTypeByMetadataName("Test1"); 2186var test2 = compilation2.GetTypeByMetadataName("Test2"); 2271var test1 = compilation2.GetTypeByMetadataName("Test1"); 2340var test1 = compilation2.GetTypeByMetadataName("Test1"); 2413var test1 = compilation2.GetTypeByMetadataName("Test1"); 2486var test1 = compilation2.GetTypeByMetadataName("Test1"); 3416var test1 = compilation1.GetTypeByMetadataName("Test1"); 3484var test1 = compilation1.GetTypeByMetadataName("Test1"); 3571var test1 = compilation1.GetTypeByMetadataName("Test1"); 3635var test1 = compilation1.GetTypeByMetadataName("Test1"); 4494var test2 = compilation3.GetTypeByMetadataName("Test2"); 4495var i1 = compilation3.GetTypeByMetadataName("I1"); 5270var test1 = compilation1.GetTypeByMetadataName("Test1"); 5323var test1 = compilation1.GetTypeByMetadataName("Test1"); 6035var test2 = compilation3.GetTypeByMetadataName("Test2"); 6036var i1 = compilation3.GetTypeByMetadataName("I1"); 7500var test2 = compilation3.GetTypeByMetadataName("Test2"); 7501var i1 = compilation3.GetTypeByMetadataName("I1"); 8432var i1 = compilation1.GetTypeByMetadataName("I1"); 8824var i1 = compilation1.GetTypeByMetadataName("I1"); 8971var test1 = compilation1.GetTypeByMetadataName("Test1"); 8972var i1 = compilation1.GetTypeByMetadataName("I1"); 9111var test1 = compilation1.GetTypeByMetadataName("Test1"); 9112var i1 = compilation1.GetTypeByMetadataName("I1"); 9324var test2 = compilation.GetTypeByMetadataName(className); 9325var i1 = compilation.GetTypeByMetadataName("I1"); 10090var test1 = compilation1.GetTypeByMetadataName("Test1"); 10091var i1 = compilation1.GetTypeByMetadataName("I1"); 10220var test1 = compilation1.GetTypeByMetadataName("Test1"); 10221var test2 = compilation1.GetTypeByMetadataName("Test2"); 10222var i1 = compilation1.GetTypeByMetadataName("I1"); 10325var test1 = compilation1.GetTypeByMetadataName("Test1"); 10326var test2 = compilation1.GetTypeByMetadataName("Test2"); 10327var i1 = compilation1.GetTypeByMetadataName("I1"); 10608var test1 = compilation1.GetTypeByMetadataName("Test1"); 10609var test2 = compilation1.GetTypeByMetadataName("Test2"); 10610var i1 = compilation1.GetTypeByMetadataName("I1"); 10728var test1 = compilation1.GetTypeByMetadataName("Test1"); 10729var test2 = compilation1.GetTypeByMetadataName("Test2"); 10730var i1 = compilation1.GetTypeByMetadataName("I1"); 10922var i1 = compilation2.GetTypeByMetadataName("I1"); 11064var i1 = compilation1.GetTypeByMetadataName("I1"); 11171var i1 = compilation1.GetTypeByMetadataName("I1"); 12630var i1 = compilation2.GetTypeByMetadataName("I1"); 12718var i1 = compilation2.GetTypeByMetadataName("I1"); 12806var i1 = compilation2.GetTypeByMetadataName("I1"); 13116var i1 = compilation1.GetTypeByMetadataName("I1"); 14082var i1 = compilation1.GetTypeByMetadataName("I1"); 14393var test1 = compilation1.GetTypeByMetadataName("Test1"); 14394var i1 = compilation1.GetTypeByMetadataName("I1"); 14735var test1 = compilation1.GetTypeByMetadataName("Test1"); 14736var i1 = compilation1.GetTypeByMetadataName("I1"); 14939var i1 = compilation2.GetTypeByMetadataName("I1"); 15038var test2 = compilation.GetTypeByMetadataName(className); 15039var i1 = compilation.GetTypeByMetadataName("I1"); 16011var test1 = compilation1.GetTypeByMetadataName("Test1"); 16012var i1 = compilation1.GetTypeByMetadataName("I1"); 16313var test1 = compilation1.GetTypeByMetadataName("Test1"); 16314var test2 = compilation1.GetTypeByMetadataName("Test2"); 16585var test1 = compilation1.GetTypeByMetadataName("Test1"); 16586var test2 = compilation1.GetTypeByMetadataName("Test2"); 16590var i1 = compilation1.GetTypeByMetadataName("I" + i); 17021var test1 = compilation1.GetTypeByMetadataName("Test1"); 17022var test2 = compilation1.GetTypeByMetadataName("Test2"); 17271var test1 = compilation1.GetTypeByMetadataName("Test1"); 17272var test2 = compilation1.GetTypeByMetadataName("Test2"); 17517var i1 = compilation2.GetTypeByMetadataName("I1"); 19898var i1 = compilation2.GetTypeByMetadataName("I1"); 23390var test1 = compilation1.GetTypeByMetadataName("Test1"); 23391var i1 = compilation1.GetTypeByMetadataName("I1"); 26838var i1 = compilation1.GetTypeByMetadataName("I1"); 27710var i1 = compilation1.GetTypeByMetadataName("I1"); 27977var test1 = compilation1.GetTypeByMetadataName("Test1"); 27978var i1 = compilation1.GetTypeByMetadataName("I1"); 28234var test1 = compilation1.GetTypeByMetadataName("Test1"); 28235var i1 = compilation1.GetTypeByMetadataName("I1"); 28485var i1 = compilation2.GetTypeByMetadataName("I1"); 28540var test2 = compilation.GetTypeByMetadataName(className); 28541var i1 = compilation.GetTypeByMetadataName("I1"); 29509var test1 = compilation1.GetTypeByMetadataName("Test1"); 29510var i1 = compilation1.GetTypeByMetadataName("I1"); 29702var test1 = compilation1.GetTypeByMetadataName("Test1"); 29703var test2 = compilation1.GetTypeByMetadataName("Test2"); 29998var test1 = compilation1.GetTypeByMetadataName("Test1"); 29999var test2 = compilation1.GetTypeByMetadataName("Test2"); 30003var i1 = compilation1.GetTypeByMetadataName("I" + i); 30444var test1 = compilation1.GetTypeByMetadataName("Test1"); 30445var test2 = compilation1.GetTypeByMetadataName("Test2"); 30665var test1 = compilation1.GetTypeByMetadataName("Test1"); 30666var test2 = compilation1.GetTypeByMetadataName("Test2"); 30922var i1 = compilation2.GetTypeByMetadataName("I1"); 34989var test1 = compilation2.GetTypeByMetadataName("Test1"); 35083var test1 = compilation2.GetTypeByMetadataName("Test1"); 35181var test1 = compilation2.GetTypeByMetadataName("Test1"); 35277var test1 = compilation2.GetTypeByMetadataName("Test1"); 35382var test1 = compilation2.GetTypeByMetadataName("Test1"); 35473var test1 = compilation2.GetTypeByMetadataName("Test1"); 35582var test1 = compilation2.GetTypeByMetadataName("Test1"); 35695var test1 = compilation2.GetTypeByMetadataName("Test1"); 35808var test1 = compilation2.GetTypeByMetadataName("Test1"); 35914var test1 = compilation2.GetTypeByMetadataName("Test1"); 36231var test1 = compilation2.GetTypeByMetadataName("Test1"); 39526var test1 = compilation2.GetTypeByMetadataName("Test1"); 43737var i1 = compilation.GetTypeByMetadataName("I1"); 54383var i1 = compilation1.GetTypeByMetadataName("I1"); 54385var test2 = compilation1.GetTypeByMetadataName("Test2"); 54456var i1 = compilation1.GetTypeByMetadataName("I1"); 54458var test2 = compilation1.GetTypeByMetadataName("Test2"); 54556var i1 = compilation1.GetTypeByMetadataName("I1"); 54558var test2 = compilation1.GetTypeByMetadataName("Test2"); 54627var i1 = compilation1.GetTypeByMetadataName("I1"); 54629var test2 = compilation1.GetTypeByMetadataName("Test2"); 54695var i1 = compilation1.GetTypeByMetadataName("I1"); 54697var test2 = compilation1.GetTypeByMetadataName("Test2"); 54789var i1 = compilation1.GetTypeByMetadataName("I1"); 54791var test2 = compilation1.GetTypeByMetadataName("Test2"); 54883var i1 = compilation1.GetTypeByMetadataName("I1"); 54885var test2 = compilation1.GetTypeByMetadataName("Test2"); 54971var i1 = compilation1.GetTypeByMetadataName("I1"); 54973var test2 = compilation1.GetTypeByMetadataName("Test2"); 62379var c0 = compilation1.GetTypeByMetadataName("C0"); 62472var test = compilation1.GetTypeByMetadataName("Test"); 62516var c0 = compilation1.GetTypeByMetadataName("C0"); 62517var test = compilation1.GetTypeByMetadataName("Test"); 63129var i1 = compilation1.GetTypeByMetadataName("I1"); 63130var i2 = compilation1.GetTypeByMetadataName("I2"); 63131var c1 = compilation1.GetTypeByMetadataName("C1"); 63132var test1 = compilation1.GetTypeByMetadataName("Test1"); 63133var test2 = compilation1.GetTypeByMetadataName("Test2"); 63134var test3 = compilation1.GetTypeByMetadataName("Test3"); 63135var test4 = compilation1.GetTypeByMetadataName("Test4"); 63335var i1 = compilation1.GetTypeByMetadataName("I1"); 63336var i2 = compilation1.GetTypeByMetadataName("I2"); 63337var c1 = compilation1.GetTypeByMetadataName("C1"); 63338var test1 = compilation1.GetTypeByMetadataName("Test1"); 63339var test2 = compilation1.GetTypeByMetadataName("Test2"); 63340var test3 = compilation1.GetTypeByMetadataName("Test3"); 63341var test4 = compilation1.GetTypeByMetadataName("Test4"); 63501var i1 = compilation1.GetTypeByMetadataName("I1"); 63502var i2 = compilation1.GetTypeByMetadataName("I2"); 63503var c1 = compilation1.GetTypeByMetadataName("C1"); 63504var test1 = compilation1.GetTypeByMetadataName("Test1"); 63505var test2 = compilation1.GetTypeByMetadataName("Test2"); 63506var test3 = compilation1.GetTypeByMetadataName("Test3"); 63507var test4 = compilation1.GetTypeByMetadataName("Test4"); 63677var i1 = compilation1.GetTypeByMetadataName("I1"); 63678var i2 = compilation1.GetTypeByMetadataName("I2"); 63679var c1 = compilation1.GetTypeByMetadataName("C1"); 63680var test1 = compilation1.GetTypeByMetadataName("Test1"); 63681var test2 = compilation1.GetTypeByMetadataName("Test2"); 63682var test3 = compilation1.GetTypeByMetadataName("Test3"); 63683var test4 = compilation1.GetTypeByMetadataName("Test4"); 63860var i1 = compilation1.GetTypeByMetadataName("I1"); 63861var c3 = compilation1.GetTypeByMetadataName("C3"); 64067var i1 = compilation1.GetTypeByMetadataName("I1"); 64068var i2 = compilation1.GetTypeByMetadataName("I2"); 64069var i3 = compilation1.GetTypeByMetadataName("I3"); 64070var test2 = compilation1.GetTypeByMetadataName("Test2"); 64071var test3 = compilation1.GetTypeByMetadataName("Test3"); 64210var i1 = compilation1.GetTypeByMetadataName("I1"); 64211var i2 = compilation1.GetTypeByMetadataName("I2"); 64212var i3 = compilation1.GetTypeByMetadataName("I3"); 64213var test2 = compilation1.GetTypeByMetadataName("Test2"); 64214var test3 = compilation1.GetTypeByMetadataName("Test3"); 64326var i1 = compilation1.GetTypeByMetadataName("I1"); 64327var i2 = compilation1.GetTypeByMetadataName("I2"); 64328var i3 = compilation1.GetTypeByMetadataName("I3"); 64329var test2 = compilation1.GetTypeByMetadataName("Test2"); 64330var test3 = compilation1.GetTypeByMetadataName("Test3"); 64447var i1 = compilation1.GetTypeByMetadataName("I1"); 64448var i2 = compilation1.GetTypeByMetadataName("I2"); 64449var i3 = compilation1.GetTypeByMetadataName("I3"); 64450var test2 = compilation1.GetTypeByMetadataName("Test2"); 64451var test3 = compilation1.GetTypeByMetadataName("Test3"); 64534var i1 = compilation1.GetTypeByMetadataName("I1"); 64535var c2 = compilation1.GetTypeByMetadataName("C2"); 64614var i1 = compilation1.GetTypeByMetadataName("I1"); 64615var c2 = compilation1.GetTypeByMetadataName("C2"); 64688var i1 = compilation1.GetTypeByMetadataName("I1"); 64689var c1 = compilation1.GetTypeByMetadataName("C1"); 64690var c2 = compilation1.GetTypeByMetadataName("C2"); 64767var i1 = compilation1.GetTypeByMetadataName("I1"); 64768var c1 = compilation1.GetTypeByMetadataName("C1"); 64769var c2 = compilation1.GetTypeByMetadataName("C2"); 67147var i1 = compilation1.GetTypeByMetadataName("I1"); 67212var i1 = compilation1.GetTypeByMetadataName("I1"); 67213var i2 = compilation1.GetTypeByMetadataName("I2"); 67329var i1 = compilation1.GetTypeByMetadataName("I1"); 67396var i1 = compilation1.GetTypeByMetadataName("I1"); 67397var i2 = compilation1.GetTypeByMetadataName("I2"); 67517var i1 = compilation1.GetTypeByMetadataName("I1"); 67587var i1 = compilation1.GetTypeByMetadataName("I1"); 67588var i2 = compilation1.GetTypeByMetadataName("I2"); 68008var c1 = compilation1.GetTypeByMetadataName("C1"); 68072var c1 = compilation1.GetTypeByMetadataName("C1");
Symbols\DestructorTests.cs (1)
400var destructor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>(WellKnownMemberNames.DestructorName);
Symbols\ExtensionMethodTests.cs (7)
2526var intType = compilation.GetSpecialType(SpecialType.System_Int32); 2527var stringType = compilation.GetSpecialType(SpecialType.System_String); 2805var int32Type = compilation.GetSpecialType(SpecialType.System_Int32); 2849var int32Type = compilation2.GetSpecialType(SpecialType.System_Int32); 2949var type = globalNamespace.GetMember<INamedTypeSymbol>("C"); 3007var type = globalNamespace.GetMember<INamedTypeSymbol>("C"); 4094var systemVoidType = compilation.GetSpecialType(SpecialType.System_Void);
Symbols\FunctionPointerTypeSymbolTests.cs (38)
41var c = comp.GetTypeByMetadataName("C"); 194var c = comp.GetTypeByMetadataName("C"); 262var c = comp.GetTypeByMetadataName("C"); 324var c = comp.GetTypeByMetadataName("C"); 374var c = comp.GetTypeByMetadataName("C"); 467var c = comp.GetTypeByMetadataName("C"); 569var c = comp.GetTypeByMetadataName("C"); 677var c = comp.GetTypeByMetadataName("C"); 707var c = comp.GetTypeByMetadataName("C"); 724var c = comp.GetTypeByMetadataName("C"); 743var c = comp.GetTypeByMetadataName("C"); 761var c = comp.GetTypeByMetadataName("C"); 780var c = comp.GetTypeByMetadataName("C"); 798var c = comp.GetTypeByMetadataName("C"); 816var c = comp.GetTypeByMetadataName("C"); 834var c = comp.GetTypeByMetadataName("C"); 852var c = comp.GetTypeByMetadataName("C"); 870var c = comp.GetTypeByMetadataName("C"); 888var c = comp.GetTypeByMetadataName("C"); 1054var testClass = comp.GetTypeByMetadataName("Test1")!; 1515var c = comp.GetTypeByMetadataName("C"); 1529var @string = comp.GetSpecialType(SpecialType.System_String); 1530var cdeclType = comp.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConvCdecl"); 1536Assert.Throws<ArgumentNullException>("callingConventionTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, ImmutableArray.Create((INamedTypeSymbol)null!))); 1552var @string = comp.GetSpecialType(SpecialType.System_String); 1565var c = comp.GetTypeByMetadataName("C")!; 1580var @string = comp.GetSpecialType(SpecialType.System_String); 1596var @string = comp.GetSpecialType(SpecialType.System_String); 1597var @void = comp.GetSpecialType(SpecialType.System_Void); 1615var @string = comp.GetSpecialType(SpecialType.System_String); 1636var @string = comp.GetSpecialType(SpecialType.System_String); 1648var @string = comp.GetSpecialType(SpecialType.System_String); 1649var cdeclType = comp.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConvCdecl"); 1650var stdcallType = comp.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConvStdcall"); 1960var testConvention = otherCorLib.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConvTest"); 1979var returnType = comp.GetSpecialType(SpecialType.System_String); 2084var returnType = comp.GetSpecialType(SpecialType.System_String); 2135var returnType = comp.GetSpecialType(SpecialType.System_String);
Symbols\GenericConstraintTests.cs (2)
7315var c = comp.GetTypeByMetadataName("C"); 7372var c = comp.GetTypeByMetadataName("C");
Symbols\InterfaceImplementationTests.cs (6)
1060var classD = global.GetTypeMembers("CustomModifierOverridingD").Single(); 1066var @interface = global.GetTypeMembers("Interface").Single(); 1149var type = comp.GlobalNamespace.GetTypeMembers("c2").Single(); 1590var typeSymbol = comp.GlobalNamespace.GetTypeMembers("C1").Single(); 2494var baseType = comp.GetTypeByMetadataName("StringComparer"); 2495var derivedType = comp.GetTypeByMetadataName("OneToOneUnicodeComparer");
Symbols\Metadata\MetadataMemberTests.cs (7)
396var classC = compilation.SourceModule.GlobalNamespace.GetTypeMembers("C").Single(); 621var test1 = comp1.GetTypeByMetadataName("Test"); 631var test2 = comp2.GetTypeByMetadataName("Test"); 661var test1 = comp1.GetTypeByMetadataName("Test"); 672var test2 = comp2.GetTypeByMetadataName("Test"); 735var c = compilation.GetTypeByMetadataName("C"); 797var c = compilation.GetTypeByMetadataName("C");
Symbols\Metadata\PE\BaseTypeResolution.cs (4)
341var test1 = compilation1.GetTypeByMetadataName("Test1"); 342var test2 = compilation1.GetTypeByMetadataName("Test2"); 361var m3 = compilation2.GetTypeByMetadataName("M3"); 362var m4 = compilation2.GetTypeByMetadataName("M4");
Symbols\Metadata\PE\HasUnsupportedMetadata.cs (4)
160var c3 = compilation1.GetTypeByMetadataName("C3"); 364var c3 = compilation1.GetTypeByMetadataName("C3"); 392var vector = compilation1.GetTypeByMetadataName("Microsoft.VisualC.StlClr.IVector`1"); 402var typeX = compilation1.GetTypeByMetadataName("X");
Symbols\Metadata\PE\LoadingAttributes.cs (2)
1008Assert.Equal("System.Collections.Generic.IList<>", (attrSym.CommonNamedArguments[0].Value.Value as INamedTypeSymbol).ToString()); 1162Assert.Equal("AttributeUse.IFoo<System.Int16, System.UInt16>", (attrSym.CommonConstructorArguments[0].Value as INamedTypeSymbol).ToDisplayString(SymbolDisplayFormat.TestFormat));
Symbols\Metadata\PE\LoadingFields.cs (1)
150var readOnlySpanType = comp.GetSpecialType(InternalSpecialType.System_ReadOnlySpan_T);
Symbols\Metadata\PE\NoPia.cs (4)
1235var varI5 = varC_Pia5.SourceModule.GlobalNamespace.GetTypeMembers("I5").Single(); 1237var varI6 = varC_Pia5.SourceModule.GlobalNamespace.GetTypeMembers("I6").Single(); 1245var varI7 = varC_Library2.SourceModule.GlobalNamespace.GetTypeMembers("I7").Single(); 1257var varI1 = varC_Pia1.SourceModule.GlobalNamespace.GetTypeMembers("I1").Single();
Symbols\Metadata\PE\TypeForwarders.cs (1)
1893var forwarded = context.GetTypeByMetadataName("Forwarded`1");
Symbols\MethodEqualityTests.cs (9)
36var class1 = global.GetTypeMembers("Class1").Single(); 40var class2 = global.GetTypeMembers("Class2").Single(); 83var baseClass = global.GetTypeMembers("Base").Single(); 87var derivedClass1 = global.GetTypeMembers("Derived1").Single(); 92var derivedClass2 = global.GetTypeMembers("Derived2").Single(); 143var baseClass = global.GetTypeMembers("Base").Single(); 147var derivedClass1 = global.GetTypeMembers("Derived1").Single(); 152var derivedClass2 = global.GetTypeMembers("Derived2").Single(); 202var @class = global.GetTypeMembers("Class").Single();
Symbols\MissingSpecialMember.cs (9)
157var specialType = comp.GetSpecialType(SpecialType.System_String); 162var lookupType = comp.GetTypeByMetadataName("System.String"); 235var specialType = comp.GetSpecialType(SpecialType.System_Nullable_T); 239var lookupType = comp.GetTypeByMetadataName("System.Nullable`1"); 275var lookupType = comp.GetTypeByMetadataName("System.Type"); 308var lookupType = comp.GetTypeByMetadataName("System.Diagnostics.DebuggableAttribute+DebuggingModes"); 384var lookupType = comp.GetTypeByMetadataName("System.Threading.Tasks.Task`1"); 502var lookup = comp.GetTypeByMetadataName("System.Type"); 530var symbol = comp.GetSpecialType(special);
Symbols\OverriddenOrHiddenMembersTests.cs (5)
2867var obj = compilation.GetSpecialType(SpecialType.System_Object); 3683var validatorBaseT = compilation.GetTypeByMetadataName("ValidatorBase`1"); 3690var validatorBaseObject = validatorBaseT.Construct(compilation.ObjectType); 3939var validatorBaseT = compilation.GetTypeByMetadataName("ValidatorBase`1"); 3946var validatorBaseObject = validatorBaseT.Construct(compilation.ObjectType);
Symbols\RequiredMembersTests.cs (5)
2233var baseSymbol = comp.GetTypeByMetadataName("Base"); 2279var baseSymbol = comp.GetTypeByMetadataName("Derived"); 2315var baseSymbol = comp.GetTypeByMetadataName("Base"); 7263var c = comp.GetTypeByMetadataName("C`1"); 7264var u_c = c!.ConstructUnboundGenericType();
Symbols\Retargeting\NoPia.cs (2)
2675var test = compilation2.GetTypeByMetadataName("Test"); 2678var usePia1 = compilation2.GetTypeByMetadataName("UsePia1");
Symbols\Retargeting\RetargetCustomAttributes.cs (9)
199var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 208var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 218var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 232var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 242var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 254var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 266var testClass = test.c2.Compilation.GlobalNamespace.GetTypeMembers("TestClass").Single(); 349var c1 = comp3.GetTypeByMetadataName("C1"); 391var c1 = comp3.GetTypeByMetadataName("C1");
Symbols\Retargeting\RetargetCustomModifiers.cs (2)
43var modifiers = c2.GlobalNamespace.GetTypeMembers("Modifiers").Single(); 161var modifiers = c2.GlobalNamespace.GetTypeMembers("Modifiers").Single();
Symbols\Retargeting\RetargetExplicitInterfaceImplementation.cs (12)
57var classC = globalNamespace1.GetTypeMembers("C").Single(); 59var interfaceV1 = globalNamespace1.GetTypeMembers("Interface1").Single(); 124var interfaceV2 = globalNamespace2.GetTypeMembers("Interface1").Single(); 147var classD = globalNamespace2.GetTypeMembers("D").Single(); 353var classC1 = globalNamespace1.GetTypeMembers("C1").Single(); 354var classC2 = globalNamespace1.GetTypeMembers("C2").Single(); 355var classC3 = globalNamespace1.GetTypeMembers("C3").Single(); 388var interfaceV2 = globalNamespace2.GetTypeMembers("Interface2").Single(); 393var classD1 = globalNamespace2.GetTypeMembers("D1").Single(); 394var classD2 = globalNamespace2.GetTypeMembers("D2").Single(); 395var classD3 = globalNamespace2.GetTypeMembers("D3").Single(); 465var c2 = compilation3.GetTypeByMetadataName("C2`1");
Symbols\Retargeting\RetargetingTests.cs (4)
277var a_v2 = compilation1_v2.GetTypeByMetadataName("A"); 278var i_a_v2 = compilation1_v2.GetTypeByMetadataName("I`1").Construct(ImmutableArray.Create<TypeSymbol>(a_v2)); 299var i_ct_v2 = compilation1_v2.GetTypeByMetadataName("I`1").Construct(ImmutableArray.Create<TypeSymbol>(c.TypeParameters[0])); 906var c = compilation.GetTypeByMetadataName("Source");
Symbols\Source\BaseClassTests.cs (64)
36var x = global.GetTypeMembers("X", 0).Single(); 37var y = global.GetTypeMembers("Y", 0).Single(); 56var x = global.GetTypeMembers("X", 0).Single(); 57var y = global.GetTypeMembers("Y", 0).Single(); 79var x = global.GetTypeMembers("C4", 0).Single(); 103var a = global.GetTypeMembers("A", 1).Single(); 104var b = a.GetTypeMembers("B", 0).Single(); 105var e = a.GetTypeMembers("E", 0).Single(); 132var a = global.GetTypeMembers("A", 1).Single(); 133var b = global.GetTypeMembers("B", 0).Single(); 134var d = b.GetTypeMembers("D", 0).Single(); 158var a = global.GetTypeMembers("A", 0).Single(); 159var ic = a.GetTypeMembers("IC", 0).Single(); 181var a = global.GetTypeMembers("A", 0).Single(); 182var b = a.GetTypeMembers("B", 0).Single(); 183var ic = b.GetTypeMembers("IC", 0).Single(); 234var z = global.GetTypeMembers("Z", 0).Single(); 235var w = global.GetTypeMembers("W", 0).Single(); 263var a = global.GetTypeMembers("A", 0).Single(); 300var a = global.GetTypeMembers("A", 0).Single(); 463var c = global.GetTypeMembers("C", 0).Single(); 481var e = global.GetTypeMembers("E", 0).Single(); 499var g = global.GetTypeMembers("G", 0).Single(); 519var j = global.GetTypeMembers("J", 0).Single(); 533var m = global.GetTypeMembers("M", 0).Single(); 548var o = global.GetTypeMembers("O", 0).Single(); 566var p = global.GetTypeMembers("P", 0).Single(); 586var r = global.GetTypeMembers("R", 0).Single(); 605var u = global.GetTypeMembers("U", 0).Single(); 625var c = global.GetTypeMembers("C", 0).Single(); 650var x = global.GetTypeMembers("X", 0).Single(); 669var b = global.GetTypeMembers("B", 0).Single(); 686var z = global.GetTypeMembers("Z", 1).Single(); 995var x = global.GetTypeMembers("I4", 0).Single(); 1016var B1 = global1.GetTypeMembers("ClassB", 0).Single(); 1017var A1 = global1.GetTypeMembers("ClassA", 0).Single(); 1034var B2 = global.GetTypeMembers("ClassB", 0).Single(); 1035var C = global.GetTypeMembers("ClassC", 0).Single(); 1048var A2 = global.GetTypeMembers("ClassA", 0).Single(); 1072var B1 = global1.GetTypeMembers("ClassB", 0).Distinct().Single(); 1073var A1 = global1.GetTypeMembers("ClassA", 0).Single(); 1094var B2 = global.GetTypeMembers("ClassB", 0).Single(); 1095var C = global.GetTypeMembers("ClassC", 0).Single(); 1109var A2 = global.GetTypeMembers("ClassA", 0).Single(); 1130var B1 = global1.GetTypeMembers("ClassB", 0).Single(); 1131var A1 = global1.GetTypeMembers("ClassA", 0).Single(); 1163var A2 = global.GetTypeMembers("ClassA", 0).Single(); 1164var B2 = global.GetTypeMembers("ClassB", 0).Single(); 1165var C = global.GetTypeMembers("ClassC", 0).Single(); 1188var B1 = global1.GetTypeMembers("ClassB", 0).Distinct().Single(); 1189var A1 = global1.GetTypeMembers("ClassA", 0).Single(); 1220var B2 = global.GetTypeMembers("ClassB", 0).Single(); 1221var C = global.GetTypeMembers("ClassC", 0).Single(); 1229var A2 = global.GetTypeMembers("ClassA", 0).Single(); 1336var g = global.GetTypeMembers("G", 1).Single(); 1337var c = global.GetTypeMembers("C", 0).Single(); 1384var x = global.GetTypeMembers("X", 0).Single(); 1385var a1 = x.GetTypeMembers("A1", 0).Single(); 1387var b1 = x.GetTypeMembers("B1", 0).Single(); 1389var broken = global.GetTypeMembers("Broken", 0).Single(); 1390var a2 = broken.GetTypeMembers("A2", 0).Single(); 1393var b2 = broken.GetTypeMembers("B2", 0).Single(); 1412var a = global.GetTypeMembers("A", 0).Single(); 1413var b = global.GetTypeMembers("B", 0).Single();
Symbols\Source\ClsComplianceTests.cs (2)
3156var intType = helper.GetSpecialType(SpecialType.System_Int32); 3171var type = helper.GetSpecialType(st);
Symbols\Source\CustomModifierCopyTests.cs (12)
1781var int8Type = comp.GetSpecialType(SpecialType.System_SByte); 1782var int16Type = comp.GetSpecialType(SpecialType.System_Int16); 1783var int32Type = comp.GetSpecialType(SpecialType.System_Int32); 1784var int64Type = comp.GetSpecialType(SpecialType.System_Int64); 1898var int8Type = comp.GetSpecialType(SpecialType.System_SByte); 1899var int16Type = comp.GetSpecialType(SpecialType.System_Int16); 1995var int8Type = comp.GetSpecialType(SpecialType.System_SByte); 1996var int16Type = comp.GetSpecialType(SpecialType.System_Int16); 1997var int32Type = comp.GetSpecialType(SpecialType.System_Int32); 1998var int64Type = comp.GetSpecialType(SpecialType.System_Int64); 2097var int8Type = comp.GetSpecialType(SpecialType.System_SByte); 2098var int16Type = comp.GetSpecialType(SpecialType.System_Int16);
Symbols\Source\DeclaringSyntaxNodeTests.cs (21)
201var c1 = n1.GetTypeMembers("C1").Single() as INamedTypeSymbol; 202var s1 = n1.GetTypeMembers("S1").Single() as INamedTypeSymbol; 235var c1 = n1.GetTypeMembers("C1").Single() as INamedTypeSymbol; 342var symbol = model.GetDeclaredSymbol(anonObjectCreation); 450var c1 = n1.GetTypeMembers("C1").Single() as INamedTypeSymbol; 451var c2 = c1.GetTypeMembers("C2").Single() as INamedTypeSymbol; 452var c3 = c1.GetTypeMembers("C3").Single() as INamedTypeSymbol; 461foreach (ITypeParameterSymbol tp in ((INamedTypeSymbol)f.Type).TypeParameters) 477foreach (ITypeParameterSymbol tp in ((INamedTypeSymbol)f.Type).TypeParameters) 517var c1 = n1.GetTypeMembers("C1").Single() as INamedTypeSymbol; 518var c2 = n1.GetTypeMembers("C2").Single() as INamedTypeSymbol; 519var e1 = n1.GetTypeMembers("E1").Single() as INamedTypeSymbol;
Symbols\Source\DelegateTests.cs (3)
72var a = global.GetTypeMembers("A", 0).Single(); 107var a = global.GetTypeMembers("A", 0).Single(); 127var v = comp.GlobalNamespace.GetTypeMembers("MyDel", 0).Single();
Symbols\Source\EnumTests.cs (2)
984var symbol = model.GetDeclaredSymbol(decl); 985var type = symbol.EnumUnderlyingType;
Symbols\Source\ExternAliasTests.cs (3)
417firstTarget.GetMember<INamedTypeSymbol>("C"); 418firstTarget.GetMember<INamedTypeSymbol>("D"); 486var typeC = namespaceN.GetMember<INamedTypeSymbol>("C");
Symbols\Source\FieldTests.cs (7)
62var a = global.GetTypeMembers("A", 0).Single(); 90var a = global.GetTypeMembers("A", 0).Single(); 119var a = global.GetTypeMembers("A", 0).Single(); 143var a = global.GetTypeMembers("A", 0).Single(); 177var a = global.GetTypeMembers("A", 0).Single(); 200var type1 = comp.GlobalNamespace.GetTypeMembers("C", 1).Single(); 201var type2 = type1.GetTypeMembers("S").Single();
Symbols\Source\FileModifierTests.cs (18)
4142var sourceType = comp.GetTypeByMetadataName("<>FE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855__C"); 4158var metadataType = comp2.GetTypeByMetadataName("<>FE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855__C"); 4177var sourceType = comp.GetTypeByMetadataName("<>FE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855__C`1"); 4190var metadataType = comp2.GetTypeByMetadataName("<>FE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855__C`1"); 4215var sourceType = comp.GetTypeByMetadataName("Outer.<>FE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855__C"); 4240var sourceType = comp.GetTypeByMetadataName("<file1>F96B1D9CB33A43D51528FE81EDAFE5AE31358FE749929AC76B76C64B60DEF129D__C"); 4243var sourceTypeCByMetadataName = comp.GetTypeByMetadataName("C"); 4255var metadataType = comp2.GetTypeByMetadataName("<file1>F96B1D9CB33A43D51528FE81EDAFE5AE31358FE749929AC76B76C64B60DEF129D__C"); 4258var metadataTypeCByMetadataName = comp2.GetTypeByMetadataName("C"); 4283var sourceType = comp.GetTypeByMetadataName(metadataName); 4311var sourceType = ((Compilation)comp).GetTypeByMetadataName(metadataName); 4340var sourceType = ((Compilation)comp).GetTypeByMetadataName($"<SomeFile>F{checksum}__C"); 4411var type = (INamedTypeSymbol)model.GetTypeInfo(node.Type!).Type!; 4455var type = (INamedTypeSymbol)model.GetTypeInfo(node.Type!).Type!; 4478var type = (INamedTypeSymbol)model.GetTypeInfo(node.Type!).Type!;
Symbols\Source\MethodTests.cs (20)
35var a = global.GetTypeMembers("A", 0).Single(); 70var a = global.GetTypeMembers(className, 0).Single(); 115var a = global.GetTypeMembers("A", 0).Single(); 140var a = global.GetTypeMembers("A", 0).Single(); 167var a = global.GetTypeMembers("A", 0).Single(); 169var b = global.GetTypeMembers("B", 0).Single(); 189var mylist = global.GetTypeMembers("MyList", 1).Single(); 211var a = global.GetTypeMembers("A", 0).Single(); 230var a = global.GetTypeMembers("A", 0).Single(); 258var a = global.GetTypeMembers("A", 0).Single(); 283var a = global.GetTypeMembers("A", 0).Single(); 304var a = global.GetTypeMembers("A", 0).Single(); 326var a = global.GetTypeMembers("A", 0).Single(); 342var a = global.GetTypeMembers("A", 0).Single(); 359var a = global.GetTypeMembers("A", 0).Single(); 403var a = global.GetTypeMembers("A", 0).Single(); 426var classTest = comp.GlobalNamespace.GetTypeMembers("Test", 0).Single(); 445var classTest = comp.GlobalNamespace.GetTypeMembers("Test", 0).Single(); 1409var c = comp.GlobalNamespace.GetTypeMembers("C").Single(); 2574var classC = model.GetDeclaredSymbol(type);
Symbols\Source\ModifierTests.cs (3)
49var a = global.GetTypeMembers("A", 0).Single(); 112var script = comp.ScriptClass; 152var intType = comp.GetSpecialType(SpecialType.System_Int32);
Symbols\Source\NullablePublicAPITests.cs (25)
90var expressionTypes = invocations.Select(inv => model.GetTypeInfoAndVerifyIOperation(inv).Type).Cast<INamedTypeSymbol>().ToList(); 146var c = ((Compilation)comp).GetTypeByMetadataName("C"); 213var c = ((Compilation)comp).GetTypeByMetadataName("C"); 287var c = ((Compilation)compilation).GetTypeByMetadataName("C"); 376var c = ((Compilation)compilation).GetTypeByMetadataName("C"); 479var c = ((Compilation)compilation).GetTypeByMetadataName("C"); 487var e = ((Compilation)compilation).GetTypeByMetadataName("Ext"); 636var c = ((Compilation)compilation).GetTypeByMetadataName("C"); 693comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 757comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 822comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("I")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 825ITypeParameterSymbol typeParameterSymbol = ((INamedTypeSymbol)((INamedTypeSymbol)method.ReturnType).GetMembers("B").Single()).TypeParameters.Single(); 889comp => ((INamedTypeSymbol)((Compilation)comp).GetMember("IB")).GetMembers().OfType<IMethodSymbol>().Where(m => m.Name.StartsWith("F")).ToArray(), 892var result = ((INamedTypeSymbol)method.ReturnType).TypeArguments.Single().NullableAnnotation; 893Assert.Equal(result, ((INamedTypeSymbol)method.ReturnType).TypeArgumentNullableAnnotations.Single()); 894Assert.Equal(result, ((INamedTypeSymbol)method.ReturnType).TypeArgumentNullableAnnotations().Single()); 1211var aType = comp.GetTypeByMetadataName("A"); 1212var bType = comp.GetTypeByMetadataName("B"); 1213var cType = comp.GetTypeByMetadataName("C"); 1214var dType = comp.GetTypeByMetadataName("D"); 1907Assert.Equal(expectedAnnotation, ((INamedTypeSymbol)methodSymbol.ReturnType).TypeArgumentNullableAnnotations.Single()); 1908Assert.Equal(expectedAnnotation, ((INamedTypeSymbol)methodSymbol.ReturnType).TypeArgumentNullableAnnotations().Single()); 3367var spanType = (INamedTypeSymbol)propertySymbol.ReturnType;
Symbols\Source\PropertyTests.cs (6)
359var a = global.GetTypeMembers("A", 0).Single(); 360var i = global.GetTypeMembers("I", 0).Single(); 392var type01 = global.GetTypeMembers("C").Single(); 393var type02 = type01.GetTypeMembers("S").Single(); 1924var a = global.GetTypeMembers("A", 0).Single(); 2616var ia = comp.GetTypeByMetadataName("IA");
Symbols\Source\SourcePlusMetadataTests.cs (14)
28var x = global.GetTypeMembers("X", 0).Single(); 30var y = global.GetTypeMembers("Y", 0).Single(); 45var x = global.GetTypeMembers("X", 0).Single(); 61var x = global.GetTypeMembers("X", 0).Single(); 63var y = global.GetTypeMembers("Y", 0).Single(); 65var z = global.GetTypeMembers("Z", 0).Single(); 188var srcSym = compilation.GlobalNamespace.GetTypeMembers("BaseTypeSpecifierClass").Single(); 192var metaSym = comp2.GlobalNamespace.GetTypeMembers("BaseTypeSpecifierClass").First(); 204var srcSym = compilation.GlobalNamespace.GetTypeMembers("FooAttribute").Single(); 208var metaSym = comp2.GlobalNamespace.GetTypeMembers("FooAttribute").First(); 231var classC = compilation.GlobalNamespace.GetTypeMembers("Test").Single(); 236var metaType = comp2.GlobalNamespace.GetTypeMembers("Test").Single(); 251var a = global.GetTypeMembers("A", 0).Single(); 252var b = global.GetTypeMembers("B", 0).Single();
Symbols\Source\TypeMapTests.cs (17)
55var at = global.GetTypeMembers("A", 1).Single(); // A<T> 58var atbu = at.GetTypeMembers("B", 1).Single(); // A<T>.B<U> 60var c = atbu.GetTypeMembers("C", 0).Single(); // A<T>.B<U>.C 65var e = global.GetTypeMembers("E", 0).Single(); // E 66var f = global.GetTypeMembers("F", 0).Single(); // F 67var top = global.GetTypeMembers("Top", 0).Single(); // Top 72var bf = top.GetTypeMembers("BF", 0).Single(); // Top.BF 137var _int = compilation.GetSpecialType(SpecialType.System_Int32); 138var _byte = compilation.GetSpecialType(SpecialType.System_Byte); 139var _char = compilation.GetSpecialType(SpecialType.System_Char); 140var C1 = compilation.GetTypeByMetadataName("C1`2"); 141var c1OfByteChar = C1.Construct(_byte, _char); 179var _int = compilation.GetSpecialType(SpecialType.System_Int32); 180var _byte = compilation.GetSpecialType(SpecialType.System_Byte); 181var _char = compilation.GetSpecialType(SpecialType.System_Char); 182var C1 = compilation.GetTypeByMetadataName("C1`2"); 184var c1OfByteChar = C1.Construct(_byte, _char);
Symbols\StaticAbstractMembersInInterfacesTests.cs (17)
149var i1 = compilation1.GetTypeByMetadataName("I1"); 860var i1 = compilation1.GetTypeByMetadataName("I1"); 988var i1 = compilation1.GetTypeByMetadataName("I1"); 1018var i1 = compilation1.GetTypeByMetadataName("I1"); 1060var i1 = compilation1.GetTypeByMetadataName("I1"); 1153var i1 = compilation1.GetTypeByMetadataName("I1"); 1190var i1 = compilation1.GetTypeByMetadataName("I1"); 1227var i1 = compilation1.GetTypeByMetadataName("I1"); 1274var i1 = compilation1.GetTypeByMetadataName("I1"); 1325var i1 = compilation1.GetTypeByMetadataName("I1"); 1380var i1 = compilation1.GetTypeByMetadataName("I1"); 1438var i1 = compilation1.GetTypeByMetadataName("I1"); 1493var i1 = compilation1.GetTypeByMetadataName("I1"); 1551var i1 = compilation1.GetTypeByMetadataName("I1"); 1731var i1 = compilation1.GetTypeByMetadataName("I1"); 2537var i1 = compilation1.GetTypeByMetadataName("I1"); 3370var i1 = compilation1.GetTypeByMetadataName("I1");
Symbols\SymbolDistinguisherTests.cs (2)
315var errorType = dummyComp.GetSpecialType(SpecialType.System_Int32); 316var validType = CreateEmptyCompilation("", new[] { MscorlibRef }).GetSpecialType(SpecialType.System_Int32);
Symbols\SymbolEqualityTests.cs (9)
781var field1 = (IFieldSymbol)((INamedTypeSymbol)model.GetDeclaredSymbol(member1Syntax)).GetMembers("field").Single(); // A<T!>! A<T>.field 795var field1ContainingType = field1.ContainingType; //A<T> 796var field2ContainingType = field2.ContainingType; //A<T!> 832var method1 = (IMethodSymbol)((INamedTypeSymbol)model.GetDeclaredSymbol(member1Syntax)).GetMembers("M").Single(); // A<T!>! A<T>.M(A<T!>! t) 853var method1ContainingType = method1.ContainingType; //A<T> 854var method2ContainingType = method2.ContainingType; //A<T!> 893var event1 = (IEventSymbol)((INamedTypeSymbol)model.GetDeclaredSymbol(member1Syntax)).GetMembers("MyEvent").Single(); // System.EventHandler<T!>! A<T>.MyEvent 907var event1ContainingType = event1.ContainingType; //A<T> 908var event2ContainingType = event2.ContainingType; //A<T!>
Symbols\SymbolErrorTests.cs (1)
19374var derived = comp.SourceModule.GlobalNamespace.GetTypeMembers("Derived").Single();
Symbols\TypeTests.cs (20)
40var c = compilation.GlobalNamespace.GetTypeMembers("C")[0]; 87var a = global.GetTypeMembers("A", 0).Single(); 88var b = global.GetTypeMembers("B", 0).Single(); 89var s = global.GetTypeMembers("S").Single(); 466var classTest = comp.GlobalNamespace.GetTypeMembers("Test", 0).Single(); 621var a = global.GetTypeMembers("A", 0).Single(); 669var v = comp.GlobalNamespace.GetTypeMembers("MyEnum", 0).Single(); 905var classTest = globalNS.GetTypeMembers("Test").First(); 927var typeSym = comp.Assembly.GlobalNamespace.GetTypeMembers().First(); 967var typeSym = comp.Assembly.GlobalNamespace.GetTypeMembers("MyClass").First(); 1017var typeSym = comp.Assembly.GlobalNamespace.GetTypeMembers("SubGenericClass").First(); 1387var bar = comp.GetTypeByMetadataName("Bar"); 1504var topType = comp.SourceModule.GlobalNamespace.GetTypeMembers("NullableTest").FirstOrDefault(); 1611var topType = comp.SourceModule.GlobalNamespace.GetTypeMembers("S").FirstOrDefault(); 1612var nestedType = topType.GetTypeMembers("Nested").Single(); 1613var enumType = comp.SourceModule.GlobalNamespace.GetTypeMembers("E").Single(); 1702var paras = ((INamedTypeSymbol)memType).DelegateInvokeMethod.Parameters; 1716memType = ((INamedTypeSymbol)memType).DelegateInvokeMethod.ReturnType; 1804var Goo = compilation.GlobalNamespace.GetTypeMembers("Goo")[0]; 1858var originalDefinition = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (13)
Parsing\ReadOnlyStructs.cs (13)
44var s1 = comp.GetTypeByMetadataName("Program+S1"); 50var s2 = comp.GetTypeByMetadataName("Program+S2"); 56var s3 = comp.GetTypeByMetadataName("Program+S3"); 118var s1 = comp.GetTypeByMetadataName("Program+S1"); 124var s2 = comp.GetTypeByMetadataName("Program+S2"); 130var s3 = comp.GetTypeByMetadataName("Program+S3"); 153var s1 = comp.GetTypeByMetadataName("Program+S1"); 159var s2 = comp.GetTypeByMetadataName("Program+S2"); 186var s1 = comp.GetTypeByMetadataName("Program+S1"); 190var s2 = comp.GetTypeByMetadataName("Program+S2"); 220var s1 = comp.GetTypeByMetadataName("Program+S1"); 224var s2 = comp.GetTypeByMetadataName("Program+S2"); 228var s3 = comp.GetTypeByMetadataName("Program+S3");
Microsoft.CodeAnalysis.CSharp.Test.Utilities (23)
Extensions.cs (22)
179var type = compilation.GetMember<INamedTypeSymbol>(qualifiedTypeName); 190var type = compilation.GetMember<INamedTypeSymbol>(qualifiedTypeName); 196var type = compilation.GetMember<INamedTypeSymbol>(qualifiedTypeName); 202var type = compilation.GetMember<INamedTypeSymbol>(qualifiedTypeName); 347public static INamedTypeSymbol GetTypeMember(this INamespaceOrTypeSymbol symbol, string name) 694public static ImmutableArray<INamedTypeSymbol> AllEffectiveInterfacesNoUseSiteDiagnostics(this ITypeParameterSymbol symbol) 741public static INamedTypeSymbol GetWellKnownType(this Compilation compilation, WellKnownType type) 768return type is INamedTypeSymbol namedType && namedType.IsUnboundGenericType; 776public static INamedTypeSymbol CreateTupleTypeSymbol( 785public static INamedTypeSymbol CreateTupleTypeSymbol( 795public static INamedTypeSymbol Construct(this INamedTypeSymbol definition, params TypeSymbol[] typeArguments) 835return type.TypeKind == TypeKind.Enum ? ((INamedTypeSymbol)type).EnumUnderlyingType : type; 838public static INamedTypeSymbol GetEnumUnderlyingType(this ITypeSymbol type) 840var namedType = type as INamedTypeSymbol; 849return ((INamedTypeSymbol)symbol).ConstructedFrom; 872public static IEnumerable<Microsoft.CodeAnalysis.NullableAnnotation> TypeArgumentNullableAnnotations(this INamedTypeSymbol type)
TestAttributesVisitor.cs (1)
211var containingType = attribute.AttributeConstructor!.ContainingType;
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
Metadata\WinMdEventTests.cs (2)
3576var voidType = compilation.GetSpecialType(SpecialType.System_Void); 3607var voidType = compilation.GetSpecialType(SpecialType.System_Void);
Microsoft.CodeAnalysis.CSharp.Workspaces (113)
Recommendations\CSharpRecommendationServiceRunner.cs (9)
385INamedTypeSymbol? enclosingNamedType, 386ISet<INamedTypeSymbol> outerTypes, 432INamedTypeSymbol? enclosingNamedType, 714INamedTypeSymbol? instanceType, staticType; 715if (symbol is INamedTypeSymbol namedType) 724instanceType = reinterpretedSymbol.GetSymbolType() as INamedTypeSymbol; 733if (reinterpretedSymbol is not INamedTypeSymbol reinterprettedNamedType) 736instanceType = symbol.GetSymbolType() as INamedTypeSymbol; 823if (containerSymbol is INamedTypeSymbol typeSymbol && typeSymbol.IsSystemVoid())
Recommendations\CSharpRecommendationServiceRunner_Conversions.cs (6)
137if (container.RemoveNullableIfPresent() is INamedTypeSymbol namedType) 153ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols) 201ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols) 229ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols, ImmutableArray<SpecialType> specialTypes) 258private static IMethodSymbol CreateConversion(INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType, string? documentationCommentXml) 266ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols)
Rename\CSharpRenameRewriterLanguageService.cs (3)
367if (symbol is INamedTypeSymbol namedTypeSymbol) 797if (renamedSymbol is INamedTypeSymbol { TypeKind: not TypeKind.Enum } namedType) 802if (renamedSymbol.ContainingSymbol is INamedTypeSymbol { TypeKind: not TypeKind.Enum } containingNamedType &&
Simplification\CSharpSimplificationService.Expander.cs (5)
472aliasTarget = ((INamedTypeSymbol)aliasTarget).ConstructUnboundGenericType(); 475if (aliasTarget is INamedTypeSymbol typeSymbol && typeSymbol.IsTupleType) 842if (symbol is INamedTypeSymbol namedTypedSymbol) 1025var type = semanticModel.GetTypeInfo(typeOfExpression.Type, _cancellationToken).Type as INamedTypeSymbol;
Simplification\Simplifiers\ExpressionSimplifier.cs (3)
178if (symbol is INamedTypeSymbol namedType) 373if (leftSymbol is INamedTypeSymbol) 417if (leftSymbol is INamedTypeSymbol)
Simplification\Simplifiers\NameSimplifier.cs (6)
260if (typeSymbol is INamedTypeSymbol namedType) 274var type = (INamedTypeSymbol)symbol; 401private static bool CanSimplifyNullable(INamedTypeSymbol type, NameSyntax name, SemanticModel semanticModel) 717var symbol = model.GetSymbolInfo(name).Symbol as INamedTypeSymbol;
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (1)
48if (symbol is INamedTypeSymbol namedSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (5)
45var tupleType = (INamedTypeSymbol)typeInDeclaration; 127if (semanticModel.GetTypeInfo(containingTypeName, cancellationToken).Type is not INamedTypeSymbol containingType) 141INamedTypeSymbol containingType) 188if (symbol is not INamedTypeSymbol namedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (2)
1011lambda.GetTargetType(semanticModel, cancellationToken) is INamedTypeSymbol { DelegateInvokeMethod.ReturnType: var returnType } ? returnType : null; 1047foreach (var iface in collectionTargetType.AllInterfaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
40public static bool TryGetPrimaryConstructor(this INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
460public static INamedTypeSymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, BaseTypeDeclarationSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
787[NotNullWhen(true)] INamedTypeSymbol? expressionType, 820static bool TakesExpressionTree(SymbolInfo info, INamedTypeSymbol expressionType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
93public bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol) 230public bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken) 392public bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, [NotNullWhen(true)] INamedTypeSymbol? expressionType, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (9)
127var enumType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type as INamedTypeSymbol; 162var enumType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type as INamedTypeSymbol; 627if (castedType is not INamedTypeSymbol namedCastedType || 628originalConvertedType is not INamedTypeSymbol originalNamedConvertedType) 946if (conversionOperation.Operand.Type is not INamedTypeSymbol original) 955for (var type = original; type != null; type = type.BaseType) 1321var rewrittenContainingType = rewrittenMemberSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
63CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 68var namedType = @event.Type as INamedTypeSymbol; 247protected override TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 729INamedTypeSymbol namedType, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpFlagsEnumGenerator.cs (2)
21INamedTypeSymbol enumType, 38protected override bool IsValidName(INamedTypeSymbol enumType, string name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (3)
160var namedType = enumMember.Type as INamedTypeSymbol; 161var underlyingType = namedType?.EnumUnderlyingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
62if (type is INamedTypeSymbol { TypeKind: TypeKind.Enum } enumType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
366if (method.IsReadOnly && (method.ContainingSymbol as INamedTypeSymbol)?.IsReadOnly != true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
28INamedTypeSymbol namedType, 42INamedTypeSymbol namedType, 57INamedTypeSymbol namedType, 69INamedTypeSymbol namedType, 152INamedTypeSymbol namedType, 182INamedTypeSymbol namedType, 226INamedTypeSymbol namedType, 244INamedTypeSymbol namedType, 261INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info) 267INamedTypeSymbol namedType, 311INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info) 316private static BaseListSyntax? GenerateBaseList(INamedTypeSymbol namedType) 322foreach (var type in namedType.Interfaces) 331private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateConstraintClauses(INamedTypeSymbol namedType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (1)
112foreach (var type in ns.GetTypeMembers())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1034INamedTypeSymbol nt => nt.Arity > 0, 1043return symbols.All(static s => s is INamedTypeSymbol or IMethodSymbol); 3046return ((INamedTypeSymbol)symbol).TypeKind == TypeKind.Enum;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
41public override ExpressionSyntax VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (5)
118public static bool TryCreateNativeIntegerType(INamedTypeSymbol symbol, [NotNullWhen(true)] out TypeSyntax? syntax) 174public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol) 224private static TypeSyntax? TryCreateSpecializedNamedTypeSyntax(INamedTypeSymbol symbol) 250private static TupleTypeSyntax CreateTupleTypeSyntax(INamedTypeSymbol symbol) 263public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
77var typeSymbol = model.GetRequiredDeclaredSymbol(typeNode, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
209public override SyntaxNode DeclarationPattern(INamedTypeSymbol type, string name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (18)
330if (types.Any(t => t is INamedTypeSymbol)) 332return types.OfType<INamedTypeSymbol>().SelectMany(t => 363.OfType<INamedTypeSymbol>() 440if (info.Type is not INamedTypeSymbol type) 461if (info.Type is not INamedTypeSymbol type) 567if (info.Type is INamedTypeSymbol type) 704var inferredNamedType = (INamedTypeSymbol)inferredType; 705var returnNamedType = (INamedTypeSymbol)returnType; 1408if (types.Any(t => t is INamedTypeSymbol)) 1410return types.OfType<INamedTypeSymbol>().SelectMany(t => 1431if (types.Any(t => t is INamedTypeSymbol)) 1438return types.OfType<INamedTypeSymbol>().SelectMany(t => 1583var type = Compilation.CreateTupleTypeSymbol( 1994return memberType is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1 2008var namedTypeSymbol = (INamedTypeSymbol)type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
103var namedType = parameter.ContainingType;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (125)
CodeGeneration\SymbolEditorTests.cs (72)
82var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 114var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.AddMember(d, Generator.MethodDeclaration("m"))); 118newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.AddMember(d, Generator.MethodDeclaration("m2"))); 151var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 155newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(newSymbol, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m2"))); 198var newSymbolA = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolA, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("ma"))); 201var newSymbolB = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolB, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("mb"))); 244var newSymbolA = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolA, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("ma"))); 247var newSymbolB = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolB, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("mb"))); 283var newSymbol = (INamedTypeSymbol)await editor.EditAllDeclarationsAsync(symbol, (e, d) => e.SetAccessibility(d, Accessibility.Internal)); 320var newSymbol = (INamedTypeSymbol)await editor.EditAllDeclarationsAsync(symbol, (e, d) => e.SetAccessibility(d, Accessibility.Public)); 359var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, location, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 396var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, location, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 437var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, location, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 441var newSymbol2 = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(newSymbol, location, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m2"))); 483var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, location, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m"))); 488var newSymbol2 = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(newSymbol, newLocation, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m2"))); 529var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 533var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, member, (e, d) => e.AddMember(d, e.Generator.MethodDeclaration("m2"))); 559var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.SetName(d, "X")); 596var newSymbol = (INamedTypeSymbol)await editor.EditAllDeclarationsAsync(symbol, (e, d) => e.SetName(d, "X")); 623var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.RemoveNode(d)); 653var newSymbol = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbol, (e, d) => e.RemoveNode(d)); 682var newSymbol = (INamedTypeSymbol)await editor.EditAllDeclarationsAsync(symbol, (e, d) => e.RemoveNode(d)); 711var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 718var newSymbolX = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolX, (e, d) => e.RemoveNode(d)); 725var newSymbolY = (INamedTypeSymbol)await editor.EditOneDeclarationAsync(symbolY, (e, d) => e.RemoveNode(d)); 762var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 803var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 836var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 869var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 902var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 943var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 976var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 1001var symbol = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 1033var typeC = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "C")).First(); 1043var typeI = (INamedTypeSymbol)(await GetSymbolsAsync(solution, "I")).First();
CodeGeneration\SyntaxGeneratorTests.cs (53)
233var typeC = compilation.GlobalNamespace.GetMembers("C").First() as INamedTypeSymbol; 277var intType = _emptyCompilation.GetSpecialType(SpecialType.System_Int32); 315var genericType = _emptyCompilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T); 405var intType = _emptyCompilation.GetSpecialType(SpecialType.System_Int32); 406var listType = _emptyCompilation.GetTypeByMetadataName("System.Collections.Generic.List`1"); 407var listOfIntType = listType.Construct(intType); 988var gcHandleType = _emptyCompilation.GetTypeByMetadataName(typeof(GCHandle).FullName); 996var doubleType = _emptyCompilation.GetSpecialType(SpecialType.System_Decimal); 2209var type = compilation.GetTypeByMetadataName("D"); 2226var type = compilation.GetTypeByMetadataName("C"); 2247var type = compilation.GetTypeByMetadataName("C"); 2268var type = compilation.GetTypeByMetadataName("C"); 2289var type = compilation.GetTypeByMetadataName("C"); 2310var type = compilation.GetTypeByMetadataName("C"); 2332var type = compilation.GetTypeByMetadataName("C"); 2350var type = compilation.GetTypeByMetadataName("C"); 2373var type = compilation.GetTypeByMetadataName("B"); 2401var type = compilation.GetTypeByMetadataName("B"); 2429var type = compilation.GetTypeByMetadataName("B"); 2460var type = compilation.GetTypeByMetadataName("B"); 2494var type = compilation.GetTypeByMetadataName("Goo"); 2537var type = compilation.GetTypeByMetadataName("C"); 2560var type = compilation.GetTypeByMetadataName("C"); 2590var type = compilation.GetTypeByMetadataName("C"); 3782var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 3963var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 3981var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4002var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4020var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4038var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4056var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4074var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4092var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4110var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First(); 4595var symbolR = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("R").First(); 4610var symbolR = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("R").First(); 4633var symbolR = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("R").First(); 4648var symbolR = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("R").First();
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (5)
MoveStaticMembers\TestMoveStaticMembersService.cs (1)
37public MoveStaticMembersOptions GetMoveMembersToTypeOptions(Document document, INamedTypeSymbol selectedType, ImmutableArray<ISymbol> selectedNodeSymbols)
PullMemberUp\TestPullMemberUpService.cs (4)
31var containingType = selectedNodeSymbols[0].ContainingType; 39var baseClass = containingType.BaseType; 41INamedTypeSymbol destination = null; 60for (var i = baseClass; i != null; i = i.BaseType)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (146)
CodeGeneration\CodeGenerationTests.cs (18)
85(INamedTypeSymbol)testContext.GetDestination(), 127(INamedTypeSymbol)testContext.GetDestination(), 172(INamedTypeSymbol)testContext.GetDestination(), 213(INamedTypeSymbol)testContext.GetDestination(), 248(INamedTypeSymbol)testContext.GetDestination(), 294(INamedTypeSymbol)testContext.GetDestination(), 362(INamedTypeSymbol)testContext.GetDestination(), 386var typeSymbol = GetTypeSymbol(type)(testContext.SemanticModel); 402(INamedTypeSymbol)testContext.GetDestination(), 438var typeSymbol = GetTypeSymbol(type)(testContext.SemanticModel); 495(INamedTypeSymbol)testContext.GetDestination(), 508INamedTypeSymbol baseType = null, 509ImmutableArray<INamedTypeSymbol> interfaces = default, 516var type = CodeGenerationSymbolFactory.CreateNamedTypeSymbol( 552var attributeType = GetTypeSymbol(attributeClass)(testContext.SemanticModel); 647testContext.Result = await testContext.Service.AddMembersAsync(solutionContext, (INamedTypeSymbol)destination, members, CancellationToken.None); 719private static Func<SemanticModel, INamedTypeSymbol> GetTypeSymbol(Type type) 722private static Func<SemanticModel, INamedTypeSymbol> GetTypeSymbol(string typeMetadataName)
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
112var generatedSymbol = generatedCompilation.Assembly.GetTypeByMetadataName(symbolName);
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
181var namedTypeSymbol = assemblySymbol.GetTypeByMetadataName(symbolMetadataName);
SymbolFinder\DependentTypeFinderTests.cs (37)
76var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 79var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 86var derivedDependentType = Assert.Single(derivedFromBase); 117var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseInterface"); 120var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedInterface"); 127var derivedDependentType = Assert.Single(derivedFromBase); 168var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 171var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 178var derivedDependentType = Assert.Single(derivedFromBase); 209var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 212var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 219var derivedDependentType = Assert.Single(derivedFromBase); 251var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 254var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 261var derivedDependentType = Assert.Single(derivedFromBase); 293var baseClassSymbol = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 296var derivedClassSymbol = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 303var derivedDependentType = Assert.Single(derivedFromBase); 334var baseInterfaceSymbol = portableCompilation.GetTypeByMetadataName("N.IBaseInterface"); 337var implementingClassSymbol = normalCompilation.GetTypeByMetadataName("M.ImplementingClass"); 375var baseInterfaceSymbol = portableCompilation.GetTypeByMetadataName("N.IBaseInterface"); 378var implementingClassSymbol = normalCompilation.GetTypeByMetadataName("M.ImplementingClass"); 415var baseInterfaceSymbol = portableCompilation.GetTypeByMetadataName("N.IBaseInterface"); 418var implementingClassSymbol = normalCompilation.GetTypeByMetadataName("M.ImplementingClass"); 439var rootType = compilation.GetTypeByMetadataName("System.IO.Stream"); 484var rootType = compilation.GetTypeByMetadataName("IA"); 536var rootType = compilation.GetTypeByMetadataName("IA"); 573var rootType = compilation.GetTypeByMetadataName("System.ICloneable"); 603var rootType = compilation.GetTypeByMetadataName("System.IComparable"); 648var firstType = (INamedTypeSymbol)semanticModel.GetDeclaredSymbol(firstDecl); 703var baseClass = compilation.GetTypeByMetadataName("N_Main.T_BaseProject_BaseClass"); 710var baseClass = compilation.GetTypeByMetadataName("N_Main.T_BaseProject_DerivedClass1"); 717var baseClass = compilation.GetTypeByMetadataName("N_Main.T_BaseProject_DerivedClass2"); 757var classSymbol = compilation2.GetTypeByMetadataName("M.C"); 760var interfaceSymbol = compilation1.GetTypeByMetadataName("N.I"); 788var baseInterfaceSymbol = portableCompilation.GetTypeByMetadataName("N.I");
Utilities\SymbolEquivalenceComparerTests.cs (89)
125var vbType = (await vbWorkspace.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 194var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 195var type2_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 196var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 197var type2_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 245var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 246var type2_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 247var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 248var type2_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 284var typeC = (await workspace.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 285var typeD = (await workspace.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("D").Single(); 328var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 329var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 353var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 354var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 378var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 379var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 403var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 404var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 428var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 429var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 455var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 456var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 482var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 483var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 509var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 510var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 534var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 535var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 559var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 560var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 586var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 587var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 620var csharpType1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 621var vbType1 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 665var csharpType1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 666var vbType1 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 696var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 722var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 723var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 757var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 758var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 790var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 791var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 825var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 826var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 862var outerType1 = outer1.GetTypeMembers("Type").Single(); 863var outerType2 = outer2.GetTypeMembers("Type").Single(); 865var innerType1 = inner1.GetTypeMembers("Type").Single(); 866var innerType2 = inner2.GetTypeMembers("Type").Single(); 933var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 934var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 935var type2_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 936var type2_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 970var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 971var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type2").Single(); 995var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 996var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 1020var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 1021var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 1051var outer = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Outer").Single(); 1052var other = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Other").Single(); 1053var type1_v1 = outer.GetTypeMembers("Type1").Single(); 1054var type1_v2 = other.GetTypeMembers("Type1").Single(); 1081var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 1082var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("Type1").Single(); 1112var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1113var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1152var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1153var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1182var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1183var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1212var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1213var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1243var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1244var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1274var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1275var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1306var type1_v1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1307var type1_v2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1343var t1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1344var t2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1407var t1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1408var t2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1470var t1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1471var t2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1533var t1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1534var t2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("T").Single(); 1887var type1 = compilation.GlobalNamespace.GetTypeMembers(typeName).Single();
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
93Dim namedType = DirectCast(context.Symbol, INamedTypeSymbol)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
121public sealed override void VisitNamedType(INamedTypeSymbol symbol)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
ExtractClass\IOmniSharpExtractClassOptionsService.cs (1)
12OmniSharpExtractClassOptions? GetExtractClassOptions(Document document, INamedTypeSymbol originalType, ImmutableArray<ISymbol> selectedMembers);
Internal\ExtractClass\OmniSharpExtractClassOptionsService.cs (1)
27INamedTypeSymbol originalType,
Microsoft.CodeAnalysis.Features (625)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
145static AddConstructorParametersCodeAction GetOptionalContructorParametersCodeAction(Document document, CodeGenerationContextInfo info, ConstructorCandidate constructorCandidate, INamedTypeSymbol containingType, bool useSubMenuName)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (2)
27public INamedTypeSymbol? ContainingType { get; private set; } 78INamedTypeSymbol containingType,
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (5)
51var typeSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(type, cancellationToken); 113private async Task<Document> ApplyAsync(Document document, TTypeDeclarationSyntax type, INamedTypeSymbol debuggerAttributeTypeSymbol, CancellationToken cancellationToken) 158var typeSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(type, cancellationToken);
AddImport\SymbolReferenceFinder.cs (4)
173/// to the <see cref="INamespaceSymbol"/>s or <see cref="INamedTypeSymbol"/>s those types are 313if (propertyOrFieldType is INamedTypeSymbol propertyType && 321var namedTypeSymbols = OfType<INamedTypeSymbol>(symbolResults); 337private bool HasAccessibleStaticFieldOrProperty(INamedTypeSymbol namedType, string fieldOrPropertyName)
ChangeSignature\AbstractChangeSignatureService.cs (4)
84protected abstract bool TryGetRecordPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor); 116var containingType = method.ContainingType; 132if (symbol is INamedTypeSymbol typeSymbol) 299if (eventSymbol.Type is INamedTypeSymbol type && type.DelegateInvokeMethod != null)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (3)
53INamedTypeSymbol suppressMessageAttribute, 61SyntaxNode targetNode, ISymbol targetSymbol, INamedTypeSymbol suppressMessageAttribute, Diagnostic diagnostic); 197INamedTypeSymbol suppressMessageAttribute = null;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs (2)
19ISymbol targetSymbol, INamedTypeSymbol suppressMessageAttribute, 23private readonly INamedTypeSymbol _suppressMessageAttribute = suppressMessageAttribute;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (2)
27private readonly INamedTypeSymbol _suppressMessageAttribute; 32INamedTypeSymbol suppressMessageAttribute,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.LocalSuppressMessageCodeAction.cs (2)
17INamedTypeSymbol suppressMessageAttribute, 24private readonly INamedTypeSymbol _suppressMessageAttribute = suppressMessageAttribute;
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (2)
312var symbol = (INamedTypeSymbol?)State.SemanticDocument.SemanticModel.GetDeclaredSymbol(node, CancellationToken);
CodeRefactorings\MoveType\AbstractMoveTypeService.State.cs (1)
58if (SemanticDocument.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol typeSymbol ||
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
334if (memberSymbol is INamedTypeSymbol typeSymbol 531if (symbol is INamedTypeSymbol typeSymbol && typeSymbol.MightContainExtensionMethods)
Common\SymbolDisplayPartKindTags.cs (1)
11public static SymbolDisplayPartKind GetSymbolDisplayPartKind(this INamedTypeSymbol namedType)
Common\TaggedText.cs (1)
114else if (alias.Target is INamedTypeSymbol namedType)
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
239if (symbol is INamedTypeSymbol namedType && namedType.IsDelegateType())
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (2)
39Document document, CompletionItem item, Compilation compilation, ISymbol member, INamedTypeSymbol containingType, CancellationToken cancellationToken); 147var containingType = semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(line.Start, cancellationToken);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (2)
36if (type is not INamedTypeSymbol initializedType) 91protected virtual bool IsInitializableFieldOrProperty(ISymbol fieldOrProperty, INamedTypeSymbol containingType)
Completion\Providers\AbstractOverrideCompletionProvider.cs (1)
35Document document, CompletionItem completionItem, Compilation compilation, ISymbol overriddenMember, INamedTypeSymbol containingType, CancellationToken cancellationToken)
Completion\Providers\AbstractOverrideCompletionProvider.ItemGetter.cs (1)
94var containingType = semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(startToken.SpanStart, CancellationToken);
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (2)
63Document document, CompletionItem item, Compilation compilation, ISymbol member, INamedTypeSymbol containingType, CancellationToken cancellationToken) 88if (semanticModel.GetEnclosingSymbol(position, cancellationToken) is not INamedTypeSymbol enclosingSymbol)
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (9)
41if (semanticModel.GetDeclaredSymbol(node, cancellationToken) is INamedTypeSymbol declaredSymbol) 61private CompletionItem CreateCompletionItem(INamedTypeSymbol symbol, TSyntaxContext context) 75protected abstract ImmutableArray<KeyValuePair<string, string>> GetProperties(INamedTypeSymbol symbol, TSyntaxContext context); 79protected abstract (string displayText, string suffix, string insertionText) GetDisplayAndSuffixAndInsertionText(INamedTypeSymbol symbol, TSyntaxContext context); 81protected virtual IEnumerable<INamedTypeSymbol>? LookupCandidateSymbols(TSyntaxContext context, INamedTypeSymbol declaredSymbol, CancellationToken cancellationToken) 94.OfType<INamedTypeSymbol>() 100private static bool InSameProject(INamedTypeSymbol symbol, Compilation compilation) 103private static bool NotNewDeclaredMember(INamedTypeSymbol symbol, TSyntaxContext context)
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (2)
85if (symbol is not INamedTypeSymbol namedType || 113if (symbol is not INamedTypeSymbol namedType ||
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (7)
259foreach (var type in types) 297private readonly struct TypeOverloadInfo(INamedTypeSymbol nonGenericOverload, INamedTypeSymbol bestGenericOverload, bool containsPublicGenericOverload) 299public INamedTypeSymbol NonGenericOverload { get; } = nonGenericOverload; 302public INamedTypeSymbol BestGenericOverload { get; } = bestGenericOverload; 306public TypeOverloadInfo Aggregate(INamedTypeSymbol type) 314var newBestGenericOverload = BestGenericOverload == null || type.Arity < BestGenericOverload.Arity
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (2)
367var containerSymbol = assembly.GetTypeByMetadataName(fullyQualifiedContainerName); 526case INamedTypeSymbol namedType:
Completion\Providers\ImportCompletionProvider\TypeImportCompletionCacheEntry.cs (1)
170public void AddItem(INamedTypeSymbol symbol, string containingNamespace, bool isPublic)
ConvertAnonymousType\AbstractConvertAnonymousTypeCodeRefactoringProvider.cs (3)
17protected static async Task<(TAnonymousObjectCreationExpressionSyntax?, INamedTypeSymbol?)> TryGetAnonymousObjectAsync( 30var anonymousType = semanticModel.GetTypeInfo(anonymousObject, cancellationToken).Type as INamedTypeSymbol;
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (8)
104var namedTypeSymbol = await GenerateFinalNamedTypeAsync( 178Document document, SyntaxEditor editor, INamedTypeSymbol classSymbol, 180INamedTypeSymbol anonymousType, CancellationToken cancellationToken) 214SyntaxEditor editor, INamedTypeSymbol classSymbol, 242private static async Task<INamedTypeSymbol> GenerateFinalNamedTypeAsync( 283var namedTypeWithoutMembers = CreateNamedType(typeName, isRecord: false, capturedTypeParameters, members: default); 312private static INamedTypeSymbol CreateNamedType( 321Document document, INamedTypeSymbol anonymousType)
ConvertAnonymousType\AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (3)
75private IEnumerable<(TAnonymousObjectCreationExpressionSyntax node, INamedTypeSymbol symbol)> GetAllAnonymousTypesInContainer( 92if (semanticModel.GetTypeInfo(childNode, cancellationToken).Type is INamedTypeSymbol childType) 98Document document, TAnonymousObjectCreationExpressionSyntax creationNode, INamedTypeSymbol anonymousType, bool allAnonymousTypes, CancellationToken cancellationToken)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (2)
241var charType = model.Compilation.GetSpecialType(SpecialType.System_Char); 293foreach (var current in collectionType.AllInterfaces)
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (10)
232INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol 239INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol 245INamedTypeSymbol containingType, ITypeSymbol collectionType, 246INamedTypeSymbol ienumerableType, INamedTypeSymbol ienumeratorType, 281INamedTypeSymbol containingType, IMethodSymbol getEnumeratorMethod, 282INamedTypeSymbol ienumeratorType, [NotNullWhen(true)] out ITypeSymbol? iterationType) 314INamedTypeSymbol containingType, 500INamedTypeSymbol containingType, 502INamedTypeSymbol ienumerableType)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (25)
183private static async Task<(SyntaxNode, INamedTypeSymbol)> TryGetTupleInfoAsync( 207var tupleType = semanticModel.GetTypeInfo(expressionOrType, cancellationToken).Type as INamedTypeSymbol; 327SyntaxNode tupleExprOrTypeNode, INamedTypeSymbol tupleType, 420INamedTypeSymbol tupleType, Scope scope, CancellationToken cancellationToken) 436Project startingProject, INamedTypeSymbol tupleType, CancellationToken cancellationToken) 478Project project, INamedTypeSymbol tupleType, CancellationToken cancellationToken) 526var typeSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(containingType, cancellationToken); 553Document document, SyntaxNode tupleExprOrTypeNode, INamedTypeSymbol namedTypeSymbol, 615SyntaxNode startingNode, INamedTypeSymbol tupleType, TNameSyntax fullyQualifiedStructName, 635SyntaxNode startingNode, INamedTypeSymbol tupleType, TNameSyntax qualifiedTypeName, 649if (semanticModel.GetTypeInfo(childCreation, cancellationToken).Type is not INamedTypeSymbol childType) 666private static bool AreEquivalent(StringComparer comparer, INamedTypeSymbol tupleType, INamedTypeSymbol childType) 749INamedTypeSymbol tupleType, TNameSyntax qualifiedTypeName, 762if (semanticModel.GetTypeInfo(childTupleType, cancellationToken).Type is not INamedTypeSymbol childType) 798private static async Task<INamedTypeSymbol> GenerateFinalNamedTypeAsync( 800INamedTypeSymbol tupleType, NamingRule parameterNamingRule, CancellationToken cancellationToken) 812var namedTypeWithoutMembers = CreateNamedType( 848var namedTypeSymbol = CreateNamedType( 855INamedTypeSymbol tupleType, IMethodSymbol constructor) 881INamedTypeSymbol tupleType, INamedTypeSymbol structType) 908private static INamedTypeSymbol CreateNamedType(
Debugging\AbstractBreakpointResolver.cs (7)
75protected abstract IEnumerable<ISymbol> GetMembers(INamedTypeSymbol type, string name); 164case INamedTypeSymbol typeSymbol: 172private static bool MatchesNames(INamedTypeSymbol type, NameAndArity[] names, IEqualityComparer<string> comparer) 211private IEnumerable<ISymbol> FindMembers(IEnumerable<INamedTypeSymbol> types, NameAndArity nameAndArity) 224private async Task<IEnumerable<INamedTypeSymbol>> GetAllTypesAsync(CancellationToken cancellationToken) 292private static IEnumerable<INamedTypeSymbol> GetTypeMembersRecursive(INamespaceOrTypeSymbol container) 296INamedTypeSymbol typeSymbol => typeSymbol.GetTypeMembers().SelectMany(GetTypeMembersRecursive).Concat(typeSymbol),
DesignerAttribute\DesignerAttributeDiscoveryService.cs (7)
305var firstClassType = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(firstClass, cancellationToken); 327static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(Compilation compilation, INamedTypeSymbol firstType) 329var current = firstType; 340static INamedTypeSymbol? TryMapToNonErrorType(Compilation compilation, IErrorTypeSymbol errorType) 344var wellKnownType = compilation.GetTypeByMetadataName($"{wellKnownNamespace}.{errorType.Name}"); 354static bool IsDesignerAttribute(INamedTypeSymbol? attributeClass)
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
283return !((INamedTypeSymbol)symbol).IsScriptClass;
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (9)
325SymbolKind.NamedType => GetDisplayName((INamedTypeSymbol)symbol), 339internal virtual string GetDisplayName(INamedTypeSymbol symbol) 505internal abstract bool IsPartial(INamedTypeSymbol type); 2421protected static bool BaseTypesEquivalent(INamedTypeSymbol oldType, INamedTypeSymbol newType, bool exact) 2458case SymbolKind.NamedType when oldMember is INamedTypeSymbol { DelegateInvokeMethod: { } oldInvokeMethod }: 2459var newInvokeMethod = ((INamedTypeSymbol)newMember).DelegateInvokeMethod; 2472private sealed class MemberInitializationUpdates(INamedTypeSymbol oldType) 2474public readonly INamedTypeSymbol OldType = oldType;
EditAndContinue\EditAndContinueCapabilitiesGrantor.cs (1)
22public bool GrantNewTypeDefinition(INamedTypeSymbol type)
EditAndContinue\Utilities\Extensions.cs (2)
172public static bool HasSynthesizedDefaultConstructor(this INamedTypeSymbol type) 241public static bool HasExplicitlyImplementedInterfaceMember(this INamedTypeSymbol type)
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (2)
36private INamedTypeSymbol? _dateTimeType; 37private INamedTypeSymbol? _dateTimeOffsetType;
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
176var iformattable = type.AllInterfaces.FirstOrDefault(t => t is
EmbeddedLanguages\Json\LanguageServices\JsonLanguageDetector.cs (2)
24ISet<INamedTypeSymbol> typesOfInterest) 50private readonly ISet<INamedTypeSymbol> _typesOfInterest = typesOfInterest;
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexLanguageDetector.cs (5)
25INamedTypeSymbol? regexType, 36var regexType = compilation.GetTypeByMetadataName(typeof(Regex).FullName!); 44private readonly INamedTypeSymbol? _regexType = regexType; 53private static HashSet<string> GetMethodNamesOfInterest(INamedTypeSymbol? regexType, ISyntaxFacts syntaxFacts) 143INamedTypeSymbol regexType,
EncapsulateField\AbstractEncapsulateFieldService.cs (4)
42protected abstract IEnumerable<TConstructorDeclarationSyntax> GetConstructorNodes(INamedTypeSymbol containingType); 310private ISet<(DocumentId documentId, TextSpan span)> GetConstructorLocations(Solution solution, INamedTypeSymbol containingType) 331var destination = field.ContainingType; 340INamedTypeSymbol containingSymbol,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (1)
153var typeSymbol = symbol.ContainingType;
ExtractClass\AbstractExtractClassRefactoringProvider.cs (2)
128if (semanticModel.GetDeclaredSymbol(selectedClassNode, cancellationToken) is not INamedTypeSymbol selectedType) 143private static bool HasBaseType(INamedTypeSymbol containingType) => containingType.BaseType?.SpecialType != SpecialType.System_Object;
ExtractClass\ExtractClassWithDialogCodeAction.cs (7)
30INamedTypeSymbol selectedType, 37private readonly INamedTypeSymbol _selectedType = selectedType; 81var newType = CodeGenerationSymbolFactory.CreateNamedTypeSymbol( 139INamedTypeSymbol newType, 212private static async Task<INamedTypeSymbol> GetNewTypeSymbolAsync(Document document, SyntaxAnnotation typeAnnotation, CancellationToken cancellationToken) 218return (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(declarationNode, cancellationToken); 224INamedTypeSymbol newType,
ExtractClass\IExtractClassOptionsService.cs (1)
16INamedTypeSymbol originalType,
ExtractInterface\AbstractExtractInterfaceService.cs (10)
40INamedTypeSymbol extractedInterfaceSymbol, 41INamedTypeSymbol typeToExtractFrom, 46internal abstract string GetContainingNamespaceDisplay(INamedTypeSymbol typeSymbol, CompilationOptions compilationOptions); 94if (semanticModel.GetDeclaredSymbol(typeNode, cancellationToken) is not INamedTypeSymbol typeToExtractFrom) 142var extractedInterfaceSymbol = CodeGenerationSymbolFactory.CreateNamedTypeSymbol( 176Solution solution, string containingNamespaceDisplay, INamedTypeSymbol extractedInterfaceSymbol, 218Solution solution, ExtractInterfaceTypeAnalysisResult refactoringResult, INamedTypeSymbol extractedInterfaceSymbol, 258INamedTypeSymbol type, 318INamedTypeSymbol typeToExtractFrom, 319INamedTypeSymbol extractedInterfaceSymbol,
ExtractInterface\ExtractInterfaceTypeAnalysisResult.cs (2)
17public readonly INamedTypeSymbol TypeToExtractFrom; 25INamedTypeSymbol typeToExtractFrom,
ExtractMethod\MethodExtractor.Analyzer.cs (3)
221returnType = ((INamedTypeSymbol)returnType).TypeArguments[0]; 952if (type is not INamedTypeSymbol constructedType) 981if (arguments[i] is not INamedTypeSymbol candidate)
ExtractMethod\MethodExtractor.TypeParameterCollector.cs (1)
49public override void VisitNamedType(INamedTypeSymbol namedTypeSymbol)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
198else if (symbol is INamedTypeSymbol { TypeKind: TypeKind.Class } namedType)
FullyQualify\AbstractFullyQualifyService.cs (4)
134.OfType<INamedTypeSymbol>() 232bool looksGeneric, INamedTypeSymbol searchResult) 268=> symbol.ContainingSymbol is INamespaceSymbol or INamedTypeSymbol { IsGenericType: false }; 313.Where(n => n.Symbol is INamedTypeSymbol or INamespaceSymbol { IsGlobalNamespace: false })
FullyQualify\AbstractFullyQualifyService.SymbolResult.cs (2)
48Debug.Assert(Symbol is INamespaceSymbol || !((INamedTypeSymbol)Symbol).IsGenericType); 49Debug.Assert(other.Symbol is INamespaceSymbol || !((INamedTypeSymbol)other.Symbol).IsGenericType);
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (14)
66var containingType = semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) as INamedTypeSymbol; 70using var _1 = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var missingComparableTypes); 72foreach (var iface in containingType.Interfaces) 122private static IMethodSymbol? TryGetCompareMethodImpl(INamedTypeSymbol containingType, ITypeSymbol comparableType) 136INamedTypeSymbol comparableType, 141var containingType = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(typeDeclaration, cancellationToken); 160INamedTypeSymbol comparableType, 177INamedTypeSymbol containingType, 178INamedTypeSymbol comparableType, 183var boolType = compilation.GetSpecialType(SpecialType.System_Boolean); 229private static bool HasAllComparisonOperators(INamedTypeSymbol containingType, ITypeSymbol comparedType) 240private static bool HasComparisonOperator(INamedTypeSymbol containingType, ITypeSymbol comparedType, CodeGenerationOperatorKind kind)
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (1)
60protected abstract bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType);
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (2)
28INamedTypeSymbol containingType, 34private readonly INamedTypeSymbol _containingType = containingType;
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.State.cs (5)
29public INamedTypeSymbol? ContainingType { get; private set; } 40INamedTypeSymbol containingType, 56INamedTypeSymbol containingType, 100INamedTypeSymbol containingType, 116private static IMethodSymbol? GetMatchingConstructorBasedOnParameterTypes(INamedTypeSymbol containingType, ImmutableArray<IParameterSymbol> parameters)
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (9)
39Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, 51Document document, INamedTypeSymbol namedType, 52ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken) 62Document document, INamedTypeSymbol containingType, CancellationToken cancellationToken) 118Document document, INamedTypeSymbol namedType, 129INamedTypeSymbol namedType, ImmutableArray<ISymbol> members) 149INamedTypeSymbol namedType, ImmutableArray<ISymbol> members) 152var hashCodeType = compilation.GetTypeByMetadataName("System.HashCode"); 183var valueTupleType = compilation.GetTypeByMetadataName(typeof(ValueTuple).FullName!);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeAction.cs (5)
24INamedTypeSymbol containingType, 42private readonly INamedTypeSymbol _containingType = containingType; 56var constructedTypeToImplement = await GetConstructedTypeToImplementAsync(cancellationToken).ConfigureAwait(false); 96private async Task<INamedTypeSymbol?> GetConstructedTypeToImplementAsync(CancellationToken cancellationToken) 201private async Task<IMethodSymbol> CreateIEquatableEqualsMethodAsync(INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken)
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (12)
89var containingType = semanticModel.GetDeclaredSymbol(typeDeclaration) as INamedTypeSymbol; 123private static bool HasOperators(INamedTypeSymbol containingType) 127private static bool HasOperator(INamedTypeSymbol containingType, string operatorName) 136SemanticModel semanticModel, INamedTypeSymbol containingType, 137[NotNullWhen(true)] out INamedTypeSymbol? constructedType) 143var equatableTypeOpt = semanticModel.Compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName!); 158private static void GetExistingMemberInfo(INamedTypeSymbol containingType, out bool hasEquals, out bool hasGetHashCode) 201Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> selectedMembers, 241Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members, 258Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members, 295Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndHashWithDialogCodeAction.cs (2)
25INamedTypeSymbol containingType, 37private readonly INamedTypeSymbol _containingType = containingType;
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeService.cs (5)
29Task<IMethodSymbol> GenerateEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, string? localNameOpt, CancellationToken cancellationToken); 35Task<IMethodSymbol> GenerateEqualsMethodThroughIEquatableEqualsAsync(Document document, INamedTypeSymbol namedType, CancellationToken cancellationToken); 41Task<IMethodSymbol> GenerateIEquatableEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken); 50Task<IMethodSymbol> GenerateGetHashCodeMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, CancellationToken cancellationToken);
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeServiceExtensions.cs (1)
14this IGenerateEqualsAndGetHashCodeService service, Document document, INamedTypeSymbol namedType,
GenerateFromMembers\SelectedMemberInfo.cs (2)
11INamedTypeSymbol containingType, 15public readonly INamedTypeSymbol ContainingType = containingType;
GenerateOverrides\GenerateOverridesCodeRefactoringProvider.cs (2)
49var containingType = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(typeDeclaration, cancellationToken);
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (2)
27INamedTypeSymbol containingType, 32private readonly INamedTypeSymbol _containingType = containingType;
GenerateType\AbstractGenerateTypeService.cs (2)
45protected abstract INamedTypeSymbol DetermineTypeToGenerateIn(SemanticModel semanticModel, TSimpleNameSyntax simpleName, CancellationToken cancellationToken); 65public abstract Task<(INamespaceSymbol, INamespaceOrTypeSymbol, Location)> GetOrGenerateEnclosingNamespaceSymbolAsync(INamedTypeSymbol namedTypeSymbol, string[] containers, Document selectedDocument, SyntaxNode selectedDocumentRoot, CancellationToken cancellationToken);
GenerateType\AbstractGenerateTypeService.Editor.cs (6)
93var namedType = await GenerateNamedTypeAsync().ConfigureAwait(false); 124var namedType = await GenerateNamedTypeAsync(_generateTypeOptionsResult).ConfigureAwait(false); 262INamedTypeSymbol namedType, 386private async Task<ImmutableArray<CodeActionOperation>> GetGenerateIntoContainingNamespaceOperationsAsync(INamedTypeSymbol namedType) 404INamedTypeSymbol namedType, 548private async Task<ImmutableArray<CodeActionOperation>> GetGenerateIntoTypeOperationsAsync(INamedTypeSymbol namedType)
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (8)
27private async Task<INamedTypeSymbol> GenerateNamedTypeAsync() 41private async Task<INamedTypeSymbol> GenerateNamedTypeAsync(GenerateTypeOptionsResult options) 275private INamedTypeSymbol DetermineBaseType() 285private ImmutableArray<INamedTypeSymbol> DetermineInterfaces() 289var type = RemoveUnavailableTypeParameters(_state.BaseTypeOrInterfaceOpt); 299private INamedTypeSymbol RemoveUnavailableTypeParameters(INamedTypeSymbol type) 302_semanticDocument.SemanticModel.Compilation, GetAvailableTypeParameters()) as INamedTypeSymbol;
GenerateType\AbstractGenerateTypeService.State.cs (8)
41public INamedTypeSymbol? TypeToGenerateInOpt { get; private set; } 47public INamedTypeSymbol? BaseTypeOrInterfaceOpt { get; private set; } 225SetBaseType(baseType as INamedTypeSymbol); 231private void SetBaseType(INamedTypeSymbol? baseType) 258BaseTypeOrInterfaceOpt = (INamedTypeSymbol)baseType.WithNullableAnnotation(NullableAnnotation.None); 321TypeToGenerateInOpt = (INamedTypeSymbol)symbol; 390else if (symbol is INamedTypeSymbol) 393TypeToGenerateInOpt = (INamedTypeSymbol)symbol.OriginalDefinition;
GenerateType\IGenerateTypeService.cs (1)
17Task<(INamespaceSymbol, INamespaceOrTypeSymbol, Location)> GetOrGenerateEnclosingNamespaceSymbolAsync(INamedTypeSymbol namedTypeSymbol, string[] containers, Document selectedDocument, SyntaxNode selectedDocumentRoot, CancellationToken cancellationToken);
GoToBase\AbstractGoToBaseService.cs (1)
22var baseType = constructor.ContainingType.BaseType;
GoToBase\FindBaseHelpers.cs (1)
18if (symbol is INamedTypeSymbol
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
70if (symbol is INamedTypeSymbol namedType)
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (7)
62if (symbol is INamedTypeSymbol namedTypeSymbol) 283INamedTypeSymbol memberSymbol, 401INamedTypeSymbol interfaceSymbol, 463INamedTypeSymbol memberSymbol, 653if (memberSymbol is INamedTypeSymbol) 670private static async Task<ImmutableArray<INamedTypeSymbol>> GetDerivedTypesAndImplementationsAsync( 672INamedTypeSymbol typeSymbol,
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (3)
394var stringType = compilation.GetSpecialType(SpecialType.System_String); 508var containingType = parameter.ContainingType; 543var typeSymbol = compilation.GetTypeByMetadataName(type.FullName!);
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (3)
45protected abstract Accessibility DetermineDefaultFieldAccessibility(INamedTypeSymbol containingType); 578var containingType = parameter.ContainingType; 620var containingType = parameter.ContainingType;
InlineHints\AbstractInlineTypeHintsService.cs (2)
110HashSet<INamedTypeSymbol>? seenSymbols = null) 116if (part.Symbol is INamedTypeSymbol { IsAnonymousType: true } anonymousType)
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
31Document document, INamedTypeSymbol tupleType, TExpressionSyntax expression, CancellationToken cancellationToken); 114document, (INamedTypeSymbol)type, expression, cancellationToken).ConfigureAwait(false);
IntroduceVariable\AbstractIntroduceVariableService.State.cs (1)
93.OfType<INamedTypeSymbol>()
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.cs (17)
23protected abstract ImmutableArray<SymbolDisplayPart> GetNormalAnonymousTypeParts(INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position); 25public ImmutableArray<SymbolDisplayPart> GetAnonymousTypeParts(INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position) 31INamedTypeSymbol anonymousType, 63ImmutableArray<INamedTypeSymbol> directStructuralTypeReferences, 70SpecializedCollections.EmptyDictionary<INamedTypeSymbol, string>(), 92var structuralType = transitiveStructuralTypeReferences[i]; 120private static Dictionary<INamedTypeSymbol, string> GenerateStructuralTypeNames( 121IList<INamedTypeSymbol> anonymousTypes) 124var anonymousTypeToName = new Dictionary<INamedTypeSymbol, string>(); 125foreach (var type in anonymousTypes) 145private static ImmutableArray<INamedTypeSymbol> OrderStructuralTypes( 146ImmutableArray<INamedTypeSymbol> structuralTypes, 185private static ImmutableArray<INamedTypeSymbol> GetTransitiveStructuralTypeReferences( 186ImmutableArray<INamedTypeSymbol> structuralTypes) 188var transitiveReferences = new Dictionary<INamedTypeSymbol, (int order, int count)>(); 191foreach (var type in structuralTypes) 198using var _ = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var result);
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (5)
13private sealed class StructuralTypeCollectorVisitor(Dictionary<INamedTypeSymbol, (int order, int count)> namedTypes) : SymbolVisitor 15private readonly ISet<INamedTypeSymbol> _seenTypes = new HashSet<INamedTypeSymbol>(); 16private readonly Dictionary<INamedTypeSymbol, (int order, int count)> _namedTypes = namedTypes; 67public override void VisitNamedType(INamedTypeSymbol symbol)
LanguageServices\AnonymousTypeDisplayService\IStructuralTypeDisplayService.cs (2)
14ImmutableArray<INamedTypeSymbol> structuralTypes, 19INamedTypeSymbol anonymousType,
LanguageServices\AnonymousTypeDisplayService\StructuralTypeDisplayInfo.cs (5)
11public IDictionary<INamedTypeSymbol, string> StructuralTypeToName { get; } 15IDictionary<INamedTypeSymbol, string> structuralTypeToName, 28IDictionary<INamedTypeSymbol, string> structuralTypeToName, 41IDictionary<INamedTypeSymbol, string> structuralTypeToName, 51if (part.Symbol is INamedTypeSymbol type)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (3)
331else if (symbol is INamedTypeSymbol namedType) 458private void AddDescriptionForNamedType(INamedTypeSymbol symbol) 504private static bool TypeArgumentsAndParametersAreSame(INamedTypeSymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AnonymousTypes.cs (2)
24select (INamedTypeSymbol)part.Symbol!; 30directStructuralTypes = directStructuralTypes.Except([(INamedTypeSymbol)firstSymbol]);
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedNamespaceOrTypeSymbol.cs (3)
26public abstract ImmutableArray<INamedTypeSymbol> GetTypeMembers(); 27public abstract ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name); 28public abstract ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name, int arity);
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
39public INamedTypeSymbol ContainingType => _symbol.ContainingType;
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
98var topLevelNamedType = MetadataAsSourceHelpers.GetTopLevelContainingNamedType(symbol);
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (2)
23public INamedTypeSymbol AssociatedAnonymousDelegate => _symbol.AssociatedAnonymousDelegate; 132public ImmutableArray<INamedTypeSymbol> UnmanagedCallingConventionTypes => _symbol.UnmanagedCallingConventionTypes;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (17)
20private readonly INamedTypeSymbol _symbol; 23public WrappedNamedTypeSymbol(INamedTypeSymbol symbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService) 50SymbolKind.NamedType => new WrappedNamedTypeSymbol((INamedTypeSymbol)m, canImplementImplicitly, docCommentFormattingService), 73public INamedTypeSymbol EnumUnderlyingType => _symbol.EnumUnderlyingType; 74public INamedTypeSymbol ConstructedFrom => _symbol.ConstructedFrom; 75public INamedTypeSymbol BaseType => _symbol.BaseType; 76public INamedTypeSymbol TupleUnderlyingType => _symbol.TupleUnderlyingType; 84public ImmutableArray<INamedTypeSymbol> Interfaces => _symbol.Interfaces; 85public ImmutableArray<INamedTypeSymbol> AllInterfaces => _symbol.AllInterfaces; 91public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 94public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 97public INamedTypeSymbol ConstructUnboundGenericType() 111public override ImmutableArray<INamedTypeSymbol> GetTypeMembers() 114public override ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name) 117public override ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name, int arity) 133public new INamedTypeSymbol OriginalDefinition => this; 149public INamedTypeSymbol NativeIntegerUnderlyingType => _symbol.NativeIntegerUnderlyingType;
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (2)
79var topLevelNamedType = MetadataAsSourceHelpers.GetTopLevelContainingNamedType(symbol); 366private static async Task<UniqueDocumentKey> GetUniqueDocumentKeyAsync(Project project, INamedTypeSymbol topLevelNamedType, bool signaturesOnly, CancellationToken cancellationToken)
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
28public MetadataAsSourceGeneratedFileInfo(string rootPath, Workspace sourceWorkspace, Project sourceProject, INamedTypeSymbol topLevelNamedType, bool signaturesOnly)
MetadataAsSource\MetadataAsSourceHelpers.cs (3)
51public static INamedTypeSymbol GetTopLevelContainingNamedType(ISymbol symbol) 54public static INamedTypeSymbol? TryGetTopLevelContainingNamedType(ISymbol symbol) 68return (INamedTypeSymbol)topLevelNamedType;
MoveStaticMembers\IMoveStaticMembersOptionsService.cs (1)
12MoveStaticMembersOptions GetMoveMembersToTypeOptions(Document document, INamedTypeSymbol selectedType, ImmutableArray<ISymbol> selectedNodeSymbols);
MoveStaticMembers\MoveStaticMembersOptions.cs (2)
20public INamedTypeSymbol? Destination { get; } 37INamedTypeSymbol destination,
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (8)
28INamedTypeSymbol selectedType, 33private readonly INamedTypeSymbol _selectedType = selectedType; 115newType = (INamedTypeSymbol)destSemanticModel.GetRequiredDeclaredSymbol(destRoot.GetAnnotatedNodes(annotation).Single(), cancellationToken); 143private static TypeKind GetNewTypeKind(INamedTypeSymbol oldType) 163INamedTypeSymbol newType, 210newType = (INamedTypeSymbol)newTypeSemanticModel.GetRequiredDeclaredSymbol(newTypeRoot.GetCurrentNode(newTypeNode)!, cancellationToken); 219INamedTypeSymbol newType, 254INamedTypeSymbol newType,
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (1)
59if (semanticModel.GetTypeInfo(tuple, cancellationToken).ConvertedType is not INamedTypeSymbol tupleType)
PdbSourceDocument\ImplementationAssemblyLookupService.cs (1)
64var typeSymbol = MetadataAsSourceHelpers.GetTopLevelContainingNamedType(symbol);
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (2)
76private static ImmutableArray<INamedTypeSymbol> FindAllValidDestinations( 78INamedTypeSymbol containingType,
PullMemberUp\MemberAndDestinationValidator.cs (1)
13public static bool IsDestinationValid(Solution solution, INamedTypeSymbol destination, CancellationToken cancellationToken)
PullMemberUp\MembersPuller.cs (4)
40INamedTypeSymbol destination) 489private static bool IsSelectedMemberDeclarationAlreadyInDestination(ISymbol selectedMember, INamedTypeSymbol destination) 496private static bool IsSelectedMemberDeclarationAlreadyInDestinationClass(ISymbol selectedMember, INamedTypeSymbol destination) 516ISymbol selectedMember, INamedTypeSymbol destination)
PullMemberUp\PullMembersUpOptions.cs (2)
21public readonly INamedTypeSymbol Destination; 35INamedTypeSymbol destination,
PullMemberUp\PullMembersUpOptionsBuilder.cs (1)
15INamedTypeSymbol destination,
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
278private static bool IsAccessible(ISymbol symbol, INamedTypeSymbol? within)
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
59public override bool VisitNamedType(INamedTypeSymbol symbol)
QuickInfo\QuickInfoUtilities.cs (1)
45if (symbol is INamedTypeSymbol { SpecialType: SpecialType.System_Void })
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
93if (symbol is INamedTypeSymbol namedType)
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
98var containingType = getMethod.ContainingType;
RQName\RQNodeBuilder.cs (8)
23INamedTypeSymbol namedTypeSymbol => BuildUnconstructedNamedType(namedTypeSymbol), 53private static RQUnconstructedType? BuildUnconstructedNamedType(INamedTypeSymbol type) 79for (var currentType = type; currentType != null; currentType = currentType.ContainingType) 304else if (symbol is INamedTypeSymbol namedTypeSymbol) 306var definingType = namedTypeSymbol.ConstructedFrom ?? namedTypeSymbol; 308var typeChain = new List<INamedTypeSymbol>(); 309var type = namedTypeSymbol; 322foreach (var entry in typeChain)
Shared\Extensions\ISymbolExtensions_2.cs (2)
39var containingType = symbol.ContainingType; 58switch (((INamedTypeSymbol)symbol).TypeKind)
Shared\Extensions\ISymbolExtensions_Sorting.cs (10)
42private static INamedTypeSymbol GetNamedType(ITypeSymbol type) 45INamedTypeSymbol namedType => namedType, 78var xParamType = GetNamedType(xParam.Type); 79var yParamType = GetNamedType(yParam.Type); 124private static int CompareNamedTypes(INamedTypeSymbol xNamedType, INamedTypeSymbol yNamedType) 144var type = ev.Type as INamedTypeSymbol; 168? CompareNamedTypes((INamedTypeSymbol)s1, (INamedTypeSymbol)s2)
Shared\Utilities\ExtractTypeHelpers.cs (7)
29public static async Task<(Document containingDocument, SyntaxAnnotation typeAnnotation)> AddTypeToExistingFileAsync(Document document, INamedTypeSymbol newType, AnnotatedSymbolMapping symbolMapping, CancellationToken cancellationToken) 56INamedTypeSymbol newSymbol, 115public static string GetTypeParameterSuffix(Document document, SyntaxFormattingOptions formattingOptions, INamedTypeSymbol type, IEnumerable<ISymbol> extractableMembers, CancellationToken cancellationToken) 130public static ImmutableArray<ITypeParameterSymbol> GetRequiredTypeParametersForMembers(INamedTypeSymbol type, IEnumerable<ISymbol> includedMembers) 163private static ImmutableArray<ITypeParameterSymbol> GetPotentialTypeParameters(INamedTypeSymbol type) 167var typesToVisit = new Stack<INamedTypeSymbol>(); 169var currentType = type;
SignatureHelp\AbstractSignatureHelpProvider.cs (1)
192select (INamedTypeSymbol)part.Symbol!;
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (2)
82var consoleSymbol = GetConsoleSymbolFromMetaDataName(compilation); 90protected static INamedTypeSymbol? GetConsoleSymbolFromMetaDataName(Compilation compilation)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
79return typeofOperation.TypeOperand is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 0;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
101var ienumerableOfT = collectionType.AllInterfaces.FirstOrDefault(i => i.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T);
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (3)
11private readonly INamedTypeSymbol? _iSerializableType = compilation.ISerializableType(); 12private readonly INamedTypeSymbol? _serializationInfoType = compilation.SerializationInfoType(); 13private readonly INamedTypeSymbol? _streamingContextType = compilation.StreamingContextType();
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (5)
21private readonly INamedTypeSymbol? _equalityComparerType; 23public readonly INamedTypeSymbol SystemHashCodeType; 27INamedTypeSymbol? equalityComparerType, INamedTypeSymbol systemHashCodeType) 38var objectType = compilation.GetSpecialType(SpecialType.System_Object);
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (5)
62if (!ShouldAnalyze(context, (INamedTypeSymbol)context.Symbol)) 114var members = ((INamedTypeSymbol)symbolEndContext.Symbol).GetMembers(); 136bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 188static bool IsDataContractSerializable(IFieldSymbol symbol, INamedTypeSymbol? dataContractAttribute, INamedTypeSymbol? dataMemberAttribute)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (1)
70protected sealed class CompilationAnalyzer(Compilation compilation, INamedTypeSymbol suppressMessageAttributeType)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
825INamedTypeSymbol suppressMessageAttributeType,
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (2)
16internal sealed partial class SuppressMessageAttributeState(Compilation compilation, INamedTypeSymbol suppressMessageAttributeType) 24private readonly INamedTypeSymbol _suppressMessageAttributeType = suppressMessageAttributeType;
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (19)
65protected abstract IEnumerable<TTypeDeclarationSyntax> GetTypeDeclarations(INamedTypeSymbol namedType, CancellationToken cancellationToken); 113private readonly INamedTypeSymbol? _taskType; 114private readonly INamedTypeSymbol? _genericTaskType; 115private readonly INamedTypeSymbol? _debuggerDisplayAttributeType; 116private readonly INamedTypeSymbol? _structLayoutAttributeType; 117private readonly INamedTypeSymbol? _inlineArrayAttributeType; 118private readonly INamedTypeSymbol? _eventArgsType; 119private readonly INamedTypeSymbol? _iNotifyCompletionType; 121private readonly ImmutableHashSet<INamedTypeSymbol?> _attributeSetForMethodsToIgnore; 138_attributeSetForMethodsToIgnore = ImmutableHashSet.CreateRange<INamedTypeSymbol?>(GetAttributesForMethodsToIgnore(compilation)); 144private static IEnumerable<INamedTypeSymbol> GetAttributesForMethodsToIgnore(Compilation compilation) 209if (!ShouldAnalyze(symbolStartContext, (INamedTypeSymbol)symbolStartContext.Symbol)) 256bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 474var namedType = (INamedTypeSymbol)symbolEndContext.Symbol; 616private static bool HasSyntaxErrors(INamedTypeSymbol namedTypeSymbol, CancellationToken cancellationToken) 630INamedTypeSymbol namedTypeSymbol, 710private void AddDebuggerDisplayAttributeArguments(INamedTypeSymbol namedTypeSymbol, ArrayBuilder<string> builder) 718case INamedTypeSymbol nestedType:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (13)
25INamedTypeSymbol? eventArgsType, 26ImmutableHashSet<INamedTypeSymbol> attributeSetForMethodsToIgnore, 28INamedTypeSymbol? iCustomMarshaler, 33private readonly INamedTypeSymbol? _eventArgsType = eventArgsType; 34private readonly ImmutableHashSet<INamedTypeSymbol> _attributeSetForMethodsToIgnore = attributeSetForMethodsToIgnore; 37private readonly INamedTypeSymbol? _iCustomMarshaler = iCustomMarshaler; 54var iCustomMarshaler = context.Compilation.GetTypeByMetadataName(typeof(ICustomMarshaler).FullName!); 58if (HasSyntaxErrors((INamedTypeSymbol)symbolStartContext.Symbol, symbolStartContext.CancellationToken)) 76static bool HasSyntaxErrors(INamedTypeSymbol namedTypeSymbol, CancellationToken cancellationToken) 124INamedTypeSymbol? interpolatedStringHandlerAttributeType, 177private static IEnumerable<INamedTypeSymbol?> GetAttributesForMethodsToIgnore(Compilation compilation) 196private bool IsUnusedParameterCandidate(IParameterSymbol parameter, INamedTypeSymbol? interpolatedStringHandlerAttributeType, CancellationToken cancellationToken) 293INamedTypeSymbol? interpolatedStringHandlerAttributeType)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (2)
171private static bool IsType<T>(INamedTypeSymbol type, SemanticModel semanticModel) 174private static INamedTypeSymbol? FindType<T>(SemanticModel semanticModel)
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (7)
59if (TryGetEnumerableTypeSymbol(context.Compilation, out var enumerableType) && 69static bool TryGetEnumerableTypeSymbol(Compilation compilation, [NotNullWhen(true)] out INamedTypeSymbol? enumerableType) 75static bool TryGetLinqWhereExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 78static bool TryGetLinqSelectExtensionMethod(INamedTypeSymbol enumerableType, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 81static bool TryGetLinqExtensionMethod(INamedTypeSymbol enumerableType, string name, [NotNullWhen(true)] out IMethodSymbol? linqMethod) 85if (linqMethodSymbol.Parameters is [_, { Type: INamedTypeSymbol { Arity: 2 } }]) 98static bool TryGetLinqMethodsThatDoNotReturnEnumerables(INamedTypeSymbol enumerableType, out ImmutableArray<IMethodSymbol> linqMethods)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (4)
108var namedType = (INamedTypeSymbol)context.Symbol; 182bool ShouldAnalyze(SymbolStartAnalysisContext context, INamedTypeSymbol namedType) 335INamedTypeSymbol containingType,
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
109var nullableType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Nullable<>).FullName!);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (3)
85INamedTypeSymbol? expressionType, 127INamedTypeSymbol ienumerableType, 128INamedTypeSymbol? expressionType)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
77INamedTypeSymbol containingType, IFieldSymbol unnamedField, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
34var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object);
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (3)
95var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object); 112INamedTypeSymbol? expressionType, 162if (type is not INamedTypeSymbol namedType || namedType.ConstructedFrom.SpecialType != SpecialType.System_Nullable_T)
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
70private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol? expressionType)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (3)
73var formatProviderType = startContext.Compilation.GetTypeByMetadataName(typeof(System.IFormatProvider).FullName!); 89private void AnalyzeNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol formatProviderType) 297var containingType = symbolInfo.Symbol.ContainingType;
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (1)
70foreach (var interfaceType in derivedType.Interfaces)
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (3)
38var attribute = await GetObsoleteAttributeAsync(document, cancellationToken).ConfigureAwait(false); 58private static async Task<INamedTypeSymbol?> GetObsoleteAttributeAsync(Document document, CancellationToken cancellationToken) 75var obsoleteAttribute = await GetObsoleteAttributeAsync(document, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (3)
164var type = symbol switch 167INamedTypeSymbol namedTypeSymbol => namedTypeSymbol, // Standard object creation expressions 411Document invocationDocument, TArgumentSyntax argument, INamedTypeSymbol containingType, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
28protected abstract bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType); 33protected abstract bool TryInitializeImplicitObjectCreation(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 34protected abstract bool TryInitializeSimpleNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 35protected abstract bool TryInitializeConstructorInitializerGeneration(SemanticDocument document, SyntaxNode constructorInitializer, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn); 36protected abstract bool TryInitializeSimpleAttributeNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (6)
46public INamedTypeSymbol? TypeToGenerateIn { get; private set; } 306out var token, out var arguments, out var typeToGenerateIn)) 324out var token, out var arguments, out var typeToGenerateIn)) 343out var token, out var arguments, out var typeToGenerateIn)) 404INamedTypeSymbol original, CancellationToken cancellationToken) 407TypeToGenerateIn = definition as INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (2)
136INamedTypeSymbol typeToGenerateIn, 301private static IEnumerable<string> GetUnavailableMemberNames(INamedTypeSymbol typeToGenerateIn)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (1)
23[NotNullWhen(true)] out INamedTypeSymbol? classType);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (5)
19public INamedTypeSymbol? ClassType { get; private set; } 50if (!service.TryInitializeState(semanticDocument, textSpan, cancellationToken, out var classType)) 55var baseType = ClassType.BaseType; 89private static bool FixesError(INamedTypeSymbol classType, INamedTypeSymbol baseType)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (3)
59var classType = _state.ClassType; 74IParameterSymbol parameter, INamedTypeSymbol classType) 80private static Accessibility DetermineAccessibility(IMethodSymbol baseConstructor, INamedTypeSymbol classType)
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.State.cs (4)
19public INamedTypeSymbol TypeToGenerateIn { get; private set; } = null!; 66var sourceType = SymbolFinderInternal.FindSourceDefinition(TypeToGenerateIn, document.Project.Solution, cancellationToken) as INamedTypeSymbol; 115out var typeToGenerateIn, out var isStatic, out var isColorColorCase))
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (13)
33[NotNullWhen(true)] INamedTypeSymbol? typeToGenerateIn, 57INamedTypeSymbol containingType, 60[NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn, 74INamedTypeSymbol containingType, 77out INamedTypeSymbol? typeToGenerateIn, 112underlyingType is INamedTypeSymbol underlyingNamedType) 130typeToGenerateIn = pointerType.PointedAtType as INamedTypeSymbol; 146typeToGenerateIn = attributeType.Type as INamedTypeSymbol; 154typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol; 166typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol; 181out INamedTypeSymbol? typeToGenerateIn, 191: typeInfo.Type as INamedTypeSymbol; 193isStatic = semanticInfo.Symbol is INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn); 27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.State.cs (2)
62out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 86out var identifierToken, out var methodSymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.cs (1)
27INamedTypeSymbol typeToGenerateIn,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (2)
29INamedTypeSymbol typeToGenerateIn, 45INamedTypeSymbol typeToGenerateIn,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
26protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
89out var identifierToken, out var methodSymbol, out var typeToGenerateIn)) 218out var typeToGenerateIn, out var isStatic, out _))
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (1)
33protected virtual bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (2)
278private bool DerivesFrom(INamedTypeSymbol containingType) 281.OfType<INamedTypeSymbol>()
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.State.cs (3)
24public INamedTypeSymbol ContainingType { get; protected set; } 25public INamedTypeSymbol TypeToGenerateIn { get; protected set; } 61TypeToGenerateIn = SymbolFinderInternal.FindSourceDefinition(TypeToGenerateIn, document.Project.Solution, cancellationToken) as INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateDeconstructMemberService.cs (1)
17Document document, SyntaxNode targetVariables, INamedTypeSymbol typeToGenerateIn, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (9)
50public override async ValueTask VisitNamedType(INamedTypeSymbol symbol) 74if (symbol.ConstraintTypes.ElementAt(0) is INamedTypeSymbol namedType) 87if (!symbol.ConstraintTypes.All(t => t is INamedTypeSymbol)) 94(INamedTypeSymbol)symbol.ConstraintTypes[0], projects).ConfigureAwait(false); 99(INamedTypeSymbol)symbol.ConstraintTypes[i], projects).ConfigureAwait(false); 110var commonType = commonTypes.First(); 125private async Task<ISet<INamedTypeSymbol>> GetDerivedAndImplementedTypesAsync( 126INamedTypeSymbol constraintType, IImmutableSet<Project> projects) 130var symbol = constraintType;
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
175private static bool DerivesFrom(State state, INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (2)
27protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn); 83protected virtual bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (6)
29public INamedTypeSymbol ContainingType { get; private set; } 30public INamedTypeSymbol TypeToGenerateIn { get; private set; } 153TypeToGenerateIn, _document.Project.Solution, cancellationToken) as INamedTypeSymbol; 191out var identifierToken, out var propertySymbol, out var typeToGenerateIn)) 213if (!ContainingType.Interfaces.OfType<INamedTypeSymbol>().Contains(TypeToGenerateIn)) 285out var typeToGenerateIn, out var isStatic, out _))
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (9)
34INamedTypeSymbol classType, INamedTypeSymbol abstractClassType, 35ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers) 41private readonly ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> _unimplementedMembers = unimplementedMembers; 43public readonly INamedTypeSymbol ClassType = classType; 44public readonly INamedTypeSymbol AbstractClassType = abstractClassType; 50if (semanticModel.GetDeclaredSymbol(classNode, cancellationToken) is not INamedTypeSymbol classType) 56var abstractClassType = classType.BaseType; 321constraints.OfType<INamedTypeSymbol>().FirstOrDefault() ??
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (3)
31protected abstract bool TryInitializeState(Document document, SemanticModel model, SyntaxNode interfaceNode, CancellationToken cancellationToken, out SyntaxNode classOrStructDecl, out INamedTypeSymbol classOrStructType, out ImmutableArray<INamedTypeSymbol> interfaceTypes); 35protected abstract SyntaxNode CreateFinalizer(SyntaxGenerator generator, INamedTypeSymbol classType, string disposeMethodDisplayString);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.State.cs (7)
17INamedTypeSymbol classOrStructType, 18ImmutableArray<INamedTypeSymbol> interfaceTypes, 29public INamedTypeSymbol ClassOrStructType => Info.ClassOrStructType; 30public ImmutableArray<INamedTypeSymbol> InterfaceTypes => Info.InterfaceTypes; 36public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented => Info.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented; 37public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitOrImplicitImplementation => Info.MembersWithoutExplicitOrImplicitImplementation; 40public ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> MembersWithoutExplicitImplementation => Info.MembersWithoutExplicitImplementation;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (6)
20INamedTypeSymbol namedType, 120ISymbol? first, INamedTypeSymbol second, bool supportsImplicitImplementationOfNonPublicInterfaceMembers) 174private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, HashSet<ITypeSymbol> alreadyCheckingTypes) 202if (first is INamedTypeSymbol namedType) 236var idisposableType = disposeMethod.ContainingType; 251var idisposable = compilation.GetSpecialType(SpecialType.System_IDisposable);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (3)
76ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 109ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 352IEnumerable<INamedTypeSymbol> baseTypes)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (4)
46ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers, 206var gcType = compilation.GetTypeByMetadataName(typeof(GC).FullName!); 236INamedTypeSymbol containingType, 258private static string GenerateUniqueNameForDisposedValueField(INamedTypeSymbol containingType, NamingRule rule)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
87private static INamedTypeSymbol[] AttributesToRemove(Compilation compilation) 101INamedTypeSymbol[] attributesToRemove) 135INamedTypeSymbol[] attributesToRemove)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
249private static SyntaxNode TypeExpressionForStaticMemberAccess(SyntaxGenerator generator, INamedTypeSymbol typeSymbol)
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
39if (semanticModel.GetSymbolInfo(node, cancellationToken).Symbol is INamedTypeSymbol type &&
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
58SyntaxEditor editor, SemanticModel semanticModel, INamedTypeSymbol? expressionTypeOpt,
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
74var containingType = accessesBase ? method!.ContainingType : null;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 640INamedTypeSymbol typeSymbol = GetFirstMatchingNamedType(candidateMembers, arity); 821private static INamedTypeSymbol GetFirstMatchingNamedType(ImmutableArray<ISymbol> candidateMembers, int arity) 823return (INamedTypeSymbol)candidateMembers.FirstOrDefault(s => 825((INamedTypeSymbol)s).Arity == arity); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n) 854private static int GetTypeParameterCount(INamedTypeSymbol typeSymbol)
StackTraceExplorer\AbstractStackTraceSymbolResolver.cs (1)
17INamedTypeSymbol type,
StackTraceExplorer\StackFrameLocalMethodResolver.cs (1)
19INamedTypeSymbol type,
StackTraceExplorer\StackFrameMethodSymbolResolver.cs (1)
16INamedTypeSymbol type,
Microsoft.CodeAnalysis.Features.UnitTests (21)
FindUsages\DefinitionItemFactoryTests.cs (21)
702var tuple = (INamedTypeSymbol)compilation.GetMember<IFieldSymbol>("C.F").Type; 705var genericTuple = tuple.OriginalDefinition; 764var tuple = (INamedTypeSymbol)compilation.GetMember<IFieldSymbol>("C.F").Type; 767var genericTuple = tuple.OriginalDefinition; 820var type = (INamedTypeSymbol)compilation.GetMember<IFieldSymbol>("C.F").Type; 823var genericType = type.OriginalDefinition; 874var type = (INamedTypeSymbol)compilation.GetMember<IFieldSymbol>("C.F").Type; 877var genericType = type.OriginalDefinition; 981var i = compilation.GetSpecialType(SpecialType.System_Int32); 1036var i = compilation.GetSpecialType(SpecialType.System_Int32); 1088var i = compilation.GetSpecialType(SpecialType.System_Int32); 1152var i = compilation.GetSpecialType(SpecialType.System_Int32); 1209var i = compilation.GetSpecialType(SpecialType.System_Int32); 1264var i = compilation.GetSpecialType(SpecialType.System_Int32); 1344var i = compilation.GetSpecialType(SpecialType.System_Int32); 1522var i = compilation.GetSpecialType(SpecialType.System_Int32); 1593var i = compilation.GetSpecialType(SpecialType.System_Int32);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationFactory.cs (1)
179var typeSymbol = rebuildCompilation.GetTypeByMetadataName(mainTypeName);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\DependentTypeFinder\RemoteDependentTypeFinderService.cs (1)
41if (symbol is not INamedTypeSymbol namedType)
Microsoft.CodeAnalysis.Test.Utilities (32)
Compilation\ControlFlowGraphVerifier.cs (3)
909Constructor.ContainingType: INamedTypeSymbol ctorContainingType, 934TargetMethod: { Name: BoundInterpolatedString.AppendFormattedMethod or BoundInterpolatedString.AppendLiteralMethod, ContainingType: INamedTypeSymbol containingType } 1995ContainingType: INamedTypeSymbol
Diagnostics\CommonDiagnosticAnalyzers.cs (4)
1149var pendingSymbols = new ConcurrentSet<INamedTypeSymbol>(); 1150foreach (var type in context.Compilation.GlobalNamespace.GetTypeMembers()) 1160if (!pendingSymbols.Remove((INamedTypeSymbol)symbolContext.Symbol)) 2093case INamedTypeSymbol namedType:
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (25)
47Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes = new Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>>(); 54Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes = new Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>>(); 126if (HasMoreSpecificSourceType(local, local.Type, localsSourceTypes, out var mostSpecificSourceType)) 153if (HasMoreSpecificSourceType(field, field.Type, fieldsSourceTypes, out var mostSpecificSourceType)) 162private static bool HasMoreSpecificSourceType<SymbolType>(SymbolType symbol, ITypeSymbol symbolType, Dictionary<SymbolType, HashSet<INamedTypeSymbol>> symbolsSourceTypes, out INamedTypeSymbol commonSourceType) 167if (commonSourceType != null && DerivesFrom(commonSourceType, (INamedTypeSymbol)symbolType)) 177private static INamedTypeSymbol CommonType(IEnumerable<INamedTypeSymbol> types) 179foreach (INamedTypeSymbol type in types) 182foreach (INamedTypeSymbol testType in types) 203private static bool DerivesFrom(INamedTypeSymbol derivedType, INamedTypeSymbol baseType) 207INamedTypeSymbol derivedBaseType = derivedType.BaseType; 218foreach (INamedTypeSymbol baseInterface in derivedType.Interfaces) 232private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, IOperation sourceValue) 237private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, ITypeSymbol sourceType) 252private static void AssignTo<SymbolType>(SymbolType target, ITypeSymbol targetType, Dictionary<SymbolType, HashSet<INamedTypeSymbol>> sourceTypes, IOperation sourceValue) 257private static void AssignTo<SymbolType>(SymbolType target, ITypeSymbol targetType, Dictionary<SymbolType, HashSet<INamedTypeSymbol>> sourceTypes, ITypeSymbol sourceType) 270symbolSourceTypes = new HashSet<INamedTypeSymbol>(); 274symbolSourceTypes.Add((INamedTypeSymbol)sourceType);
Microsoft.CodeAnalysis.UnitTests (14)
CorLibTypesTests.cs (1)
79var symbol = comp.GetSpecialType(specialType);
GivesAccessTo.cs (8)
45var CS = csc.GlobalNamespace.GetMembers("CS").First() as INamedTypeSymbol; 48var CS2 = csc2.GlobalNamespace.GetMembers("CS2").First() as INamedTypeSymbol; 51var VB = vbc.GlobalNamespace.GetMembers("VB")[0] as INamedTypeSymbol; 54var VB2 = vbc2.GlobalNamespace.GetMembers("VB2")[0] as INamedTypeSymbol;
IsSymbolAccessibleWithinTests.cs (4)
29var Ac = csc.GlobalNamespace.GetMembers("A").First() as INamedTypeSymbol; 32var Av = vbc.GlobalNamespace.GetMembers("A").First() as INamedTypeSymbol;
MetadataReferences\MetadataReferenceTests.cs (1)
576var list = c.BaseType;
Microsoft.CodeAnalysis.VisualBasic (120)
Binding\MemberSemanticModel.vb (3)
469Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As TypeStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 479Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As EnumStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 602Public Overrides Function GetDeclaredSymbol(anonymousObjectCreationExpressionSyntax As AnonymousObjectCreationExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol
Compilation\SemanticModel.vb (5)
2458Public Overridable Overloads Function GetDeclaredSymbol(anonymousObjectCreationExpressionSyntax As AnonymousObjectCreationExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 2554Public MustOverride Overloads Function GetDeclaredSymbol(declarationSyntax As TypeStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 2561Public Overloads Function GetDeclaredSymbol(declarationSyntax As TypeBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 2570Public MustOverride Overloads Function GetDeclaredSymbol(declarationSyntax As EnumStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 2577Public Overloads Function GetDeclaredSymbol(declarationSyntax As EnumBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol
Compilation\SpeculativeSemanticModelWithMemberModel.vb (3)
153Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As TypeStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 157Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As EnumStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 189Public Overrides Function GetDeclaredSymbol(anonymousObjectCreationExpressionSyntax As AnonymousObjectCreationExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol
Compilation\SyntaxTreeSemanticModel.vb (3)
899Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As TypeStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 918Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As EnumStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 1245Public Overrides Function GetDeclaredSymbol(anonymousObjectCreationExpressionSyntax As AnonymousObjectCreationExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol
Compilation\VisualBasicCompilation.vb (10)
2825Protected Overrides Function CommonGetTypeByMetadataName(metadataName As String) As INamedTypeSymbol 2829Protected Overrides ReadOnly Property CommonScriptClass As INamedTypeSymbol 2835Protected Overrides Function CommonCreateErrorTypeSymbol(container As INamespaceOrTypeSymbol, name As String, arity As Integer) As INamedTypeSymbol 2858elementNullableAnnotations As ImmutableArray(Of NullableAnnotation)) As INamedTypeSymbol 2873underlyingType As INamedTypeSymbol, 2876elementNullableAnnotations As ImmutableArray(Of NullableAnnotation)) As INamedTypeSymbol 2906callingConventionTypes As ImmutableArray(Of INamedTypeSymbol)) As IFunctionPointerTypeSymbol 2910Protected Overrides Function CommonCreateNativeIntegerTypeSymbol(signed As Boolean) As INamedTypeSymbol 2919memberNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As INamedTypeSymbol 3085Protected Overrides ReadOnly Property CommonObjectType As INamedTypeSymbol
SymbolDisplay\SymbolDisplayVisitor.Members.vb (4)
13Debug.Assert(TypeOf symbol.ContainingSymbol Is INamedTypeSymbol) 21Dim containingType = TryCast(symbol.ContainingSymbol, INamedTypeSymbol) 300containingType = TryCast(symbol.ContainingSymbol, INamedTypeSymbol) 613Dim containingType = TryCast(symbol.ContainingSymbol, INamedTypeSymbol)
SymbolDisplay\SymbolDisplayVisitor.Types.vb (15)
89Public Overrides Sub VisitNamedType(symbol As INamedTypeSymbol) 197Private Function CanShowDelegateSignature(symbol As INamedTypeSymbol) As Boolean 204Private Sub AddNameAndTypeArgumentsOrParameters(symbol As INamedTypeSymbol, noEscaping As Boolean) 312Private Function ShouldDisplayAsValueTuple(symbol As INamedTypeSymbol) As Boolean 322Private Sub AddAnonymousTypeName(symbol As INamedTypeSymbol) 346Private Shared Function CanUseTupleTypeName(tupleSymbol As INamedTypeSymbol) As Boolean 347Dim currentUnderlying As INamedTypeSymbol = GetTupleUnderlyingTypeOrSelf(tupleSymbol) 354tupleSymbol = DirectCast(currentUnderlying.TypeArguments(TupleTypeSymbol.RestPosition - 1), INamedTypeSymbol) 367Private Shared Function GetTupleUnderlyingTypeOrSelf(tupleSymbol As INamedTypeSymbol) As INamedTypeSymbol 371Private Shared Function HasNonDefaultTupleElements(tupleSymbol As INamedTypeSymbol) As Boolean 375Private Sub AddTupleTypeName(symbol As INamedTypeSymbol) 417Private Function AddSpecialTypeKeyword(symbol As INamedTypeSymbol) As Boolean 428Private Sub AddTypeKind(symbol As INamedTypeSymbol) 482Optional modifiersSource As INamedTypeSymbol = Nothing)
SymbolDisplay\SymbolDisplayVisitor.vb (1)
385Private Function IncludeNamedType(namedType As INamedTypeSymbol) As Boolean
SymbolDisplay\SymbolDisplayVisitor_Constants.vb (1)
14Protected Overrides Sub AddExplicitlyCastedLiteralValue(namedType As INamedTypeSymbol, type As SpecialType, value As Object)
SymbolDisplay\SymbolDisplayVisitor_Minimal.vb (3)
88Private Sub MinimallyQualify(symbol As INamedTypeSymbol) 189Private Function RemoveAttributeSuffixIfNecessary(symbol As INamedTypeSymbol, symbolName As String) As String 204Private Function IsDerivedFromAttributeType(ByVal derivedType As INamedTypeSymbol) As Boolean
Symbols\AssemblySymbol.vb (4)
771Private Function IAssemblySymbol_ResolveForwardedType(metadataName As String) As INamedTypeSymbol Implements IAssemblySymbol.ResolveForwardedType 775Private Function IAssemblySymbol_GetForwardedTypes() As ImmutableArray(Of INamedTypeSymbol) Implements IAssemblySymbol.GetForwardedTypes 776Return ImmutableArrayExtensions.AsImmutable(Of INamedTypeSymbol)(GetAllTopLevelForwardedTypes().OrderBy(Function(t) t.ToDisplayString(SymbolDisplayFormat.QualifiedNameArityFormat))) 779Private Function IAssemblySymbol_GetTypeByMetadataName(metadataName As String) As INamedTypeSymbol Implements IAssemblySymbol.GetTypeByMetadataName
Symbols\Attributes\AttributeData.vb (2)
147''' Gets the attribute class being applied as an <see cref="INamedTypeSymbol"/> 149Protected Overrides ReadOnly Property CommonAttributeClass As INamedTypeSymbol
Symbols\CustomModifier.vb (1)
26Public Overrides ReadOnly Property Modifier As INamedTypeSymbol
Symbols\MethodSymbol.vb (3)
1104Private ReadOnly Property IMethodSymbol_UnmanagedCallingConventionTypes As ImmutableArray(Of INamedTypeSymbol) Implements IMethodSymbol.UnmanagedCallingConventionTypes 1106Return ImmutableArray(Of INamedTypeSymbol).Empty 1180Private ReadOnly Property IMethodSymbol_AssociatedAnonymousDelegate As INamedTypeSymbol Implements IMethodSymbol.AssociatedAnonymousDelegate
Symbols\NamedTypeSymbol.vb (36)
201Public MustOverride ReadOnly Property IsSerializable As Boolean Implements INamedTypeSymbol.IsSerializable 277Public MustOverride ReadOnly Property MightContainExtensionMethods As Boolean Implements INamedTypeSymbol.MightContainExtensionMethods 939Public ReadOnly Property IsGenericType As Boolean Implements INamedTypeSymbol.IsGenericType, INamedTypeSymbolInternal.IsGenericType 1315Private ReadOnly Property INamedTypeSymbol_Arity As Integer Implements INamedTypeSymbol.Arity 1321Private ReadOnly Property INamedTypeSymbol_ConstructedFrom As INamedTypeSymbol Implements INamedTypeSymbol.ConstructedFrom 1327Private ReadOnly Property INamedTypeSymbol_DelegateInvokeMethod As IMethodSymbol Implements INamedTypeSymbol.DelegateInvokeMethod 1333Private ReadOnly Property INamedTypeSymbol_EnumUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.EnumUnderlyingType 1353Private ReadOnly Property INamedTypeSymbol_MemberNames As IEnumerable(Of String) Implements INamedTypeSymbol.MemberNames 1359Private ReadOnly Property INamedTypeSymbol_IsUnboundGenericType As Boolean Implements INamedTypeSymbol.IsUnboundGenericType 1365Private ReadOnly Property INamedTypeSymbol_OriginalDefinition As INamedTypeSymbol Implements INamedTypeSymbol.OriginalDefinition 1371Private Function INamedTypeSymbol_GetTypeArgumentCustomModifiers(ordinal As Integer) As ImmutableArray(Of CustomModifier) Implements INamedTypeSymbol.GetTypeArgumentCustomModifiers 1375Private ReadOnly Property INamedTypeSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TypeArguments 1381Private ReadOnly Property TypeArgumentNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements INamedTypeSymbol.TypeArgumentNullableAnnotations 1387Private ReadOnly Property INamedTypeSymbol_TypeParameters As ImmutableArray(Of ITypeParameterSymbol) Implements INamedTypeSymbol.TypeParameters 1393Private ReadOnly Property INamedTypeSymbol_IsScriptClass As Boolean Implements INamedTypeSymbol.IsScriptClass 1399Private ReadOnly Property INamedTypeSymbol_IsImplicitClass As Boolean Implements INamedTypeSymbol.IsImplicitClass 1405Private Function INamedTypeSymbol_Construct(ParamArray typeArguments() As ITypeSymbol) As INamedTypeSymbol Implements INamedTypeSymbol.Construct 1409Private Function INamedTypeSymbol_Construct(typeArguments As ImmutableArray(Of ITypeSymbol), typeArgumentNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As INamedTypeSymbol Implements INamedTypeSymbol.Construct 1413Private Function INamedTypeSymbol_ConstructUnboundGenericType() As INamedTypeSymbol Implements INamedTypeSymbol.ConstructUnboundGenericType 1417Private ReadOnly Property INamedTypeSymbol_InstanceConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.InstanceConstructors 1423Private ReadOnly Property INamedTypeSymbol_StaticConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.StaticConstructors 1429Private ReadOnly Property INamedTypeSymbol_Constructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.Constructors 1435Private ReadOnly Property INamedTypeSymbol_AssociatedSymbol As ISymbol Implements INamedTypeSymbol.AssociatedSymbol 1441Private ReadOnly Property INamedTypeSymbol_IsComImport As Boolean Implements INamedTypeSymbol.IsComImport 1447Private ReadOnly Property INamedTypeSymbol_IsFileLocal As Boolean Implements INamedTypeSymbol.IsFileLocal 1453Private ReadOnly Property INamedTypeSymbol_NativeIntegerUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.NativeIntegerUnderlyingType 1475Private ReadOnly Property INamedTypeSymbol_TupleElements As ImmutableArray(Of IFieldSymbol) Implements INamedTypeSymbol.TupleElements 1481Private ReadOnly Property INamedTypeSymbol_TupleUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.TupleUnderlyingType
Symbols\NamespaceOrTypeSymbol.vb (6)
276Private Function INamespaceOrTypeSymbol_GetTypeMembers() As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers 277Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers()) 280Private Function INamespaceOrTypeSymbol_GetTypeMembers(name As String) As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers 281Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers(name)) 284Public Function INamespaceOrTypeSymbol_GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers 285Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers(name, arity))
Symbols\Symbol.vb (1)
1223Private ReadOnly Property ISymbol_ContainingType As INamedTypeSymbol Implements ISymbol.ContainingType
Symbols\TypeParameterSymbol.vb (1)
381Private ReadOnly Property ITypeParameterSymbol_DeclaringType As INamedTypeSymbol Implements ITypeParameterSymbol.DeclaringType
Symbols\TypeSymbol.vb (5)
545Private ReadOnly Property ITypeSymbol_AllInterfaces As ImmutableArray(Of INamedTypeSymbol) Implements ITypeSymbol.AllInterfaces 547Return StaticCast(Of INamedTypeSymbol).From(Me.AllInterfacesNoUseSiteDiagnostics) 551Private ReadOnly Property ITypeSymbol_BaseType As INamedTypeSymbol Implements ITypeSymbol.BaseType 557Private ReadOnly Property ITypeSymbol_Interfaces As ImmutableArray(Of INamedTypeSymbol) Implements ITypeSymbol.Interfaces 559Return StaticCast(Of INamedTypeSymbol).From(Me.InterfacesNoUseSiteDiagnostics)
VisualBasicExtensions.vb (13)
632Public Function GetModuleMembers([namespace] As INamespaceSymbol) As ImmutableArray(Of INamedTypeSymbol) 635Return StaticCast(Of INamedTypeSymbol).From(symbol.GetModuleMembers()) 637Return ImmutableArray.Create(Of INamedTypeSymbol)() 648Public Function GetModuleMembers([namespace] As INamespaceSymbol, name As String) As ImmutableArray(Of INamedTypeSymbol) 651Return StaticCast(Of INamedTypeSymbol).From(symbol.GetModuleMembers(name)) 653Return ImmutableArray.Create(Of INamedTypeSymbol)() 788Public Function GetSpecialType(compilation As Compilation, typeId As SpecialType) As INamedTypeSymbol 889Public Function GetDeclaredSymbol(semanticModel As SemanticModel, anonymousObjectCreationExpressionSyntax As AnonymousObjectCreationExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 967Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As TypeStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 980Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As TypeBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 993Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As EnumStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 1006Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As EnumBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol 1071Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As DelegateStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamedTypeSymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (7)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (2)
27For Each method In DirectCast(context.Symbol, INamedTypeSymbol).GetMembers().OfType(Of IMethodSymbol) 55Protected Overrides Function GetTypeDeclarations(namedType As INamedTypeSymbol, cancellationToken As CancellationToken) As IEnumerable(Of TypeBlockSyntax)
src\Analyzers\VisualBasic\Analyzers\UseCollectionInitializer\VisualBasicUseCollectionInitializerDiagnosticAnalyzer.vb (1)
46expressionType As INamedTypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
1068expressionTypeOpt As INamedTypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (3)
94Public Function LastEnumValueHasInitializer(namedTypeSymbol As INamedTypeSymbol) As Boolean Implements ISemanticFacts.LastEnumValueHasInitializer 215Public Function IsPartial(typeSymbol As INamedTypeSymbol, cancellationToken As CancellationToken) As Boolean Implements ISemanticFacts.IsPartial 279Public Function IsInExpressionTree(semanticModel As SemanticModel, node As SyntaxNode, expressionTypeOpt As INamedTypeSymbol, cancellationToken As CancellationToken) As Boolean Implements ISemanticFacts.IsInExpressionTree
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (71)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (7)
28Protected Overrides Function TryInitializeImplicitObjectCreation(document As SemanticDocument, node As SyntaxNode, cancellationToken As CancellationToken, ByRef token As SyntaxToken, ByRef arguments As ImmutableArray(Of Argument(Of ExpressionSyntax)), ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 35Protected Overrides Function ContainingTypesOrSelfHasUnsafeKeyword(containingType As INamedTypeSymbol) As Boolean 62ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 97ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 114typeToGenerateIn = TryCast(symbolInfo.GetAnySymbol(), INamedTypeSymbol) 132ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 147typeToGenerateIn = TryCast(symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol, INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (3)
25ByRef classType As INamedTypeSymbol) As Boolean 34classType = TryCast(semanticDocument.SemanticModel.GetDeclaredSymbol(typeDecl), INamedTypeSymbol) 48classType = TryCast(semanticDocument.SemanticModel.GetDeclaredSymbol(baseList.Parent, cancellationToken), INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (11)
55Protected Overrides Function TryInitializeExplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 69Protected Overrides Function TryInitializeImplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 83Private Shared Function TryGetConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 113Private Shared Function TryGetExplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, castExpression As CastExpressionSyntax, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 115typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type, INamedTypeSymbol) 116Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type, INamedTypeSymbol) 129Private Shared Function TryGetImplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 131typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).ConvertedType, INamedTypeSymbol) 132Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).Type, INamedTypeSymbol) 145Private Shared Function GenerateMethodSymbol(typeToGenerateIn As INamedTypeSymbol, parameterSymbol As INamedTypeSymbol) As IMethodSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (2)
46ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 62typeToGenerateIn = TryCast(semanticInfo.Type, INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (5)
44ByRef classOrStructDecl As SyntaxNode, ByRef classOrStructType As INamedTypeSymbol, 45ByRef interfaceTypes As ImmutableArray(Of INamedTypeSymbol)) As Boolean 92cancellationToken As CancellationToken) As INamedTypeSymbol 98Return TryCast(symbolInfo.GetAnySymbol(), INamedTypeSymbol) 109classType As INamedTypeSymbol,
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
98keepVoid As Boolean, node As MethodBlockSyntax, taskType As INamedTypeSymbol) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
136Dim namedType = TryCast(enumMember.Type, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EventGenerator.vb (2)
108Dim invoke = DirectCast([event].Type, INamedTypeSymbol)?.DelegateInvokeMethod 140Dim eventType = TryCast([event].Type, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (2)
48Return GenerateExpression(generator, DirectCast(type, INamedTypeSymbol).TypeArguments(0), value, canUseFieldReference) 51generator, DirectCast(type, INamedTypeSymbol), value), ExpressionSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamedTypeGenerator.vb (13)
16namedType As INamedTypeSymbol, 27namedType As INamedTypeSymbol, 38namedType As INamedTypeSymbol, 48namedType As INamedTypeSymbol, 70Private Function GetDeclarationSyntaxWithoutMembers(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 92Private Function GenerateNamedTypeDeclarationWorker(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 133Private Function GenerateDelegateDeclaration(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 147Private Function GenerateEnumDeclaration(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 160Private Function GenerateAttributes(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As SyntaxList(Of AttributeListSyntax) 164Private Function GenerateModifiers(namedType As INamedTypeSymbol) As SyntaxTokenList 200Private Function GenerateTypeParameterList(namedType As INamedTypeSymbol) As TypeParameterListSyntax 204Private Function GenerateInheritsStatements(namedType As INamedTypeSymbol) As SyntaxList(Of InheritsStatementSyntax) 215Private Function GenerateImplementsStatements(namedType As INamedTypeSymbol) As SyntaxList(Of ImplementsStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
179namedType As INamedTypeSymbol, 573Public Overrides Function CreateNamedTypeDeclaration(namedType As INamedTypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicFlagsEnumGenerator.vb (2)
19enumType As INamedTypeSymbol, 32Protected Overrides Function IsValidName(enumType As INamedTypeSymbol, name As String) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (2)
103Dim type = TryCast(typeOrNamespace, INamedTypeSymbol) 116Dim moduleType = TryCast(member, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
800Return DirectCast(symbol, INamedTypeSymbol).TypeKind = TypeKind.Enum
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (3)
49Public ReadOnly EnclosingNamedType As INamedTypeSymbol 248Private Function ComputeEnclosingNamedType(cancellationToken As CancellationToken) As INamedTypeSymbol 259Return If(TryCast(enclosingSymbol, INamedTypeSymbol), enclosingSymbol.ContainingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (1)
32Public Overrides Function VisitNamedType(symbol As INamedTypeSymbol) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\IMethodSymbolExtensions.vb (1)
33Dim delegateInvokeMethod = DirectCast(parameter.Type, INamedTypeSymbol).DelegateInvokeMethod
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (4)
65Public Function CreateSimpleTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 94Private Shared Function TryCreateSpecializedNamedTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 137Private Shared Function CreateTupleTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 152Public Overrides Function VisitNamedType(symbol As INamedTypeSymbol) As TypeSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (1)
477Public Overrides Function DeclarationPattern(type As INamedTypeSymbol, name As String) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (7)
109If TypeOf typeSymbol IsNot INamedTypeSymbol Then 219OfType(Of INamedTypeSymbol)(). 293Dim namedType = TryCast(info.Symbol, INamedTypeSymbol) 511Return New TypeInferenceInfo(DirectCast(t.InferredType, INamedTypeSymbol).TypeArguments(0)) 771If TypeOf memberType Is INamedTypeSymbol Then 775Return CreateResult(DirectCast(memberType, INamedTypeSymbol).TypeArguments(0)) 1068Return types.OfType(Of INamedTypeSymbol)().SelectMany(Function(t) GetCollectionElementType(t))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (7)
EndConstructGeneration\EndConstructStatementVisitor_CustomEvents.vb (1)
49Dim type = TryCast(_semanticModel.GetTypeInfo(DirectCast(eventStatement.AsClause, SimpleAsClauseSyntax).Type, Me._cancellationToken).Type, INamedTypeSymbol)
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (5)
116Dim destinationType = TryCast(generateCodeItem.DestinationTypeSymbolKey.Resolve(compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol) 161Dim destinationType = TryCast(generateCodeItem.DestinationTypeSymbolKey.Resolve(compilation, cancellationToken:=cancellationToken).GetAnySymbol(), INamedTypeSymbol) 167Dim delegateInvokeMethod = DirectCast(eventSymbol.Type, INamedTypeSymbol).DelegateInvokeMethod 215Dim destinationType = TryCast(generateCodeItem.DestinationTypeSymbolKey.Resolve(compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol) 259Dim destinationType = TryCast(generateCodeItem.DestinationTypeSymbolKey.Resolve(compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol)
Utilities\NamedTypeSymbolExtensions.vb (1)
14Public Function IsDesignerGeneratedTypeWithInitializeComponent(type As INamedTypeSymbol, compilation As Compilation) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (77)
Attributes\AttributeTests.vb (3)
1954Assert.False(DirectCast(arg, INamedTypeSymbol).IsSerializable) 4441Assert.True(DirectCast(typeInAttribute, INamedTypeSymbol).IsUnboundGenericType) 4451Assert.True(DirectCast(typeInAttribute, INamedTypeSymbol).IsUnboundGenericType)
Attributes\AttributeTests_WellKnownAttributes.vb (30)
723Dim typeC As INamedTypeSymbol = lib_comp.GetTypeByMetadataName("C") 727Dim typeBobAttribute As INamedTypeSymbol = lib_comp.GetTypeByMetadataName("BobAttribute") 737Dim typeC1 As INamedTypeSymbol = client1.GetTypeByMetadataName("C") 741Dim typeBobAttribute1 As INamedTypeSymbol = client1.GetTypeByMetadataName("BobAttribute") 746Dim typeC2 As INamedTypeSymbol = client2.GetTypeByMetadataName("C") 750Dim typeBobAttribute2 As INamedTypeSymbol = client2.GetTypeByMetadataName("BobAttribute") 782Assert.True(DirectCast(cOfInt, INamedTypeSymbol).IsSerializable) 783Assert.True(DirectCast(cOfInt.ConstructedFrom, INamedTypeSymbol).IsSerializable) 787Assert.False(DirectCast(dOfInt, INamedTypeSymbol).IsSerializable) 788Assert.False(DirectCast(dOfInt.ConstructedFrom, INamedTypeSymbol).IsSerializable) 3516Assert.False(DirectCast(substitutedNested, INamedTypeSymbol).IsSerializable) 3520Assert.True(DirectCast(substitutedNestedS, INamedTypeSymbol).IsSerializable) 3524Assert.False(DirectCast(specialized, INamedTypeSymbol).IsSerializable) 3528Assert.True(DirectCast(specializedS, INamedTypeSymbol).IsSerializable) 3532Assert.True(DirectCast(valueTupleS, INamedTypeSymbol).IsSerializable) 3536Assert.False(DirectCast(constructed, INamedTypeSymbol).IsSerializable) 3540Assert.False(DirectCast(constructedPE, INamedTypeSymbol).IsSerializable) 3544Assert.False(DirectCast(constructedFrom, INamedTypeSymbol).IsSerializable) 3548Assert.True(DirectCast(constructedS, INamedTypeSymbol).IsSerializable) 3552Assert.True(DirectCast(constructedSPE, INamedTypeSymbol).IsSerializable) 3556Assert.True(DirectCast(constructedFromS, INamedTypeSymbol).IsSerializable) 3560Assert.False(DirectCast(extendedError, INamedTypeSymbol).IsSerializable) 3564Assert.False(DirectCast(topLevel, INamedTypeSymbol).IsSerializable) 3568Assert.False(DirectCast(nested, INamedTypeSymbol).IsSerializable) 3572Assert.False(DirectCast(constructedError, INamedTypeSymbol).IsSerializable) 3576Assert.False(DirectCast(nestedSubstitutedError, INamedTypeSymbol).IsSerializable) 3581Assert.False(DirectCast(scriptClass, INamedTypeSymbol).IsSerializable) 3585Assert.False(DirectCast(inNamespace, INamedTypeSymbol).IsSerializable) 3589Assert.True(DirectCast(inNamespaceS, INamedTypeSymbol).IsSerializable) 3637Assert.True(DirectCast(arg, INamedTypeSymbol).IsSerializable)
CodeGen\CodeGenTuples.vb (42)
4699Assert.False(DirectCast(xSymbol, INamedTypeSymbol).IsSerializable) 6902Private Shared Function ElementTypeNames(tuple As INamedTypeSymbol) As IEnumerable(Of String) 7207Dim csType = DirectCast(csComp.GlobalNamespace.GetMembers("C").Single(), INamedTypeSymbol) 7461Private Shared Function GetTupleElementNames(tuple As INamedTypeSymbol) As ImmutableArray(Of String) 7478Dim csType = DirectCast(csComp.GlobalNamespace.GetMembers("C").Single(), INamedTypeSymbol) 7513Dim tuple4 = DirectCast(comp.CreateTupleTypeSymbol(CType(tuple1.TupleUnderlyingType, INamedTypeSymbol), 7544Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 7576Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 7608Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 7643Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 7669Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 7704Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol) 9945Assert.False(DirectCast(validFieldWithAttribute.Type, INamedTypeSymbol).IsSerializable) 9950Assert.False(DirectCast(tooFewNames.Type, INamedTypeSymbol).IsSerializable) 17198Dim c1 As INamedTypeSymbol = comp.GetTypeByMetadataName("C1") 17210Dim c2 As INamedTypeSymbol = comp.GetTypeByMetadataName("C2") 17222Dim c3 As INamedTypeSymbol = comp.GetTypeByMetadataName("C3") 17233Dim c4 As INamedTypeSymbol = comp.GetTypeByMetadataName("C4") 17247Private Shared Sub DuplicateInterfaceDetectionWithDifferentTupleNames_02_AssertExplicitInterfaceImplementations(c As INamedTypeSymbol) 17298Dim c1 As INamedTypeSymbol = m.GlobalNamespace.GetTypeMember("C1") 17306Dim c2 As INamedTypeSymbol = m.GlobalNamespace.GetTypeMember("C2") 17371Dim c1 As INamedTypeSymbol = comp.GlobalNamespace.GetTypeMember("C1") 17379Dim c2 As INamedTypeSymbol = comp.GlobalNamespace.GetTypeMember("C2") 17481Dim c1 As INamedTypeSymbol = comp.GetTypeByMetadataName("C1`1") 17493Dim c2 As INamedTypeSymbol = comp.GetTypeByMetadataName("C2`1") 17505Dim c3 As INamedTypeSymbol = comp.GetTypeByMetadataName("C3`1") 17516Dim c4 As INamedTypeSymbol = comp.GetTypeByMetadataName("C4`1") 17530Private Shared Sub DuplicateInterfaceDetectionWithDifferentTupleNames_05_AssertExplicitInterfaceImplementations(c As INamedTypeSymbol) 17568Dim c3 As INamedTypeSymbol = comp.GetTypeByMetadataName("C3`2") 17620Dim c3 As INamedTypeSymbol = comp.GetTypeByMetadataName("C3") 21350Dim derived1 As INamedTypeSymbol = comp.GetTypeByMetadataName("Derived1") 21353Dim derived2 As INamedTypeSymbol = comp.GetTypeByMetadataName("Derived2") 21486Dim derived1 As INamedTypeSymbol = comp.GetTypeByMetadataName("Derived1") 21489Dim derived2 As INamedTypeSymbol = comp.GetTypeByMetadataName("Derived2") 23122VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F0").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "System.ValueTuple", "()") 23123VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F1").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "(System.Int32, System.Int32)", "(System.Int32, System.Int32)") 23124VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F2").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Distinct, "(System.Int32 A, System.Int32 B)", "(A As System.Int32, B As System.Int32)") 23125VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F3").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)", "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)") 23126VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F4").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object B, System.Object, System.Object D, System.Object, System.Object F, System.Object, System.Object H)", "(System.Object, B As System.Object, System.Object, D As System.Object, System.Object, F As System.Object, System.Object, H As System.Object)") 23156Private Shared Sub VerifyTypeFromCSharp(type As INamedTypeSymbol, expectedValue As TupleUnderlyingTypeValue, expectedCSharp As String, expectedVisualBasic As String) 23171Private Shared Sub VerifyDisplay(type As INamedTypeSymbol, expectedCSharp As String, expectedVisualBasic As String) 23204Private Shared Sub VerifyPublicType(type As INamedTypeSymbol, expectedValue As TupleUnderlyingTypeValue)
Emit\DeterministicTests.vb (1)
260Private Shared Function GetForwardedTypes(assembly As AssemblySymbol) As IEnumerable(Of INamedTypeSymbol)
PrivateProtected.vb (1)
133Dim bb = CType(baseCompilation.GlobalNamespace.GetMember("Base"), INamedTypeSymbol)
Microsoft.CodeAnalysis.VisualBasic.Features (110)
ChangeSignature\VisualBasicChangeSignatureService.vb (2)
339Dim delegateInvokeMethod = DirectCast(DirectCast(semanticModel.GetSymbolInfo(raiseEventStatement.Name, cancellationToken).Symbol, IEventSymbol).Type, INamedTypeSymbol).DelegateInvokeMethod 789Protected Overrides Function TryGetRecordPrimaryConstructor(typeSymbol As INamedTypeSymbol, ByRef primaryConstructor As IMethodSymbol) As Boolean
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.CodeAction.vb (2)
15Private ReadOnly _targetSymbol As INamedTypeSymbol 20targetSymbol As INamedTypeSymbol,
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (16)
97Dim targetType As INamedTypeSymbol = Nothing 110targetType = TryCast(sourceDefinition, INamedTypeSymbol) 124targetType As INamedTypeSymbol, 172Dim typeSymbol = TryCast(semanticModel.GetTypeInfo(handlerExpression, cancellationToken).Type, INamedTypeSymbol) 187Private Shared Function ResolveTargetType(ByRef targetType As INamedTypeSymbol, semanticModel As SemanticModel) As Boolean 194targetType = DirectCast(targetType.GetSymbolKey().Resolve(semanticModel.Compilation).Symbol, INamedTypeSymbol) 203Private Shared Function TryGetNameAndTargetType(eventExpression As ExpressionSyntax, containingSymbol As INamedTypeSymbol, semanticModel As SemanticModel, ByRef targetType As INamedTypeSymbol, ByRef actualEventName As String, cancellationToken As CancellationToken) As Boolean 205Dim eventType As INamedTypeSymbol = Nothing 213eventType = TryCast(semanticModel.GetTypeInfo(qualifier, cancellationToken).Type, INamedTypeSymbol) 259Dim targetType = TryCast(SymbolFinder.FindSourceDefinition(semanticModel.GetSymbolInfo(node.Left, cancellationToken).Symbol, document.Project.Solution, cancellationToken), INamedTypeSymbol) 278Dim eventType = TryCast(boundEvent.Type, INamedTypeSymbol) 327Dim targetType As INamedTypeSymbol = Nothing 350targetType = TryCast(SymbolFinder.FindSourceDefinition(withEventsProperty.Type, document.Project.Solution, cancellationToken), INamedTypeSymbol) 354targetType = TryCast(SymbolFinder.FindSourceDefinition(targetType, document.Project.Solution, cancellationToken), INamedTypeSymbol) 363targetType = DirectCast(targetType.GetSymbolKey(cancellationToken).Resolve(semanticModel.Compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol)
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (2)
119suppressMessageAttribute As INamedTypeSymbol, 154suppressMessageAttribute As INamedTypeSymbol,
Completion\CompletionProviders\CompletionListTagCompletionProvider.vb (2)
71Private Shared Function GetCompletionListType(inferredType As ITypeSymbol, within As INamedTypeSymbol, compilation As Compilation, cancellationToken As CancellationToken) As ITypeSymbol 75.OfType(Of INamedTypeSymbol) _
Completion\CompletionProviders\CrefCompletionProvider.vb (1)
186Dim namedTypeContainer = TryCast(container, INamedTypeSymbol)
Completion\CompletionProviders\EnumCompletionProvider.vb (1)
100Private _cachedDisplayAndInsertionTextContainingType As INamedTypeSymbol
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
144Dim type = TryCast(semanticModel.GetTypeInfo(objectCreationExpression, cancellationToken).Type, INamedTypeSymbol) 160Dim attributeType = TryCast(semanticModel.GetTypeInfo(attribute, cancellationToken).Type, INamedTypeSymbol) 186Dim delegateType = DirectCast(expressionType, INamedTypeSymbol)
Completion\CompletionProviders\ObjectInitializerCompletionProvider.vb (1)
109Protected Overrides Function IsInitializableFieldOrProperty(fieldOrProperty As ISymbol, containingType As INamedTypeSymbol) As Boolean
Completion\CompletionProviders\PartialTypeCompletionProvider.vb (2)
62Protected Overrides Function GetDisplayAndSuffixAndInsertionText(symbol As INamedTypeSymbol, context As VisualBasicSyntaxContext) As (displayText As String, suffix As String, insertionText As String) 68Protected Overrides Function GetProperties(symbol As INamedTypeSymbol, context As VisualBasicSyntaxContext) As ImmutableArray(Of KeyValuePair(Of String, String))
Completion\CompletionProviders\XmlDocCommentCompletionProvider.vb (1)
355Dim namedTypeSymbol = TryCast(symbol, INamedTypeSymbol)
Completion\KeywordRecommenders\Declarations\OfKeywordRecommender.vb (2)
111Return symbols.OfType(Of INamedTypeSymbol)() _ 122.OfType(Of INamedTypeSymbol)() _
Debugging\BreakpointResolver.vb (1)
21Protected Overrides Function GetMembers(type As INamedTypeSymbol, name As String) As IEnumerable(Of ISymbol)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (3)
699Friend Overrides Function IsPartial(type As INamedTypeSymbol) As Boolean 1428Friend Overrides Function GetDisplayName(symbol As INamedTypeSymbol) As String 2009Dim type = CType(newSymbol, INamedTypeSymbol)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (2)
98Protected Shared Function MakeUnique(baseName As String, originalFieldName As String, containingType As INamedTypeSymbol, Optional willChangeFieldName As Boolean = True) As String 131Protected Overrides Function GetConstructorNodes(containingType As INamedTypeSymbol) As IEnumerable(Of ConstructorBlockSyntax)
ExtractInterface\VisualBasicExtractInterfaceService.vb (3)
49Friend Overrides Function GetContainingNamespaceDisplay(typeSymbol As INamedTypeSymbol, compilationOptions As CompilationOptions) As String 101unformattedSolution As Solution, documentIds As IReadOnlyList(Of DocumentId), extractedInterfaceSymbol As INamedTypeSymbol, 102typeToExtractFrom As INamedTypeSymbol, includedMembers As IEnumerable(Of ISymbol),
ExtractMethod\VisualBasicSelectionResult.vb (1)
231Private Shared Function IsCoClassImplicitConversion(info As TypeInfo, conversion As Conversion, coclassSymbol As INamedTypeSymbol) As Boolean
GenerateConstructors\VisualBasicGenerateConstructorsCodeRefactoringProvider.vb (1)
32Protected Overrides Function ContainingTypesOrSelfHasUnsafeKeyword(containingType As INamedTypeSymbol) As Boolean
GenerateMember\GenerateVariable\VisualBasicGenerateVariableService.vb (2)
34ByRef identifierToken As SyntaxToken, ByRef propertySymbol As IPropertySymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 55typeToGenerateIn = TryCast(info.Type, INamedTypeSymbol)
GenerateType\VisualBasicGenerateTypeService.vb (4)
327generateTypeServiceStateOptions.DelegateCreationMethodSymbol = DirectCast(type, INamedTypeSymbol).DelegateInvokeMethod 389cancellationToken As CancellationToken) As INamedTypeSymbol 394Return If(typeBlock Is Nothing, Nothing, TryCast(semanticModel.GetDeclaredSymbol(typeBlock.BlockStatement, cancellationToken), INamedTypeSymbol)) 420Public Overrides Async Function GetOrGenerateEnclosingNamespaceSymbolAsync(namedTypeSymbol As INamedTypeSymbol, containers() As String, selectedDocument As Document, selectedDocumentRoot As SyntaxNode, cancellationToken As CancellationToken) As Task(Of (INamespaceSymbol, INamespaceOrTypeSymbol, Location))
InitializeParameter\VisualBasicInitializeMemberFromParameterCodeRefactoringProvider.vb (1)
37Protected Overrides Function DetermineDefaultFieldAccessibility(containingType As INamedTypeSymbol) As Accessibility
IntroduceVariable\VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider.vb (1)
51Protected Overrides Function CreateTupleDeconstructionAsync(document As Document, tupleType As INamedTypeSymbol, expression As ExpressionSyntax, cancellationToken As CancellationToken) As Task(Of ExpressionStatementSyntax)
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceField.vb (1)
60oldType As INamedTypeSymbol,
LanguageServices\VisualBasicStructuralTypeDisplayService.vb (1)
27anonymousType As INamedTypeSymbol,
NavigationBar\VisualBasicNavigationBarItemService.vb (9)
61Private Shared Function GetTypesAndDeclarationsInFile(semanticModel As SemanticModel, cancellationToken As CancellationToken) As IEnumerable(Of Tuple(Of INamedTypeSymbol, SyntaxNode)) 63Dim typesAndDeclarations As New Dictionary(Of INamedTypeSymbol, SyntaxNode) 70Return SpecializedCollections.EmptyEnumerable(Of Tuple(Of INamedTypeSymbol, SyntaxNode))() 74Dim type = TryCast(semanticModel.GetDeclaredSymbol(node, cancellationToken), INamedTypeSymbol) 103type As INamedTypeSymbol, 157type As INamedTypeSymbol, 202type As INamedTypeSymbol, 311containingType As INamedTypeSymbol, 360DirectCast(e.Type, INamedTypeSymbol).DelegateInvokeMethod IsNot Nothing Then
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
63Dim attributeType = TryCast(semanticModel.GetTypeInfo(attribute, cancellationToken).Type, INamedTypeSymbol)
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
147Dim delegateInvokeMethod = DirectCast(parameter.Type, INamedTypeSymbol).DelegateInvokeMethod
SignatureHelp\GenericNameSignatureHelpProvider.Method.vb (1)
31If result.Kind <> SymbolKind.NamedType OrElse Not DirectCast(result, INamedTypeSymbol).IsScriptClass Then
SignatureHelp\GenericNameSignatureHelpProvider.NamedType.vb (1)
9Private Shared Function GetPreambleParts(namedType As INamedTypeSymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart)
SignatureHelp\GenericNameSignatureHelpProvider.vb (3)
99WhereAsArray(Function(s) TypeOf s Is INamedTypeSymbol OrElse TypeOf s Is IMethodSymbol). 120If TypeOf symbol Is INamedTypeSymbol Then 121Dim namedType = DirectCast(symbol, INamedTypeSymbol)
SignatureHelp\InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb (1)
19delegateType As INamedTypeSymbol,
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
126items.AddRange(GetDelegateInvokeItems(invocationExpression, semanticModel, structuralTypeDisplayService, documentationCommentFormattingService, DirectCast(expressionType, INamedTypeSymbol), cancellationToken))
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb (1)
18delegateType As INamedTypeSymbol) As (items As IList(Of SignatureHelpItem), selectedItem As Integer?)
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.NormalType.vb (1)
21normalType As INamedTypeSymbol,
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (1)
73Dim type = TryCast(semanticModel.GetTypeInfo(objectCreationExpression, cancellationToken).Type, INamedTypeSymbol)
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
113Dim type = DirectCast(eventSymbol.Type, INamedTypeSymbol)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (2)
27For Each method In DirectCast(context.Symbol, INamedTypeSymbol).GetMembers().OfType(Of IMethodSymbol) 55Protected Overrides Function GetTypeDeclarations(namedType As INamedTypeSymbol, cancellationToken As CancellationToken) As IEnumerable(Of TypeBlockSyntax)
src\Analyzers\VisualBasic\Analyzers\UseCollectionInitializer\VisualBasicUseCollectionInitializerDiagnosticAnalyzer.vb (1)
46expressionType As INamedTypeSymbol,
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (7)
28Protected Overrides Function TryInitializeImplicitObjectCreation(document As SemanticDocument, node As SyntaxNode, cancellationToken As CancellationToken, ByRef token As SyntaxToken, ByRef arguments As ImmutableArray(Of Argument(Of ExpressionSyntax)), ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 35Protected Overrides Function ContainingTypesOrSelfHasUnsafeKeyword(containingType As INamedTypeSymbol) As Boolean 62ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 97ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 114typeToGenerateIn = TryCast(symbolInfo.GetAnySymbol(), INamedTypeSymbol) 132ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 147typeToGenerateIn = TryCast(symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol, INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (3)
25ByRef classType As INamedTypeSymbol) As Boolean 34classType = TryCast(semanticDocument.SemanticModel.GetDeclaredSymbol(typeDecl), INamedTypeSymbol) 48classType = TryCast(semanticDocument.SemanticModel.GetDeclaredSymbol(baseList.Parent, cancellationToken), INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (11)
55Protected Overrides Function TryInitializeExplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 69Protected Overrides Function TryInitializeImplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 83Private Shared Function TryGetConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 113Private Shared Function TryGetExplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, castExpression As CastExpressionSyntax, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 115typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type, INamedTypeSymbol) 116Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type, INamedTypeSymbol) 129Private Shared Function TryGetImplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 131typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).ConvertedType, INamedTypeSymbol) 132Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).Type, INamedTypeSymbol) 145Private Shared Function GenerateMethodSymbol(typeToGenerateIn As INamedTypeSymbol, parameterSymbol As INamedTypeSymbol) As IMethodSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (2)
46ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 62typeToGenerateIn = TryCast(semanticInfo.Type, INamedTypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (5)
44ByRef classOrStructDecl As SyntaxNode, ByRef classOrStructType As INamedTypeSymbol, 45ByRef interfaceTypes As ImmutableArray(Of INamedTypeSymbol)) As Boolean 92cancellationToken As CancellationToken) As INamedTypeSymbol 98Return TryCast(symbolInfo.GetAnySymbol(), INamedTypeSymbol) 109classType As INamedTypeSymbol,
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
98keepVoid As Boolean, node As MethodBlockSyntax, taskType As INamedTypeSymbol) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (4)
InteractiveSessionTests.vb (4)
134Dim c2C2 = DirectCast(lookupMember(compilation2, "Submission#1", "C2"), INamedTypeSymbol) 148Dim c3C3 = DirectCast(lookupMember(compilation3, "Submission#2", "C3"), INamedTypeSymbol) 155Function lookupType(c As Compilation, name As String) As INamedTypeSymbol 156Return DirectCast(c.GlobalNamespace.GetMembers(name).Single(), INamedTypeSymbol)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (12)
Compilation\CompilationAPITests.vb (1)
1941Dim genericType = DirectCast(comp.GetMember("Pair"), INamedTypeSymbol)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
666Dim typeSymbol, typeSymbol2, typeSymbol3, typeSymbol4, typeSymbol5, typeSymbol6 As INamedTypeSymbol
Diagnostics\GetDiagnosticsTests.vb (1)
721Dim namedType = DirectCast(symbolContext.Symbol, INamedTypeSymbol)
Semantics\NativeIntegerTests.vb (9)
27VerifyType(DirectCast(method.Parameters(0).Type, INamedTypeSymbol), signed:=True, isNativeInteger:=False) 28VerifyType(DirectCast(method.Parameters(1).Type, INamedTypeSymbol), signed:=True, isNativeInteger:=True) 32VerifyType(DirectCast(method.Parameters(0).Type, INamedTypeSymbol), signed:=False, isNativeInteger:=False) 33VerifyType(DirectCast(method.Parameters(1).Type, INamedTypeSymbol), signed:=False, isNativeInteger:=True) 41VerifyType(DirectCast(method.Parameters(0).Type, INamedTypeSymbol), signed:=True, isNativeInteger:=False) 42VerifyType(DirectCast(method.Parameters(1).Type, INamedTypeSymbol), signed:=True, isNativeInteger:=False) 46VerifyType(DirectCast(method.Parameters(0).Type, INamedTypeSymbol), signed:=False, isNativeInteger:=False) 47VerifyType(DirectCast(method.Parameters(1).Type, INamedTypeSymbol), signed:=False, isNativeInteger:=False) 50Private Shared Sub VerifyType(type As INamedTypeSymbol, signed As Boolean, isNativeInteger As Boolean)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (27)
SymbolDisplay\SymbolDisplayTests.vb (1)
4838Dim outer = DirectCast(csComp.GlobalNamespace.GetMembers("Outer").Single(), INamedTypeSymbol)
SymbolsTests\AnonymousDelegates\AnonymousDelegates_CreationAndEmit.vb (1)
316Assert.False(DirectCast(x16, INamedTypeSymbol).IsSerializable)
SymbolsTests\AnonymousTypes\AnonymousTypesEmittedSymbolsTests.vb (1)
591Assert.False(DirectCast(info0.Type, INamedTypeSymbol).IsSerializable)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (1)
408Assert.False(DirectCast(delegateA, INamedTypeSymbol).IsSerializable)
SymbolsTests\CustomModifiersTests.vb (3)
62Dim type = DirectCast(test.Parameters.First().Type, INamedTypeSymbol) 74Dim i = DirectCast(type.TypeArguments.First(), INamedTypeSymbol) 130Dim type = DirectCast(test.Parameters.First().Type, INamedTypeSymbol)
SymbolsTests\Metadata\PE\NoPia.vb (2)
224Assert.False(DirectCast(param(0).Type, INamedTypeSymbol).IsSerializable) 779Assert.False(DirectCast(illegal, INamedTypeSymbol).IsSerializable)
SymbolsTests\Retargeting\NoPia.vb (1)
399Assert.False(DirectCast(missing, INamedTypeSymbol).IsSerializable)
SymbolsTests\Retargeting\RetargetCustomModifiers.vb (1)
81Assert.False(DirectCast(p6.Type, INamedTypeSymbol).IsSerializable)
SymbolsTests\Retargeting\RetargetingTests.vb (2)
3221Assert.False(DirectCast(c, INamedTypeSymbol).IsSerializable) 3225Assert.True(DirectCast(cs, INamedTypeSymbol).IsSerializable)
SymbolsTests\Source\BindingsTests.vb (1)
342Dim typeSymbol, typeSymbol2, typeSymbol3, typeSymbol4, typeSymbol5, typeSymbol6 As INamedTypeSymbol
SymbolsTests\Source\FieldTests.vb (1)
64Dim fieldType = DirectCast(field.Type, INamedTypeSymbol)
SymbolsTests\Source\ImplementsTests.vb (2)
2538Assert.False(DirectCast(iFooOfIntTU, INamedTypeSymbol).IsSerializable) 2542Assert.True(DirectCast(fooSOfIntTU, INamedTypeSymbol).IsSerializable)
SymbolsTests\SymbolErrorTests.vb (1)
6124Assert.False(DirectCast(embedded, INamedTypeSymbol).IsSerializable)
SymbolsTests\UnboundGenericType.vb (4)
272Assert.False(DirectCast(u_c3, INamedTypeSymbol).IsSerializable) 276Assert.False(DirectCast(c3c6, INamedTypeSymbol).IsSerializable) 283Assert.True(DirectCast(u_c3s, INamedTypeSymbol).IsSerializable) 287Assert.True(DirectCast(c3c6s, INamedTypeSymbol).IsSerializable)
SymbolsTests\UnmanagedTypeConstraintTests.vb (5)
1049Assert.False(DirectCast(s1, INamedTypeSymbol).IsUnmanagedType) 1050Assert.True(DirectCast(s2, INamedTypeSymbol).IsUnmanagedType) 1051Assert.True(DirectCast(s3, INamedTypeSymbol).IsUnmanagedType) 1052Assert.False(DirectCast(s4, INamedTypeSymbol).IsUnmanagedType) 1053Assert.True(DirectCast(s5, INamedTypeSymbol).IsUnmanagedType)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (6)
CompilationTestUtils.vb (6)
1086stringInDecl As String) As INamedTypeSymbol 1100stringInDecl As String) As INamedTypeSymbol 1128Optional isDistinct As Boolean = True) As List(Of INamedTypeSymbol) 1134Dim symType = New List(Of INamedTypeSymbol) 1173isDistinct As Boolean) As List(Of INamedTypeSymbol) 1191ParamArray expectedDisplayNames() As String) As List(Of INamedTypeSymbol)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (68)
CodeCleanup\AsyncOrIteratorFunctionReturnTypeFixer.vb (1)
178Private Sub RewriteFunctionAsClause(genericType As INamedTypeSymbol, ByRef asClauseOpt As SimpleAsClauseSyntax, semanticModel As SemanticModel, position As Integer)
FindSymbols\VisualBasicReferenceFinder.vb (2)
29Return DetermineCascadedSymbolsAsync(DirectCast(symbol, INamedTypeSymbol), project, cancellationToken) 49namedType As INamedTypeSymbol,
Recommendations\VisualBasicRecommendationServiceRunner.vb (9)
289Dim typeContainer = DirectCast(container, INamedTypeSymbol) 371Return Not TypeOf DirectCast(s, INamedTypeSymbol).AssociatedSymbol Is IEventSymbol 458Dim namedTypeSymbol = TryCast(symbol, INamedTypeSymbol) 465.GetAccessibleMembersInThisAndBaseTypes(Of INamedTypeSymbol)(within) _ 474Dim namedTypeSymbol = TryCast(namespaceOrTypeSymbol, INamedTypeSymbol) 484.OfType(Of INamedTypeSymbol)() _ 505Return type.GetAccessibleMembersInThisAndBaseTypes(Of INamedTypeSymbol)(within).Any(Function(m) IsOrContainsValidAccessibleClass(m, within)) 522Dim namedTypeSymbol = TryCast(namespaceOrTypeSymbol, INamedTypeSymbol) 532.OfType(Of INamedTypeSymbol)() _
Rename\VisualBasicRenameRewriterLanguageService.vb (3)
321DirectCast(fieldSymbol.Type, INamedTypeSymbol).AssociatedSymbol IsNot Nothing Then 339ElseIf TypeOf symbol Is INamedTypeSymbol Then 340Dim namedTypeSymbol = DirectCast(symbol, INamedTypeSymbol)
Simplification\Simplifiers\ExpressionSimplifier.vb (3)
132Dim keywordKind = GetPredefinedKeywordKind(DirectCast(symbol, INamedTypeSymbol).SpecialType) 241Dim containingType As INamedTypeSymbol = rightSymbol.ContainingType 252Dim namedType = TryCast(leftSymbol, INamedTypeSymbol)
Simplification\Simplifiers\NameSimplifier.vb (2)
198Dim type = DirectCast(symbol, INamedTypeSymbol) 403Private Shared Function CanSimplifyNullable(type As INamedTypeSymbol, name As NameSyntax) As Boolean
Simplification\VisualBasicSimplificationService.Expander.vb (2)
510aliasTarget = DirectCast(aliasTarget, INamedTypeSymbol).ConstructUnboundGenericType() 795Dim type = TryCast(semanticModel.GetTypeInfo(typeOfExpression.Type, _cancellationToken).Type, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
1068expressionTypeOpt As INamedTypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (3)
94Public Function LastEnumValueHasInitializer(namedTypeSymbol As INamedTypeSymbol) As Boolean Implements ISemanticFacts.LastEnumValueHasInitializer 215Public Function IsPartial(typeSymbol As INamedTypeSymbol, cancellationToken As CancellationToken) As Boolean Implements ISemanticFacts.IsPartial 279Public Function IsInExpressionTree(semanticModel As SemanticModel, node As SyntaxNode, expressionTypeOpt As INamedTypeSymbol, cancellationToken As CancellationToken) As Boolean Implements ISemanticFacts.IsInExpressionTree
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
136Dim namedType = TryCast(enumMember.Type, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EventGenerator.vb (2)
108Dim invoke = DirectCast([event].Type, INamedTypeSymbol)?.DelegateInvokeMethod 140Dim eventType = TryCast([event].Type, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (2)
48Return GenerateExpression(generator, DirectCast(type, INamedTypeSymbol).TypeArguments(0), value, canUseFieldReference) 51generator, DirectCast(type, INamedTypeSymbol), value), ExpressionSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamedTypeGenerator.vb (13)
16namedType As INamedTypeSymbol, 27namedType As INamedTypeSymbol, 38namedType As INamedTypeSymbol, 48namedType As INamedTypeSymbol, 70Private Function GetDeclarationSyntaxWithoutMembers(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 92Private Function GenerateNamedTypeDeclarationWorker(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 133Private Function GenerateDelegateDeclaration(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 147Private Function GenerateEnumDeclaration(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As StatementSyntax 160Private Function GenerateAttributes(namedType As INamedTypeSymbol, options As CodeGenerationContextInfo) As SyntaxList(Of AttributeListSyntax) 164Private Function GenerateModifiers(namedType As INamedTypeSymbol) As SyntaxTokenList 200Private Function GenerateTypeParameterList(namedType As INamedTypeSymbol) As TypeParameterListSyntax 204Private Function GenerateInheritsStatements(namedType As INamedTypeSymbol) As SyntaxList(Of InheritsStatementSyntax) 215Private Function GenerateImplementsStatements(namedType As INamedTypeSymbol) As SyntaxList(Of ImplementsStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
179namedType As INamedTypeSymbol, 573Public Overrides Function CreateNamedTypeDeclaration(namedType As INamedTypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicFlagsEnumGenerator.vb (2)
19enumType As INamedTypeSymbol, 32Protected Overrides Function IsValidName(enumType As INamedTypeSymbol, name As String) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (2)
103Dim type = TryCast(typeOrNamespace, INamedTypeSymbol) 116Dim moduleType = TryCast(member, INamedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
800Return DirectCast(symbol, INamedTypeSymbol).TypeKind = TypeKind.Enum
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (3)
49Public ReadOnly EnclosingNamedType As INamedTypeSymbol 248Private Function ComputeEnclosingNamedType(cancellationToken As CancellationToken) As INamedTypeSymbol 259Return If(TryCast(enclosingSymbol, INamedTypeSymbol), enclosingSymbol.ContainingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (1)
32Public Overrides Function VisitNamedType(symbol As INamedTypeSymbol) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\IMethodSymbolExtensions.vb (1)
33Dim delegateInvokeMethod = DirectCast(parameter.Type, INamedTypeSymbol).DelegateInvokeMethod
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (4)
65Public Function CreateSimpleTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 94Private Shared Function TryCreateSpecializedNamedTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 137Private Shared Function CreateTupleTypeSyntax(symbol As INamedTypeSymbol) As TypeSyntax 152Public Overrides Function VisitNamedType(symbol As INamedTypeSymbol) As TypeSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (1)
477Public Overrides Function DeclarationPattern(type As INamedTypeSymbol, name As String) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (7)
109If TypeOf typeSymbol IsNot INamedTypeSymbol Then 219OfType(Of INamedTypeSymbol)(). 293Dim namedType = TryCast(info.Symbol, INamedTypeSymbol) 511Return New TypeInferenceInfo(DirectCast(t.InferredType, INamedTypeSymbol).TypeArguments(0)) 771If TypeOf memberType Is INamedTypeSymbol Then 775Return CreateResult(DirectCast(memberType, INamedTypeSymbol).TypeArguments(0)) 1068Return types.OfType(Of INamedTypeSymbol)().SelectMany(Function(t) GetCollectionElementType(t))
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (4)
CodeGeneration\SyntaxGeneratorTests.vb (4)
21Private ReadOnly _ienumerableInt As INamedTypeSymbol 212Dim typeC = DirectCast(compilation.GlobalNamespace.GetMembers("C").First, INamedTypeSymbol) 3469Dim symbolC = DirectCast(comp.GlobalNamespace.GetMembers("C").First(), INamedTypeSymbol) 3727Dim symbolC = DirectCast(comp.GlobalNamespace.GetMembers("C").First(), INamedTypeSymbol)
Microsoft.CodeAnalysis.Workspaces (751)
Editing\DeclarationModifiers.cs (3)
67if (symbol is INamedTypeSymbol or 76var type = symbol as INamedTypeSymbol;
Editing\SymbolEditorExtensions.cs (3)
59INamedTypeSymbol symbol, 63var baseType = symbol.BaseType; 95INamedTypeSymbol symbol,
Editing\SyntaxGenerator.cs (4)
756var type = (INamedTypeSymbol)symbol; 843var type = (INamedTypeSymbol)symbol;
FindSymbols\FindReferences\BaseTypeFinder.cs (7)
14public static ImmutableArray<INamedTypeSymbol> FindBaseTypesAndInterfaces(INamedTypeSymbol type) 39foreach (var type in FindBaseTypes(symbol.ContainingType)) 80private static ImmutableArray<INamedTypeSymbol> FindBaseTypes(INamedTypeSymbol type) 82var typesBuilder = ArrayBuilder<INamedTypeSymbol>.GetInstance(); 84var currentType = type.BaseType;
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
249var attrType = attr.AttributeClass;
FindSymbols\FindReferences\DependentTypeFinder.cs (30)
20using SymbolSet = HashSet<INamedTypeSymbol>; 45private static readonly Func<INamedTypeSymbol, bool> s_isInterface = static t => t is { TypeKind: TypeKind.Interface }; 46private static readonly Func<INamedTypeSymbol, bool> s_isNonSealedClass = static t => t is { TypeKind: TypeKind.Class, IsSealed: false }; 47private static readonly Func<INamedTypeSymbol, bool> s_isInterfaceOrNonSealedClass = static t => s_isInterface(t) || s_isNonSealedClass(t); 49private static readonly ObjectPool<PooledHashSet<INamedTypeSymbol>> s_symbolSetPool = PooledHashSet<INamedTypeSymbol>.CreatePool(SymbolEquivalenceComparer.Instance); 52/// Walks down a <paramref name="type"/>'s inheritance tree looking for more <see cref="INamedTypeSymbol"/>'s 60private static async Task<ImmutableArray<INamedTypeSymbol>> DescendInheritanceTreeAsync( 61INamedTypeSymbol type, 64Func<INamedTypeSymbol, SymbolSet, bool> typeMatches, 65Func<INamedTypeSymbol, bool> shouldContinueSearching, 209foreach (var type in typesToSearchFor) 254Func<INamedTypeSymbol, bool>? predicate) 266if (info.TryResolve(semanticModel, cancellationToken) is INamedTypeSymbol namedType && 282if (info.TryResolve(semanticModel, cancellationToken) is INamedTypeSymbol namedType && 351foreach (var metadataType in metadataTypes) 360foreach (var derivedType in symbolTreeInfo.GetDerivedMetadataTypes(baseTypeName, compilation, cancellationToken)) 377foreach (var type in foundTypes) 384foreach (var type in foundTypes) 388private static void AddRange(SymbolSet foundTypes, SymbolSet currentTypes, Func<INamedTypeSymbol, bool> shouldContinueSearching) 391foreach (var type in foundTypes) 399INamedTypeSymbol type, 514private static bool TypeHasBaseTypeInSet(INamedTypeSymbol type, SymbolSet set) 516var baseType = type.BaseType?.OriginalDefinition; 520private static bool TypeHasInterfaceInSet(INamedTypeSymbol type, SymbolSet set) 522foreach (var interfaceType in type.Interfaces) 541Func<INamedTypeSymbol, bool> shouldContinueSearching) 548foreach (var derivedType in tempBuffer) 562public static PooledDisposer<PooledHashSet<INamedTypeSymbol>> GetSymbolSet(out SymbolSet instance) 567return new PooledDisposer<PooledHashSet<INamedTypeSymbol>>(pooledInstance);
FindSymbols\FindReferences\DependentTypeFinder_DerivedClasses.cs (5)
15private static Task<ImmutableArray<INamedTypeSymbol>> FindDerivedClassesInCurrentProcessAsync( 16INamedTypeSymbol type, 24static bool TypeMatches(INamedTypeSymbol type, HashSet<INamedTypeSymbol> set) 34return SpecializedTasks.EmptyImmutableArray<INamedTypeSymbol>();
FindSymbols\FindReferences\DependentTypeFinder_DerivedInterfaces.cs (5)
15private static Task<ImmutableArray<INamedTypeSymbol>> FindDerivedInterfacesInCurrentProcessAsync( 16INamedTypeSymbol type, 25static bool TypeMatches(INamedTypeSymbol type, HashSet<INamedTypeSymbol> set) 35return SpecializedTasks.EmptyImmutableArray<INamedTypeSymbol>();
FindSymbols\FindReferences\DependentTypeFinder_ImplementingTypes.cs (4)
14private static async Task<ImmutableArray<INamedTypeSymbol>> FindImplementingTypesInCurrentProcessAsync( 15INamedTypeSymbol type, 37static bool TypeMatches(INamedTypeSymbol type, HashSet<INamedTypeSymbol> set)
FindSymbols\FindReferences\DependentTypeFinder_Remote.cs (7)
18public static async Task<ImmutableArray<INamedTypeSymbol>> FindTypesAsync( 19INamedTypeSymbol type, 52public static async Task<ImmutableArray<INamedTypeSymbol>> FindTypesInCurrentProcessAsync( 53INamedTypeSymbol type, 82private static async Task<ImmutableArray<INamedTypeSymbol>> RehydrateAsync(Solution solution, ImmutableArray<SerializableSymbolAndProjectId> values, CancellationToken cancellationToken) 84using var _ = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var builder); 89if (rehydrated is INamedTypeSymbol namedType)
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
783var containingType = definition.ContainingType;
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (4)
68var suppressMessageAttribute = semanticModel.Compilation.SuppressMessageAttributeType(); 97INamedTypeSymbol suppressMessageAttribute, CancellationToken cancellationToken, out int offsetOfReferenceInToken) 154INamedTypeSymbol suppressMessageAttribute, 197var attributeSymbol = semanticModel.GetSymbolInfo(attributeNode, cancellationToken).Symbol?.ContainingType;
FindSymbols\FindReferences\Finders\ConstructorInitializerSymbolReferenceFinder.cs (2)
85var containingType = semanticModel.GetEnclosingNamedType(token.SpanStart, cancellationToken); 90var containingType = semanticModel.GetEnclosingNamedType(token.SpanStart, cancellationToken);
FindSymbols\FindReferences\Finders\ConstructorSymbolReferenceFinder.cs (3)
29var containingType = symbol.ContainingType; 43var containingType = symbol.ContainingType; 101var containingType = methodSymbol.ContainingType;
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (2)
23private static INamedTypeSymbol? GetUnderlyingNamedType(ITypeSymbol symbol) 46var underlyingNamedType = GetUnderlyingNamedType(symbol.ReturnType);
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.UnderlyingNamedTypeVisitor.cs (9)
11private sealed class UnderlyingNamedTypeVisitor : SymbolVisitor<INamedTypeSymbol?> 19public override INamedTypeSymbol? VisitArrayType(IArrayTypeSymbol symbol) 22public override INamedTypeSymbol? VisitDynamicType(IDynamicTypeSymbol symbol) 25public override INamedTypeSymbol? VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 28public override INamedTypeSymbol? VisitPointerType(IPointerTypeSymbol symbol) 31public override INamedTypeSymbol? VisitTypeParameter(ITypeParameterSymbol symbol) 34public override INamedTypeSymbol? VisitNamedType(INamedTypeSymbol symbol) 37public override INamedTypeSymbol? DefaultVisit(ISymbol symbol)
FindSymbols\FindReferences\Finders\NamedTypeSymbolReferenceFinder.cs (12)
17internal sealed class NamedTypeSymbolReferenceFinder : AbstractReferenceFinder<INamedTypeSymbol> 19protected override bool CanFind(INamedTypeSymbol symbol) 22protected override Task<ImmutableArray<string>> DetermineGlobalAliasesAsync(INamedTypeSymbol symbol, Project project, CancellationToken cancellationToken) 28INamedTypeSymbol symbol, 53INamedTypeSymbol symbol, 108INamedTypeSymbol namedType, 141INamedTypeSymbol namedType, 158INamedTypeSymbol namedType, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, string alias, CancellationToken cancellationToken) 176INamedTypeSymbol symbol, 191INamedTypeSymbol namedType, 208INamedTypeSymbol symbol, 228INamedTypeSymbol namedType,
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (1)
210var containingType = containingMethod.ContainingType;
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (1)
117if (aliasSymbol.Target is INamedTypeSymbol or INamespaceSymbol)
FindSymbols\SymbolFinder.cs (1)
232if (linkedSymbol is INamedTypeSymbol linkedNamedType &&
FindSymbols\SymbolFinder_Helpers.cs (9)
103using var _ = PooledDictionary<INamedTypeSymbol, INamedTypeSymbol>.GetInstance(out var equivalentTypesWithDifferingAssemblies); 128Dictionary<INamedTypeSymbol, INamedTypeSymbol> equivalentTypesWithDifferingAssemblies) 161INamedTypeSymbol candidate, 162INamedTypeSymbol forwardedTo) 184var resolvedType = assembly.ResolveForwardedType(candidateFullMetadataName); 193private static INamedTypeSymbol GetOridinalUnderlyingType(INamedTypeSymbol type)
FindSymbols\SymbolFinder_Hierarchy.cs (24)
48var containingType = symbol.ContainingType; 62foreach (var type in derivedTypes) 143var containingType = symbol.ContainingType.OriginalDefinition; 212public static Task<IEnumerable<INamedTypeSymbol>> FindDerivedClassesAsync( 213INamedTypeSymbol type, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken) 230public static async Task<IEnumerable<INamedTypeSymbol>> FindDerivedClassesAsync( 231INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 243/// <inheritdoc cref="FindDerivedClassesArrayAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/> 245internal static async Task<ImmutableArray<INamedTypeSymbol>> FindDerivedClassesArrayAsync( 246INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 266public static async Task<IEnumerable<INamedTypeSymbol>> FindDerivedInterfacesAsync( 267INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 279/// <inheritdoc cref="FindDerivedInterfacesAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/> 281internal static async Task<ImmutableArray<INamedTypeSymbol>> FindDerivedInterfacesArrayAsync( 282INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 302public static async Task<IEnumerable<INamedTypeSymbol>> FindImplementationsAsync( 303INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 315/// <inheritdoc cref="FindImplementationsAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/> 317internal static async Task<ImmutableArray<INamedTypeSymbol>> FindImplementationsArrayAsync( 318INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default) 329/// cref="INamedTypeSymbol"/> this will be both immediate and transitive implementations. 342if (symbol is INamedTypeSymbol namedTypeSymbol) 361var containingType = symbol.ContainingType.OriginalDefinition; 371foreach (var t in allTypes)
FindSymbols\SymbolTree\SymbolTreeInfo.cs (3)
497public ImmutableArray<INamedTypeSymbol> GetDerivedMetadataTypes( 503using var builder = TemporaryArray<INamedTypeSymbol>.Empty; 513if (symbol is INamedTypeSymbol namedType)
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (3)
186if (symbol is INamedTypeSymbol namedType) 209else if (symbol is INamedTypeSymbol namedTypeSymbol) 213foreach (var childType in namedTypeSymbol.GetTypeMembers())
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
200if (symbol is INamedTypeSymbol { OriginalDefinition.SpecialType: SpecialType.System_Nullable_T, TypeArguments: [var valueType] })
ReassignedVariable\AbstractReassignedVariableService.cs (1)
197var containingType = methodOrProperty.ContainingType;
Recommendations\AbstractRecommendationService.cs (11)
44protected static ISet<INamedTypeSymbol> ComputeOuterTypes(SyntaxContext context, CancellationToken cancellationToken) 49var containingType = enclosingSymbol.GetContainingTypeOrThis(); 56return SpecializedCollections.EmptySet<INamedTypeSymbol>(); 63private ImmutableArray<INamedTypeSymbol> _lazyOuterTypesAndBases; 64private ImmutableArray<INamedTypeSymbol> _lazyEnclosingTypeBases; 78var namedType = (INamedTypeSymbol)symbol; 128var containingTypeOriginalDefinition = symbol.ContainingType.OriginalDefinition; 143private ImmutableArray<INamedTypeSymbol> GetOuterTypesAndBases() 155private ImmutableArray<INamedTypeSymbol> GetEnclosingTypeBases() 159var enclosingType = _context.SemanticModel.GetEnclosingNamedType(_context.LeftToken.SpanStart, _cancellationToken);
Recommendations\AbstractRecommendationServiceRunner.cs (6)
192var expressionSymbol = _context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(Expression<>).FullName); 206type is INamedTypeSymbol expressionSymbolNamedTypeCandidate && 321.FirstOrDefault(s => s is INamedTypeSymbol namedType && namedType.SpecialType == specialType); 463foreach (var constraintTypeInterface in constraintType.GetAllInterfacesIncludingThis()) 474foreach (var interfaceType in originalContainerType.AllInterfaces) 529=> container is not INamedTypeSymbol { IsTupleType: true } namedType
Rename\RenameUtilities.cs (3)
196var containingType = symbol.ContainingType; 350var typeSymbol = (INamedTypeSymbol)symbol;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (5)
81case INamedTypeSymbol nt: 107((INamedTypeSymbol)referencedSymbol.ContainingSymbol).TypeKind == TypeKind.Interface && 126&& possibleType is INamedTypeSymbol namedType 204var namedType = (INamedTypeSymbol)referencedSymbol;
Shared\Extensions\IMethodSymbolExtensions.cs (1)
19public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INamedTypeSymbol delegateType)
Shared\Extensions\INamedTypeSymbolExtensions.cs (1)
11public static INamespaceOrTypeSymbol GenerateRootNamespaceOrType(this INamedTypeSymbol namedType, string[] containers)
Shared\Extensions\INamespaceSymbolExtensions.cs (3)
74var child = (INamedTypeSymbol)current; 96public static IEnumerable<INamedTypeSymbol> GetAllTypes(
Shared\Extensions\ISymbolExtensions.cs (3)
107ISymbol symbol, INamedTypeSymbol? hideModuleNameAttribute, ImmutableArray<AttributeData> attributes = default) 477var baseType = memberSymbol.ContainingType.BaseType; 488else if (memberSymbol is INamedTypeSymbol typeSymbol)
Shared\Extensions\ITypeSymbolExtensions.cs (5)
75var interfaceType = interfaceMember.ContainingType; 84var originalInterfaceType = interfaceMember.ContainingType.OriginalDefinition; 90foreach (var constructedInterface in constructedInterfaces) 188var asyncEnumerableType = compilation.IAsyncEnumerableOfTType(); 202foreach (var @interface in type.AllInterfaces)
Shared\Extensions\SemanticModelExtensions.cs (2)
146var namedType = (INamedTypeSymbol)type;
Shared\Extensions\SyntaxGeneratorExtensions.cs (4)
41INamedTypeSymbol containingType, 181INamedTypeSymbol newContainingType) 195INamedTypeSymbol containingType, 232INamedTypeSymbol newContainingType,
Shared\Utilities\EditorBrowsableHelpers.cs (6)
17public INamedTypeSymbol? HideModuleNameAttribute { get; } = compilation.HideModuleNameAttribute(); 34var editorBrowsableAttributeType = compilation.EditorBrowsableAttributeType(); 35var editorBrowsableStateType = compilation.EditorBrowsableStateType(); 98var typeLibAttributeType = compilation.GetTypeByMetadataName(attributeMetadataName); 99var typeLibFlagsType = compilation.GetTypeByMetadataName(flagsMetadataName); 100var shortType = compilation.GetSpecialType(SpecialType.System_Int16);
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
19ISymbol symbol, INamedTypeSymbol generatedCodeAttribute)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\CompilationExtensions.cs (5)
36public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 38INamedTypeSymbol? type = null; 40foreach (var currentType in compilation.GetTypesByMetadataName(fullyQualifiedMetadataName)) 75foreach (var candidateTopLevelType in compilation.SourceModule.GlobalNamespace.GetTypeMembers(WellKnownMemberNames.TopLevelStatementsEntryPointTypeName, arity: 0)) 87public static INamedTypeSymbol? TryGetCallingConventionSymbol(this Compilation compilation, string callingConvention)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (67)
72public static INamedTypeSymbol? ArrayType(this Compilation compilation) 75public static INamedTypeSymbol? AttributeType(this Compilation compilation) 78public static INamedTypeSymbol? ExceptionType(this Compilation compilation) 81public static INamedTypeSymbol? DebuggerDisplayAttributeType(this Compilation compilation) 84public static INamedTypeSymbol? StructLayoutAttributeType(this Compilation compilation) 87public static INamedTypeSymbol? InlineArrayAttributeType(this Compilation compilation) 90public static INamedTypeSymbol? DesignerCategoryAttributeType(this Compilation compilation) 93public static INamedTypeSymbol? DesignerGeneratedAttributeType(this Compilation compilation) 96public static INamedTypeSymbol? HideModuleNameAttribute(this Compilation compilation) 99public static INamedTypeSymbol? ThreadStaticAttributeType(this Compilation compilation) 102public static INamedTypeSymbol? EventArgsType(this Compilation compilation) 105public static INamedTypeSymbol? NotImplementedExceptionType(this Compilation compilation) 108public static INamedTypeSymbol? EqualityComparerOfTType(this Compilation compilation) 111public static INamedTypeSymbol? ActionType(this Compilation compilation) 114public static INamedTypeSymbol? ExpressionOfTType(this Compilation compilation) 117public static INamedTypeSymbol? EditorBrowsableAttributeType(this Compilation compilation) 120public static INamedTypeSymbol? EditorBrowsableStateType(this Compilation compilation) 123public static INamedTypeSymbol? TaskType(this Compilation compilation) 126public static INamedTypeSymbol? TaskOfTType(this Compilation compilation) 129public static INamedTypeSymbol? ValueTaskType(this Compilation compilation) 132public static INamedTypeSymbol? ValueTaskOfTType(this Compilation compilation) 135public static INamedTypeSymbol? IEnumerableType(this Compilation compilation) 138public static INamedTypeSymbol? IEnumerableOfTType(this Compilation compilation) 141public static INamedTypeSymbol? IEnumeratorOfTType(this Compilation compilation) 144public static INamedTypeSymbol? IListOfTType(this Compilation compilation) 147public static INamedTypeSymbol? IReadOnlyListOfTType(this Compilation compilation) 150public static INamedTypeSymbol? ISetOfTType(this Compilation compilation) 153public static INamedTypeSymbol? IReadOnlySetOfTType(this Compilation compilation) 156public static INamedTypeSymbol? IAsyncEnumerableOfTType(this Compilation compilation) 159public static INamedTypeSymbol? IAsyncEnumeratorOfTType(this Compilation compilation) 162public static INamedTypeSymbol? ImmutableArrayOfTType(this Compilation compilation) 165public static INamedTypeSymbol? SerializableAttributeType(this Compilation compilation) 168public static INamedTypeSymbol? CoClassType(this Compilation compilation) 171public static INamedTypeSymbol? ComAliasNameAttributeType(this Compilation compilation) 174public static INamedTypeSymbol? SuppressMessageAttributeType(this Compilation compilation) 177public static INamedTypeSymbol? TupleElementNamesAttributeType(this Compilation compilation) 180public static INamedTypeSymbol? NativeIntegerAttributeType(this Compilation compilation) 183public static INamedTypeSymbol? DynamicAttributeType(this Compilation compilation) 186public static INamedTypeSymbol? LazyOfTType(this Compilation compilation) 189public static INamedTypeSymbol? ISerializableType(this Compilation compilation) 192public static INamedTypeSymbol? SerializationInfoType(this Compilation compilation) 195public static INamedTypeSymbol? StreamingContextType(this Compilation compilation) 198public static INamedTypeSymbol? OnDeserializingAttribute(this Compilation compilation) 201public static INamedTypeSymbol? OnDeserializedAttribute(this Compilation compilation) 204public static INamedTypeSymbol? OnSerializingAttribute(this Compilation compilation) 207public static INamedTypeSymbol? OnSerializedAttribute(this Compilation compilation) 210public static INamedTypeSymbol? ComRegisterFunctionAttribute(this Compilation compilation) 213public static INamedTypeSymbol? ComUnregisterFunctionAttribute(this Compilation compilation) 216public static INamedTypeSymbol? ConditionalAttribute(this Compilation compilation) 219public static INamedTypeSymbol? ObsoleteAttribute(this Compilation compilation) 222public static INamedTypeSymbol? SystemCompositionImportingConstructorAttribute(this Compilation compilation) 225public static INamedTypeSymbol? SystemComponentModelCompositionImportingConstructorAttribute(this Compilation compilation) 228public static INamedTypeSymbol? SystemIDisposableType(this Compilation compilation) 231public static INamedTypeSymbol? NotNullAttribute(this Compilation compilation) 234public static INamedTypeSymbol? MaybeNullAttribute(this Compilation compilation) 237public static INamedTypeSymbol? MaybeNullWhenAttribute(this Compilation compilation) 240public static INamedTypeSymbol? AllowNullAttribute(this Compilation compilation) 243public static INamedTypeSymbol? DisallowNullAttribute(this Compilation compilation) 246public static INamedTypeSymbol? DataMemberAttribute(this Compilation compilation) 249public static INamedTypeSymbol? DataContractAttribute(this Compilation compilation) 252public static INamedTypeSymbol? AsyncMethodBuilderAttribute(this Compilation compilation) 255public static INamedTypeSymbol? CancellationTokenType(this Compilation compilation) 258public static INamedTypeSymbol? ValueTupleType(this Compilation compilation, int arity) 261public static INamedTypeSymbol? ListOfTType(this Compilation compilation) 264public static INamedTypeSymbol? ReadOnlySpanOfTType(this Compilation compilation) 267public static INamedTypeSymbol? SpanOfTType(this Compilation compilation) 270public static INamedTypeSymbol? InterpolatedStringHandlerAttributeType(this Compilation compilation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IMethodSymbolExtensions.cs (4)
43public static bool HasEventHandlerSignature(this IMethodSymbol method, [NotNullWhen(returnValue: true)] INamedTypeSymbol? eventArgsType) 102public static bool IsEntryPoint(this IMethodSymbol methodSymbol, INamedTypeSymbol? taskType, INamedTypeSymbol? genericTaskType) 118if (method.ReturnType is not INamedTypeSymbol { Arity: 0 })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (73)
20public static IEnumerable<INamedTypeSymbol> GetBaseTypesAndThis(this INamedTypeSymbol? namedType) 22var current = namedType; 30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol) 36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol) 42private static Stack<INamedTypeSymbol> GetContainmentStack(INamedTypeSymbol? symbol) 44var stack = new Stack<INamedTypeSymbol>(); 45for (var current = symbol; current != null; current = current.ContainingType) 53public static bool IsContainedWithin([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol, INamedTypeSymbol outer) 56for (var current = symbol; current != null; current = current.ContainingType) 67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol) 78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member) 82this INamedTypeSymbol classOrStructType, 84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType) 128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 151this INamedTypeSymbol classOrStructType, 153Func<INamedTypeSymbol, ISymbol, bool> isValid, 176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers( 177this INamedTypeSymbol classOrStructType, 178IEnumerable<INamedTypeSymbol> interfaces, 194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within) 246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis( 247this INamedTypeSymbol classOrStructType, 248IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis( 265this INamedTypeSymbol classOrStructType, 266IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers( 284this INamedTypeSymbol classOrStructType, 285IEnumerable<INamedTypeSymbol> interfaces, 297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within) 324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers( 325this INamedTypeSymbol classOrStructType, 326IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented, 328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 358private static ImmutableArray<INamedTypeSymbol> GetTypesToImplement( 359INamedTypeSymbol classOrStructType, 360IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses, 369private static ImmutableArray<INamedTypeSymbol> GetAbstractClassesToImplement( 370IEnumerable<INamedTypeSymbol> abstractClasses) 377private static ImmutableArray<INamedTypeSymbol> GetInterfacesToImplement( 378INamedTypeSymbol classOrStructType, 379IEnumerable<INamedTypeSymbol> interfaces, 386var interfacesToImplement = new List<INamedTypeSymbol>( 391var baseType = classOrStructType.BaseType; 402this INamedTypeSymbol classOrStructType, 403INamedTypeSymbol interfaceType, 404Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented, 405Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation, 406Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter, 448this INamedTypeSymbol attributeSymbol, 454var systemAttributeType = compilation.AttributeType(); 456foreach (var type in attributeSymbol.GetBaseTypesAndThis()) 516private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within) 530this INamedTypeSymbol containingType, CancellationToken cancellationToken) 547foreach (var type in baseTypes) 568Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken) 589Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken) 611Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, 612INamedTypeSymbol type, ref int index, CancellationToken cancellationToken) 625private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType) 667public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments) 670public static bool IsCollectionBuilderAttribute([NotNullWhen(true)] this INamedTypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (3)
89public static IEnumerable<INamedTypeSymbol> GetAllTypes( 105var namedType = (INamedTypeSymbol)current;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
95foreach (var baseType in symbol.ContainingType.GetBaseTypes()) 104bool TryFindLooseMatch(ISymbol symbol, INamedTypeSymbol baseType, [NotNullWhen(true)] out ISymbol? looseMatch) 153foreach (var iface in symbol.ContainingType.AllInterfaces) 214public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol) 216if (symbol is INamedTypeSymbol namedType) 309=> symbol is INamedTypeSymbol { IsAnonymousType: true }; 352SymbolKind.NamedType => ((INamedTypeSymbol)symbol).Arity, 433INamedTypeSymbol nt => nt.TypeParameters, 454INamedTypeSymbol nt => nt.TypeArguments, 463var containingType = symbol.ContainingType; 504var delegateType = compilation.GetTypeByMetadataName(method.ReturnsVoid 548foreach (var type in namespaceOrType.GetAllTypes(cancellationToken)) 562return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName); 812public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
54public override bool VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (26)
25else if (within is INamedTypeSymbol namedType) 52INamedTypeSymbol within, 65INamedTypeSymbol within, 90Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 122return IsNamedTypeAccessible((INamedTypeSymbol)symbol, within); 174private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within) 176Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 201var containingType = type.ContainingType; 214Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 216var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly; 245INamedTypeSymbol containingType, 251Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 256var originalContainingType = containingType.OriginalDefinition; 257var withinNamedType = within as INamedTypeSymbol; 258var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly; 331INamedTypeSymbol? withinType, 334INamedTypeSymbol originalContainingType, 372var current = withinType.OriginalDefinition; 408INamedTypeSymbol originalContainingType) 410Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 412var withinType = within as INamedTypeSymbol; 426INamedTypeSymbol withinType, 427INamedTypeSymbol originalContainingType) 434var current = withinType.OriginalDefinition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeGenerator.cs (1)
11ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (4)
12public static INamedTypeSymbol? GetNamedTypeSymbolConstraint(this ITypeParameterSymbol typeParameter) 15private static INamedTypeSymbol? GetNamedTypeSymbol(ITypeSymbol type) 17return type is INamedTypeSymbol 18? (INamedTypeSymbol)type
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (1)
41public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (1)
52public override void VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CompilationTypeGenerator.cs (1)
19public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (31)
39public static IList<INamedTypeSymbol> GetAllInterfacesIncludingThis(this ITypeSymbol type) 42if (type is INamedTypeSymbol namedType && namedType.TypeKind == TypeKind.Interface && !allInterfaces.Contains(namedType)) 44var result = new List<INamedTypeSymbol>(allInterfaces.Length + 1) 73underlyingType = ((INamedTypeSymbol)symbol).TypeArguments[0]; 96public static bool IsAnonymousType([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol) 99private static HashSet<INamedTypeSymbol> GetOriginalInterfacesAndTheirBaseInterfaces( 101HashSet<INamedTypeSymbol>? symbols = null) 103symbols ??= new HashSet<INamedTypeSymbol>(SymbolEquivalenceComparer.Instance); 105foreach (var interfaceType in type.Interfaces) 124public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol? type) 126var current = type?.BaseType; 144public static IEnumerable<INamedTypeSymbol> GetContainingTypes(this ITypeSymbol type) 146var current = type.ContainingType; 202var currentBaseType = type.BaseType; 231for (var b = symbol.BaseType; b != null; b = b.BaseType) 319INamedTypeSymbol n => ContainsAnonymousType(n), 324private static bool ContainsAnonymousType(INamedTypeSymbol type) 414public static INamedTypeSymbol? GetDelegateType(this ITypeSymbol? typeSymbol, Compilation compilation) 418var expressionOfT = compilation.ExpressionOfTType(); 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 422return typeArgument as INamedTypeSymbol; 427return typeSymbol as INamedTypeSymbol; 580var n1 = t1 as INamedTypeSymbol; 581var n2 = t2 as INamedTypeSymbol; 633public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type, [NotNullWhen(true)] out INamedTypeSymbol? enumType) 637enumType = (INamedTypeSymbol)type; 747=> type is INamedTypeSymbol 755=> symbol is INamedTypeSymbol 763=> type is INamedTypeSymbol namedType &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (2)
40foreach (var callingConventionType in symbol.Signature.UnmanagedCallingConventionTypes) 48public override Accessibility VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (1)
57public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (1)
40public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (1)
39public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
402var notImplementedExceptionType = compilation.NotImplementedExceptionType(); 451static bool IsThrowNotImplementedOperation(INamedTypeSymbol notImplementedExceptionType, IOperation? operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (4)
83return semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(position, cancellationToken) ?? 87public static INamedTypeSymbol? GetEnclosingNamedType(this SemanticModel semanticModel, int position, CancellationToken cancellationToken) 88=> semanticModel.GetEnclosingSymbol<INamedTypeSymbol>(position, cancellationToken); 190var enumerableType = semanticModel.Compilation.IEnumerableOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (3)
67var containingType = symbol.ContainingType; 89var containingType = symbol.ContainingType; 92foreach (var implementedInterface in implementedInterfaces)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (3)
69bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol); 90bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken); 109bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, [NotNullWhen(true)] INamedTypeSymbol? expressionType, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
65var anonymousDelegate = methodSymbol.AssociatedAnonymousDelegate;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (5)
14private sealed class AnonymousTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 18public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 35SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 41using var propertyTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 65var anonymousType = reader.Compilation.CreateAnonymousTypeSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (5)
42/// <item>Two <see cref="INamedTypeSymbol"/>s are the "same" if they have 45/// equal <see cref="INamedTypeSymbol.Arity"/> and 46/// the "same" <see cref="INamedTypeSymbol.TypeArguments"/>.</item> 299foreach (var containingType in containingTypeResolution.OfType<INamedTypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (8)
13private sealed class ErrorTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 17public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 22case INamedTypeSymbol parentType: 66SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason) 73using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 93using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 98var originalType = reader.Compilation.CreateErrorTypeSymbol(container, name, arity); 111SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
39var callingConventionModifiers = ImmutableArray<INamedTypeSymbol>.Empty; 42using var modifiersBuilder = reader.ReadSymbolKeyArray<IFunctionPointerTypeSymbol, INamedTypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (12)
13private sealed class NamedTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 17public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 40SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 50using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 91INamedTypeSymbol? contextualType, 127using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 155using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 167PooledArrayBuilder<INamedTypeSymbol> result, 175foreach (var type in container.GetTypeMembers(name, arity)) 197private static INamedTypeSymbol Construct(INamedTypeSymbol type, bool isUnboundGenericType, ITypeSymbol[] typeArguments) 199var currentType = typeArguments.Length > 0 ? type.Construct(typeArguments) : type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (1)
65var delegateInvoke = (eventSymbol.Type as INamedTypeSymbol)?.DelegateInvokeMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
408public override void VisitNamedType(INamedTypeSymbol namedTypeSymbol) 415else if (namedTypeSymbol.IsTupleType && namedTypeSymbol.TupleUnderlyingType is INamedTypeSymbol underlyingType && underlyingType != namedTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (9)
16private sealed class TupleTypeSymbolKey : AbstractSymbolKey<INamedTypeSymbol> 20public sealed override void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor) 55SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 66SymbolKeyReader reader, INamedTypeSymbol? contextualSymbol, out string? failureReason) 80using var result = PooledArrayBuilder<INamedTypeSymbol>.GetInstance(); 83foreach (var namedType in underlyingTypeResolution.OfType<INamedTypeSymbol>()) 94SymbolKeyReader reader, INamedTypeSymbol? contextualType, out string? failureReason) 98using var elementTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 122var result = reader.Compilation.CreateTupleTypeSymbol(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (5)
416var type = methodSymbol.ContainingType; 417var newType = newMethodSymbol.ContainingType; 490private static bool EnumTypesAreCompatible(INamedTypeSymbol type1, INamedTypeSymbol type2) 995var newSymbolContainingType = newSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
20public static object GetNextEnumValue(INamedTypeSymbol enumType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (12)
147public bool ReturnTypeEquals(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 162public bool Equals(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 168private bool EqualsCore(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 189private static bool IsConstructedFromSelf(INamedTypeSymbol symbol) 211private static OneOrMany<INamedTypeSymbol> Unwrap(INamedTypeSymbol namedType) 217using var builder = TemporaryArray<INamedTypeSymbol>.Empty; 222if (candidate is INamedTypeSymbol candidateType) 241private static TypeKind GetTypeKind(INamedTypeSymbol x)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (65)
21public bool AreEquivalent(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 50return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies); 54return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)y, (INamedTypeSymbol)x, equivalentTypesWithDifferingAssemblies); 64private bool AreArrayAndReadOnlySpanEquivalent(IArrayTypeSymbol array, INamedTypeSymbol readOnlySpanType, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 72internal bool AreEquivalent(CustomModifier x, CustomModifier y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 75internal bool AreEquivalent(ImmutableArray<CustomModifier> x, ImmutableArray<CustomModifier> y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 111private bool AreEquivalentWorker(ISymbol x, ISymbol y, SymbolKind k, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 125SymbolKind.NamedType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies), 126SymbolKind.ErrorType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies), 139private bool ArrayTypesAreEquivalent(IArrayTypeSymbol x, IArrayTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 151private bool FieldsAreEquivalent(IFieldSymbol x, IFieldSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false) 280private bool NamedTypesAreEquivalent(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 300private bool NamedTypesAreEquivalentError(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 302foreach (var type1 in Unwrap(x)) 305foreach (var type2 in Unwrap(y)) 329private bool HandleNamedTypesWorker(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 418private bool HandleTupleTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 463Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, 486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null) 492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 511private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 564private bool ParametersAreEquivalent(IParameterSymbol x, IParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 574private bool PointerTypesAreEquivalent(IPointerTypeSymbol x, IPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 581private bool FunctionPointerTypesAreEquivalent(IFunctionPointerTypeSymbol x, IFunctionPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 608private bool EventsAreEquivalent(IEventSymbol x, IEventSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 615private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (5)
67SymbolKind.NamedType => CombineHashCodes((INamedTypeSymbol)x, currentHash), 143private int CombineHashCodes(INamedTypeSymbol x, int currentHash) 151if (candidate is INamedTypeSymbol candidateNamedType) 161private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash) 190private int CombineAnonymousTypeHashCode(INamedTypeSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.ParameterSymbolEqualityComparer.cs (2)
21Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.SignatureTypeSymbolEquivalenceComparer.cs (2)
16public bool Equals(ITypeSymbol? x, ITypeSymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (15)
60public TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 89public SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 128protected abstract TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 151public abstract SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 350INamedTypeSymbol namedType => CreateNamedTypeDeclaration(namedType, codeGenerationDestination, info, cancellationToken), 368INamedTypeSymbol namedType => AddNamedType(currentDestination, namedType, info, availableIndices, cancellationToken), 393CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken) 411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken) 420public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken) 456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken) 478return AddNamedTypeAsync(context, destination, (INamedTypeSymbol)namespaceOrType, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (10)
15protected abstract SyntaxNode CreateExplicitlyCastedLiteralValue(SyntaxGenerator generator, INamedTypeSymbol enumType, SpecialType underlyingSpecialType, object constantValue); 16protected abstract bool IsValidName(INamedTypeSymbol enumType, string name); 18public SyntaxNode CreateEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue) 34private static bool IsFlagsEnum(INamedTypeSymbol typeSymbol) 46var type = ctor.ContainingType; 63private SyntaxNode CreateFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue) 75INamedTypeSymbol enumType, 141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType) 171INamedTypeSymbol enumType, 188private SyntaxNode CreateNonFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
150public static IEnumerable<ISymbol> GetMembers(INamedTypeSymbol namedType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (14)
48INamedTypeSymbol? containingType, 153INamedTypeSymbol? containingType, 227INamedTypeSymbol? containingType = null, 255INamedTypeSymbol? containingType = null, 409INamedTypeSymbol attributeClass, 419public static INamedTypeSymbol CreateNamedTypeSymbol( 425INamedTypeSymbol? baseType = null, 426ImmutableArray<INamedTypeSymbol> interfaces = default, 438public static INamedTypeSymbol CreateNamedTypeSymbol( 444INamedTypeSymbol? baseType = null, 445ImmutableArray<INamedTypeSymbol> interfaces = default, 456members.WhereAsArray(m => m is not INamedTypeSymbol), 457members.OfType<INamedTypeSymbol>().Select(n => n.ToCodeGenerationSymbol()).ToImmutableArray(), 524INamedTypeSymbol? containingType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (8)
30public static Task<Document> AddEventDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken) 37public static Task<Document> AddFieldDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken) 44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken) 51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken) 58public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 86public static Task<Document> AddMemberDeclarationsAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (10)
44SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 74TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 134Task<Document> AddEventAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken); 139Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken); 144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken); 149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken); 154Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (2)
11public static CodeGenerationAbstractNamedTypeSymbol ToCodeGenerationSymbol(this INamedTypeSymbol namedType) 32namedType.GetMembers().WhereAsArray(s => s is not INamedTypeSymbol),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (3)
28INamedTypeSymbol containingType, 103public INamedTypeSymbol AssociatedAnonymousDelegate => null; 109public ImmutableArray<INamedTypeSymbol> UnmanagedCallingConventionTypes => [];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (10)
21public new INamedTypeSymbol OriginalDefinition { get; protected set; } 29INamedTypeSymbol containingType, 58public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 69public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 82public abstract INamedTypeSymbol EnumUnderlyingType { get; } 84INamedTypeSymbol INamedTypeSymbol.ConstructedFrom => this.ConstructedFrom; 85public abstract INamedTypeSymbol ConstructUnboundGenericType(); 124public INamedTypeSymbol NativeIntegerUnderlyingType => null; 126public INamedTypeSymbol TupleUnderlyingType => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAttributeData.cs (2)
13INamedTypeSymbol attributeClass, 20protected override INamedTypeSymbol CommonAttributeClass => attributeClass;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (4)
51public override INamedTypeSymbol EnumUnderlyingType 57public override INamedTypeSymbol ConstructUnboundGenericType() 87public override ImmutableArray<INamedTypeSymbol> GetTypeMembers() 90return ImmutableArray.CreateRange(_constructedFrom.TypeMembers.Cast<INamedTypeSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorSymbol.cs (1)
12INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (1)
16INamedTypeSymbol? containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
28INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (11)
24private readonly ImmutableArray<INamedTypeSymbol> _interfaces; 29INamedTypeSymbol containingType, 37INamedTypeSymbol baseType, 38ImmutableArray<INamedTypeSymbol> interfaces, 43INamedTypeSymbol enumUnderlyingType) 106public override INamedTypeSymbol EnumUnderlyingType { get; } 116public override INamedTypeSymbol ConstructUnboundGenericType() 152public override INamedTypeSymbol BaseType { get; } 154public override ImmutableArray<INamedTypeSymbol> Interfaces 165public override ImmutableArray<INamedTypeSymbol> GetTypeMembers() 166=> ImmutableArray.CreateRange(this.TypeMembers.Cast<INamedTypeSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceOrTypeSymbol.cs (4)
21INamedTypeSymbol containingType, 36public virtual ImmutableArray<INamedTypeSymbol> GetTypeMembers() 39public ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name) 42public ImmutableArray<INamedTypeSymbol> GetTypeMembers(string name, int arity)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceSymbol.cs (1)
57public static INamedTypeSymbol ImplicitType => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
19INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (1)
18INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (3)
32public INamedTypeSymbol ContainingType { get; protected set; } 36INamedTypeSymbol containingType, 167public ImmutableArray<AttributeData> GetAttributes(INamedTypeSymbol attributeType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (3)
12INamedTypeSymbol containingType, 80public INamedTypeSymbol DeclaringType 84return this.ContainingSymbol as INamedTypeSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (4)
19INamedTypeSymbol containingType, 32public virtual INamedTypeSymbol BaseType => null; 34public virtual ImmutableArray<INamedTypeSymbol> Interfaces 37public ImmutableArray<INamedTypeSymbol> AllInterfaces
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\TypeGenerator.cs (1)
21public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (2)
199foreach (var namedType in SymbolAnnotation.GetSymbols(annotation, model.Compilation).OfType<INamedTypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (3)
21this IMethodSymbol method, INamedTypeSymbol containingType, ISyntaxFactsService syntaxFacts) 145params INamedTypeSymbol[] removeAttributeTypes) 174static bool shouldRemoveAttribute(AttributeData a, (INamedTypeSymbol[] removeAttributeTypes, ISymbol accessibleWithin) arg)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
41this IPropertySymbol property, ISymbol accessibleWithin, params INamedTypeSymbol[] attributesToRemove) 69static bool ShouldRemoveAttribute(AttributeData a, (INamedTypeSymbol[] attributesToRemove, ISymbol accessibleWithin) arg)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (3)
27public static INamedTypeSymbol? InferDelegateType( 37public static INamedTypeSymbol? InferDelegateType( 47private static INamedTypeSymbol? GetFirstDelegateType(SemanticModel semanticModel, ImmutableArray<ITypeSymbol> types)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\KnownTypes.cs (8)
9public readonly INamedTypeSymbol? TaskType = compilation.TaskType(); 10public readonly INamedTypeSymbol? TaskOfTType = compilation.TaskOfTType(); 11public readonly INamedTypeSymbol? ValueTaskType = compilation.ValueTaskType(); 12public readonly INamedTypeSymbol? ValueTaskOfTType = compilation.ValueTaskOfTType(); 14public readonly INamedTypeSymbol? IEnumerableOfTType = compilation.IEnumerableOfTType(); 15public readonly INamedTypeSymbol? IEnumeratorOfTType = compilation.IEnumeratorOfTType(); 17public readonly INamedTypeSymbol? IAsyncEnumerableOfTType = compilation.IAsyncEnumerableOfTType(); 18public readonly INamedTypeSymbol? IAsyncEnumeratorOfTType = compilation.IAsyncEnumeratorOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (4)
46var notImplementedExceptionTypeSyntax = compilation.NotImplementedExceptionType() is INamedTypeSymbol symbol 79var equalityComparerType = compilation.EqualityComparerOfTType(); 184var classOrStructType = throughMember.ContainingType; 449var type = compilation.GetTypeByMetadataName(typeof(ArgumentNullException).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (11)
37INamedTypeSymbol containingType, 68INamedTypeSymbol containingType, 70INamedTypeSymbol constructedEquatableType, 114INamedTypeSymbol containingType, 223var iequatableType = compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName); 276INamedTypeSymbol containingType, 387private static bool ImplementsIEquatable(ITypeSymbol memberType, INamedTypeSymbol iequatableType) 393var constructed = iequatableType.Construct(memberType); 438private static bool HasExistingBaseEqualsMethod(INamedTypeSymbol containingType) 461INamedTypeSymbol? containingType, 495INamedTypeSymbol? containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateGetHashCodeMethod.cs (5)
21INamedTypeSymbol? containingType, 43INamedTypeSymbol hashCodeType, ImmutableArray<SyntaxNode> memberReferences) 83INamedTypeSymbol containingType, 179this SyntaxGenerator generator, SyntaxGeneratorInternal generatorInternal, INamedTypeSymbol namedTypeSymbol, 192public static IMethodSymbol? GetBaseGetHashCodeMethod(INamedTypeSymbol containingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
448var containingType = property.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (5)
66var containingType = parameter.ContainingType; 84var containingType = parameter.ContainingType; 146IOperation? operation, INamedTypeSymbol containingType, 163public static bool IsFieldOrPropertyAssignment(IOperation statement, INamedTypeSymbol containingType, [NotNullWhen(true)] out IAssignmentOperation? assignmentExpression) 167IOperation statement, INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (6)
126var valueTaskType = compilation.ValueTaskType(); 162(INamedTypeSymbol?, IMethodSymbol?) GetIDisposableInterfaceAndDisposeMethod(string typeName, string methodName) 164var disposableType = compilation.GetBestTypeByMetadataName(typeName); 200public bool LastEnumValueHasInitializer(INamedTypeSymbol namedTypeSymbol) 224public bool IsPartial(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken) 251public bool IsInExpressionTree(SemanticModel semanticModel, SyntaxNode node, INamedTypeSymbol expressionTypeOpt, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
116public abstract SyntaxNode DeclarationPattern(INamedTypeSymbol type, string name);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
107protected static IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedTypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (1)
81var typeSymbol = semanticModel.Compilation.GetSpecialType(specialType);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (6)
VisualStudioMSBuildWorkspaceTests.cs (6)
2537var symbol = comp.GetTypeByMetadataName("System.Console"); 2555var symbol = comp.GetTypeByMetadataName("CSharpProject.CSharpClass"); 2573var symbol = comp.GetTypeByMetadataName("VisualBasicProject.VisualBasicClass"); 2591var cssymbol = cscomp.GetTypeByMetadataName("CSharpProject.CSharpClass"); 2599var vbsymbol = vbcomp.GetTypeByMetadataName("VisualBasicProject.VisualBasicClass"); 2600var parent = vbsymbol.BaseType; // this is the vb imported version of the csharp symbol
Microsoft.CodeAnalysis.Workspaces.UnitTests (30)
FindReferencesTests.cs (8)
327var typeB = comp.GetTypeByMetadataName("B"); 338var typeC = comp.GetTypeByMetadataName("C"); 349var typeA = comp.GetTypeByMetadataName("A"); 480var baseType = portableCompilation.GetTypeByMetadataName("N.BaseClass"); 484var derivedType = normalCompilation.GetTypeByMetadataName("M.DerivedClass"); 542var symbol = compilation.GetTypeByMetadataName("C"); 575var symbol = compilation.GetTypeByMetadataName("C"); 617var symbol = compilation.GetTypeByMetadataName("Test.Dummy+NestedDummy");
SolutionTests\SolutionTests.cs (1)
3973var classC = comp3.GetTypeByMetadataName("C");
SymbolKeyTests.cs (16)
740var type = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().First(); 741var constructed = type.Construct(compilation.GetSpecialType(SpecialType.System_Int32), type.TypeParameters[1]); 760var outer = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().First(s => s.Name == "A"); 761var constructed = outer.Construct(compilation.GetSpecialType(SpecialType.System_String)); 762var inner = constructed.GetTypeMembers().Single(); 783var a = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().Single(s => s.Name == "A"); 784var a_b = a.GetTypeMembers().Single(); 791var a_string = a.Construct(compilation.GetSpecialType(SpecialType.System_String)); 792var a_string_b = a_string.GetTypeMembers().Single(); 798var a_string_b_int = a_string_b.Construct(compilation.GetSpecialType(SpecialType.System_Int32)); 806var a_b_int = a_b.Construct(compilation.GetSpecialType(SpecialType.System_Int32)); 826var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().Where(n => !n.IsImplicitlyDeclared).Single().TypeParameters.Single(); 839var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>()
UtilityTest\DocumentationCommentIdTests.cs (5)
335var outerType = compilation.GetTypeByMetadataName("Acme.OuterType`1"); 336var innerType = compilation.GetTypeByMetadataName("Acme.OuterType`1+InnerType`2"); 338var ienum = compilation.GetTypeByMetadataName("System.Collections.Generic.IEnumerable`1"); 339var ienumTP = ienum.Construct(outerType.TypeArguments[0]); 340var intType = compilation.GetSpecialType(SpecialType.System_Int32);
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\ResourceUsageAnalyzer.cs (1)
23INamedTypeSymbol SRSymbol { get; set; }
Microsoft.Extensions.Logging.Generators (13)
LoggerMessageGenerator.Parser.cs (8)
39INamedTypeSymbol? loggerMessageAttribute = _compilation.GetBestTypeByMetadataName(LoggerMessageAttribute); 46INamedTypeSymbol? loggerSymbol = _compilation.GetBestTypeByMetadataName("Microsoft.Extensions.Logging.ILogger"); 53INamedTypeSymbol? logLevelSymbol = _compilation.GetBestTypeByMetadataName("Microsoft.Extensions.Logging.LogLevel"); 60INamedTypeSymbol? exceptionSymbol = _compilation.GetBestTypeByMetadataName("System.Exception"); 67INamedTypeSymbol enumerableSymbol = _compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 68INamedTypeSymbol stringSymbol = _compilation.GetSpecialType(SpecialType.System_String); 631INamedTypeSymbol? classType = sm.GetDeclaredSymbol(classDec, _cancellationToken); 633INamedTypeSymbol? currentClassType = classType;
LoggerMessageGenerator.Roslyn3.11.cs (1)
81INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType;
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
Microsoft.Extensions.Options.SourceGeneration (61)
Emitter.cs (1)
89INamedTypeSymbol? validatorTypeSymbol = compilation.GetBestTypeByMetadataName("System.ComponentModel.DataAnnotations.Validator");
Parser.cs (18)
212if (type is INamedTypeSymbol mt) 245type = ((INamedTypeSymbol)type).TypeArguments[0]; 251return ((INamedTypeSymbol)type).TypeArguments[0]; 255foreach (var implementingInterface in type.AllInterfaces) 273modelType = ((INamedTypeSymbol)modelType).TypeArguments[0]; 278var baseType = modelType.BaseType; 352var attributeType = attribute.AttributeClass!; 368var transValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 431var enumerationValidatorType = attribute.ConstructorArguments[0].Value as INamedTypeSymbol; 639typeSymbol = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 661if (argumentValue is INamedTypeSymbol namedTypeSymbol) 690mt = ((INamedTypeSymbol)mt).TypeArguments[0]; 736foreach (var implementingInterface in modelType.AllInterfaces) 750foreach (var implementingInterface in validatorType.AllInterfaces) 763foreach (var implementingInterface in validatorType.AllInterfaces) 817value is INamedTypeSymbol sym)
ParserUtilities.cs (3)
60foreach (var iface in type.AllInterfaces) 78type = ((INamedTypeSymbol)type).TypeArguments[0]; // extract the T from a Nullable<T> 93foreach (var interfaceType in typeSymbol.AllInterfaces)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
SymbolHolder.cs (17)
12INamedTypeSymbol OptionsValidatorSymbol, 13INamedTypeSymbol ValidationAttributeSymbol, 14INamedTypeSymbol MaxLengthAttributeSymbol, 15INamedTypeSymbol MinLengthAttributeSymbol, 16INamedTypeSymbol CompareAttributeSymbol, 17INamedTypeSymbol? LengthAttributeSymbol, 18INamedTypeSymbol? UnconditionalSuppressMessageAttributeSymbol, 19INamedTypeSymbol RangeAttributeSymbol, 20INamedTypeSymbol ICollectionSymbol, 21INamedTypeSymbol DataTypeAttributeSymbol, 22INamedTypeSymbol ValidateOptionsSymbol, 23INamedTypeSymbol IValidatableObjectSymbol, 24INamedTypeSymbol GenericIEnumerableSymbol, 25INamedTypeSymbol TypeSymbol, 26INamedTypeSymbol TimeSpanSymbol, 27INamedTypeSymbol ValidateObjectMembersAttributeSymbol, 28INamedTypeSymbol ValidateEnumeratedItemsAttributeSymbol);
SymbolLoader.cs (18)
30INamedTypeSymbol? GetSymbol(string metadataName) => compilation.GetTypeByMetadataName(metadataName); 33var optionsValidatorSymbol = GetSymbol(OptionsValidatorAttribute); 34var validationAttributeSymbol = GetSymbol(ValidationAttribute); 35var maxLengthAttributeSymbol = GetSymbol(MaxLengthAttribute); 36var minLengthAttributeSymbol = GetSymbol(MinLengthAttribute); 37var compareAttributeSymbol = GetSymbol(CompareAttribute); 38var lengthAttributeSymbol = GetSymbol(LengthAttribute); 39var rangeAttributeSymbol = GetSymbol(RangeAttribute); 40var iCollectionSymbol = GetSymbol(ICollectionType); 41var dataTypeAttributeSymbol = GetSymbol(DataTypeAttribute); 42var ivalidatableObjectSymbol = GetSymbol(IValidatableObjectType); 43var validateOptionsSymbol = GetSymbol(IValidateOptionsType); 44var genericIEnumerableSymbol = GetSymbol(GenericIEnumerableType); 45var typeSymbol = GetSymbol(TypeOfType); 46var timeSpanSymbol = GetSymbol(TimeSpanType); 47var validateObjectMembersAttribute = GetSymbol(ValidateObjectMembersAttribute); 48var validateEnumeratedItemsAttribute = GetSymbol(ValidateEnumeratedItemsAttribute); 49var unconditionalSuppressMessageAttributeSymbol = GetSymbol(UnconditionalSuppressMessageAttributeType);
Microsoft.Gen.ComplianceReports (8)
Parser.cs (3)
45INamedTypeSymbol? typeSymbol = sm.GetDeclaredSymbol(typeSyntax, _cancellationToken); 60foreach (var iface in typeSymbol.AllInterfaces) 66var parent = typeSymbol.BaseType;
src\Generators\Shared\GeneratorUtilities.cs (2)
110var attributeType = ctor?.ContainingType; 123static string GetAttributeDisplayName(INamedTypeSymbol attributeType)
SymbolHolder.cs (2)
11INamedTypeSymbol DataClassificationAttributeSymbol, 12INamedTypeSymbol? LoggerMessageAttribute);
SymbolLoader.cs (1)
16var dataClassificationAttributeSymbol = compilation.GetTypeByMetadataName(DataClassificationAttribute);
Microsoft.Gen.ContextualOptions (15)
ContextReceiver.cs (4)
37public bool TryGetTypeDeclarations(Compilation compilation, out Dictionary<INamedTypeSymbol, List<TypeDeclarationSyntax>>? typeDeclarations) 48.Where(_ => _.symbol is INamedTypeSymbol) 51.ToDictionary<IGrouping<ISymbol?, TypeDeclarationSyntax>, INamedTypeSymbol, List<TypeDeclarationSyntax>>( 52group => (INamedTypeSymbol)group.Key!, group => group.ToList(), comparer: SymbolEqualityComparer.Default);
ContextualOptionsGenerator.cs (3)
40.Where(_ => _.symbol is INamedTypeSymbol) 43.ToDictionary<IGrouping<ISymbol?, TypeDeclarationSyntax>, INamedTypeSymbol, List<TypeDeclarationSyntax>>( 44group => (INamedTypeSymbol)group.Key!, group => group.ToList(), comparer: SymbolEqualityComparer.Default);
Model\OptionsContextType.cs (2)
14public readonly INamedTypeSymbol Symbol; 26INamedTypeSymbol symbol,
Parser.cs (2)
16public static IEnumerable<OptionsContextType> GetContextualOptionTypes(Dictionary<INamedTypeSymbol, List<TypeDeclarationSyntax>> types) => 74private static ImmutableArray<string> GetContextProperties(INamedTypeSymbol symbol)
src\Generators\Shared\GeneratorUtilities.cs (2)
110var attributeType = ctor?.ContainingType; 123static string GetAttributeDisplayName(INamedTypeSymbol attributeType)
SymbolHolder.cs (1)
10internal sealed record class SymbolHolder(INamedTypeSymbol OptionsContextAttribute);
SymbolLoader.cs (1)
14var optionsContextAttribute = compilation.GetTypeByMetadataName("Microsoft.Extensions.Options.Contextual.OptionsContextAttribute");
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
EmitterTests.cs (4)
32Mock.Of<INamedTypeSymbol>(sym => sym.Name == "Struct1" && sym.ContainingNamespace.ToString() == "Microsoft.GenContextualOptions.TestClasses"), 56Mock.Of<INamedTypeSymbol>(sym => sym.Name == "Class2" && sym.ContainingNamespace.ToString() == "Microsoft.GenContextualOptions.TestClasses"), 84Mock.Of<INamedTypeSymbol>(sym => sym.Name == "Record1" && sym.ContainingNamespace.ToString() == "Microsoft.GenContextualOptions.TestClasses"), 112Mock.Of<INamedTypeSymbol>(sym => sym.Name == "NamespacelessRecord" && sym.ContainingNamespace.IsGlobalNamespace),
Microsoft.Gen.Logging (55)
Parsing\Parser.cs (5)
330var parentType = methodSymbol.ContainingType.ContainingType; 470private static List<INamedTypeSymbol> GetDataClassificationAttributes(ISymbol symbol, SymbolHolder symbols) 568extractedType = ((INamedTypeSymbol)paramTypeSymbol).TypeArguments[0]; 625INamedTypeSymbol? classType = sm.GetDeclaredSymbol(classDec, _cancellationToken); 626INamedTypeSymbol? currentClassType = classType;
Parsing\Parser.LogProperties.cs (7)
46paramTypeSymbol = ((INamedTypeSymbol)paramTypeSymbol).TypeArguments[0]; 93var namedType = type as INamedTypeSymbol; 105var sensitivePropsFromCtor = new Dictionary<string, List<INamedTypeSymbol>>(); 187extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; 274extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; 344symType = ((INamedTypeSymbol)symType).TypeArguments[0];
Parsing\Parser.Records.cs (3)
35var namedType = type as INamedTypeSymbol; 130extractedType = ((INamedTypeSymbol)memberType).TypeArguments[0];
Parsing\Parser.TagProvider.cs (1)
168foreach (var iface in type.AllInterfaces)
Parsing\SymbolHolder.cs (15)
13INamedTypeSymbol LoggerMessageAttribute, 14INamedTypeSymbol LogPropertiesAttribute, 15INamedTypeSymbol TagProviderAttribute, 16INamedTypeSymbol TagNameAttribute, 17INamedTypeSymbol LogPropertyIgnoreAttribute, 18INamedTypeSymbol ITagCollectorSymbol, 19INamedTypeSymbol ILoggerSymbol, 20INamedTypeSymbol LogLevelSymbol, 21INamedTypeSymbol ExceptionSymbol, 22HashSet<INamedTypeSymbol> IgnorePropertiesSymbols, 23INamedTypeSymbol EnumerableSymbol, 24INamedTypeSymbol FormatProviderSymbol, 25INamedTypeSymbol? SpanFormattableSymbol, 26INamedTypeSymbol? DataClassificationAttribute, 27INamedTypeSymbol? NoDataClassificationAttribute);
Parsing\SymbolLoader.cs (16)
56var loggerSymbol = compilation.GetBestTypeByMetadataName(ILoggerType); 57var logLevelSymbol = compilation.GetBestTypeByMetadataName(LogLevelType); 58var loggerMessageAttributeSymbol = compilation.GetBestTypeByMetadataName(LoggerMessageAttribute); 59var logPropertiesAttributeSymbol = compilation.GetBestTypeByMetadataName(LogPropertiesAttribute); 60var tagProviderAttributeSymbol = compilation.GetBestTypeByMetadataName(TagProviderAttribute); 61var tagNameAttributeSymbol = compilation.GetBestTypeByMetadataName(TagNameAttribute); 62var tagCollectorSymbol = compilation.GetBestTypeByMetadataName(ITagCollectorType); 63var logPropertyIgnoreAttributeSymbol = compilation.GetBestTypeByMetadataName(LogPropertyIgnoreAttribute); 64var dataClassificationAttribute = compilation.GetBestTypeByMetadataName(DataClassificationAttribute); 65var noDataClassificationAttribute = compilation.GetBestTypeByMetadataName(NoDataClassificationAttribute); 82var exceptionSymbol = compilation.GetBestTypeByMetadataName(ExceptionType); 89var enumerableSymbol = compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 90var formatProviderSymbol = compilation.GetBestTypeByMetadataName(IFormatProviderType)!; 91var spanFormattableSymbol = compilation.GetBestTypeByMetadataName(ISpanFormattableType); 93var ignorePropsSymbols = new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default); 97var s = compilation.GetBestTypeByMetadataName(ign);
Parsing\TypeSymbolExtensions.cs (1)
95if (sym is INamedTypeSymbol namedTypeSymbol && namedTypeSymbol.IsGenericType && namedTypeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
src\Generators\Shared\GeneratorUtilities.cs (2)
110var attributeType = ctor?.ContainingType; 123static string GetAttributeDisplayName(INamedTypeSymbol attributeType)
src\Generators\Shared\ParserUtilities.cs (1)
65foreach (var iface in type.AllInterfaces)
src\Generators\Shared\RoslynExtensions.cs (4)
44public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 47var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 65var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 101public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
Microsoft.Gen.Logging.Unit.Tests (17)
LogParserUtilitiesTests.cs (6)
82var symbolMock = new Mock<INamedTypeSymbol>(); 95.Returns((INamedTypeSymbol?)null); 116Mock.Of<INamedTypeSymbol>(), 142new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default), 151var paramTypeMock = new Mock<INamedTypeSymbol>() 163.Returns((INamedTypeSymbol?)null);
SymbolLoaderTests.cs (4)
38.Setup<INamedTypeSymbol>("CommonGetTypeByMetadataName", ItExpr.Is<string>(t => t != type)) 39.Returns(Mock.Of<INamedTypeSymbol>()); 43.Setup<INamedTypeSymbol?>("CommonGetTypeByMetadataName", ItExpr.Is<string>(t => t == type)) 44.Returns((INamedTypeSymbol?)null);
TypeSymbolExtensionsTests.cs (7)
286INamedTypeSymbol nullableType = compilation.GetSpecialType(SpecialType.System_Nullable_T); 287INamedTypeSymbol intType = compilation.GetSpecialType(SpecialType.System_Int32); 288INamedTypeSymbol nullableIntType = nullableType.Construct(intType); 297INamedTypeSymbol listType = compilation.GetTypeByMetadataName("System.Collections.Generic.List`1")!; 298INamedTypeSymbol intType = compilation.GetSpecialType(SpecialType.System_Int32); 299INamedTypeSymbol listIntType = listType.Construct(intType); 308INamedTypeSymbol intType = compilation.GetSpecialType(SpecialType.System_Int32);
Microsoft.Gen.Metrics (34)
Exceptions\TransitiveTypeCycleException.cs (2)
13public TransitiveTypeCycleException(ISymbol parent, INamedTypeSymbol namedType) 21public INamedTypeSymbol NamedType { get; }
Parser.cs (9)
147var parentType = methodSymbol.ContainingType.ContainingType; 212private static ITypeSymbol? GetGenericType(INamedTypeSymbol symbol) 218INamedTypeSymbol? methodAttributeSymbol, 581if (returnType is INamedTypeSymbol { Arity: > 0 }) 619constructorArg.Value is not INamedTypeSymbol strongTypeSymbol) 789if (typeSymbol is INamedTypeSymbol namedTypeSymbol) 816if (typeSymbol is not INamedTypeSymbol namedTypeSymbol) 854INamedTypeSymbol namedTypeSymbol, 900INamedTypeSymbol? parentObjectBase = symbol.BaseType;
src\Generators\Shared\GeneratorUtilities.cs (2)
110var attributeType = ctor?.ContainingType; 123static string GetAttributeDisplayName(INamedTypeSymbol attributeType)
src\Generators\Shared\ParserUtilities.cs (1)
65foreach (var iface in type.AllInterfaces)
src\Generators\Shared\RoslynExtensions.cs (4)
44public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 47var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 65var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 101public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
SymbolHolder.cs (8)
11INamedTypeSymbol MeterSymbol, 12INamedTypeSymbol CounterAttribute, 13INamedTypeSymbol? CounterOfTAttribute, 14INamedTypeSymbol HistogramAttribute, 15INamedTypeSymbol? HistogramOfTAttribute, 16INamedTypeSymbol? GaugeAttribute, 17INamedTypeSymbol LongTypeSymbol, 18INamedTypeSymbol? TagNameAttribute);
SymbolLoader.cs (8)
20var meterClassSymbol = compilation.GetTypeByMetadataName(MeterClass); 21var counterAttribute = compilation.GetTypeByMetadataName(CounterAttribute); 22var histogramAttribute = compilation.GetTypeByMetadataName(HistogramAttribute); 32var counterTAttribute = compilation.GetTypeByMetadataName(CounterTAttribute); 33var histogramTAttribute = compilation.GetTypeByMetadataName(HistogramTAttribute); 34var gaugeAttribute = compilation.GetTypeByMetadataName(GaugeAttribute); 35var tagNameAttribute = compilation.GetTypeByMetadataName(TagNameAttribute); 36var longType = compilation.GetSpecialType(SpecialType.System_Int64);
Microsoft.Gen.MetricsReports (30)
src\Generators\Microsoft.Gen.Metrics\Exceptions\TransitiveTypeCycleException.cs (2)
13public TransitiveTypeCycleException(ISymbol parent, INamedTypeSymbol namedType) 21public INamedTypeSymbol NamedType { get; }
src\Generators\Microsoft.Gen.Metrics\Parser.cs (9)
147var parentType = methodSymbol.ContainingType.ContainingType; 212private static ITypeSymbol? GetGenericType(INamedTypeSymbol symbol) 218INamedTypeSymbol? methodAttributeSymbol, 581if (returnType is INamedTypeSymbol { Arity: > 0 }) 619constructorArg.Value is not INamedTypeSymbol strongTypeSymbol) 789if (typeSymbol is INamedTypeSymbol namedTypeSymbol) 816if (typeSymbol is not INamedTypeSymbol namedTypeSymbol) 854INamedTypeSymbol namedTypeSymbol, 900INamedTypeSymbol? parentObjectBase = symbol.BaseType;
src\Generators\Microsoft.Gen.Metrics\SymbolHolder.cs (8)
11INamedTypeSymbol MeterSymbol, 12INamedTypeSymbol CounterAttribute, 13INamedTypeSymbol? CounterOfTAttribute, 14INamedTypeSymbol HistogramAttribute, 15INamedTypeSymbol? HistogramOfTAttribute, 16INamedTypeSymbol? GaugeAttribute, 17INamedTypeSymbol LongTypeSymbol, 18INamedTypeSymbol? TagNameAttribute);
src\Generators\Microsoft.Gen.Metrics\SymbolLoader.cs (8)
20var meterClassSymbol = compilation.GetTypeByMetadataName(MeterClass); 21var counterAttribute = compilation.GetTypeByMetadataName(CounterAttribute); 22var histogramAttribute = compilation.GetTypeByMetadataName(HistogramAttribute); 32var counterTAttribute = compilation.GetTypeByMetadataName(CounterTAttribute); 33var histogramTAttribute = compilation.GetTypeByMetadataName(HistogramTAttribute); 34var gaugeAttribute = compilation.GetTypeByMetadataName(GaugeAttribute); 35var tagNameAttribute = compilation.GetTypeByMetadataName(TagNameAttribute); 36var longType = compilation.GetSpecialType(SpecialType.System_Int64);
src\Generators\Shared\GeneratorUtilities.cs (2)
110var attributeType = ctor?.ContainingType; 123static string GetAttributeDisplayName(INamedTypeSymbol attributeType)
src\Generators\Shared\ParserUtilities.cs (1)
65foreach (var iface in type.AllInterfaces)
Microsoft.Interop.ComInterfaceGenerator (61)
Analyzers\AddGeneratedComClassAnalyzer.cs (5)
25var generatedComClassAttributeType = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 26var generatedComInterfaceAttributeType = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 35INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol; 47foreach (var iface in type.AllInterfaces)
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (6)
32INamedTypeSymbol? generatedComClassAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 33INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 34INamedTypeSymbol? comVisibleAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ComVisibleAttribute)!; 51INamedTypeSymbol containingType = (INamedTypeSymbol)context.ContainingSymbol; 59foreach (var iface in containingType.AllInterfaces)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (4)
36INamedTypeSymbol? interfaceTypeAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.InterfaceTypeAttribute)!; 37INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 50INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol;
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (1)
97var comImportAttributeType = comp.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ComImportAttribute);
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (2)
31INamedTypeSymbol typeSymbol = (INamedTypeSymbol)context.Symbol;
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (6)
29INamedTypeSymbol? marshalType = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshal); 30INamedTypeSymbol? generatedComClassAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 31INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 32INamedTypeSymbol? comObjectType = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_ComObject); 143if (operation.Type is INamedTypeSymbol { IsComImport: true } && !enableGeneratedComInterfaceComImportInterop) 178if (operand.Type is INamedTypeSymbol { IsComImport: true } && !enableGeneratedComInterfaceComImportInterop)
ComClassGenerator.cs (2)
33var type = (INamedTypeSymbol)context.TargetSymbol;
ComClassInfo.cs (2)
26public static DiagnosticOr<ComClassInfo> From(INamedTypeSymbol type, ClassDeclarationSyntax syntax, bool unsafeCodeIsEnabled) 43foreach (INamedTypeSymbol iface in type.AllInterfaces)
ComInterfaceGenerator.cs (4)
41static (context, ct) => context.TargetSymbol is INamedTypeSymbol interfaceSymbol 239INamedTypeSymbol? lcidConversionAttrType = environment.LcidConversionAttrType; 240INamedTypeSymbol? suppressGCTransitionAttrType = environment.SuppressGCTransitionAttrType; 241INamedTypeSymbol? unmanagedCallConvAttrType = environment.UnmanagedCallConvAttrType;
ComInterfaceInfo.cs (13)
11using InterfaceInfo = (Microsoft.Interop.ComInterfaceInfo InterfaceInfo, Microsoft.CodeAnalysis.INamedTypeSymbol Symbol); 55public static DiagnosticOrInterfaceInfo From(INamedTypeSymbol symbol, InterfaceDeclarationSyntax syntax, StubEnvironment env, CancellationToken _) 85if (!TryGetBaseComInterface(symbol, syntax, out INamedTypeSymbol? baseSymbol, out DiagnosticInfo? baseDiagnostic)) 142INamedTypeSymbol symbol) 144if (!TryGetBaseComInterface(symbol, null, out INamedTypeSymbol? baseSymbol, out _) || baseSymbol is null) 153var thisSymbol = baseSymbol; 176private static bool IsInPartialContext(INamedTypeSymbol symbol, InterfaceDeclarationSyntax syntax, [NotNullWhen(false)] out DiagnosticInfo? diagnostic) 193INamedTypeSymbol interfaceSymbol, 253INamedTypeSymbol interfaceSymbol, 291private static bool TryGetBaseComInterface(INamedTypeSymbol comIface, InterfaceDeclarationSyntax? syntax, out INamedTypeSymbol? baseComIface, [NotNullWhen(false)] out DiagnosticInfo? diagnostic) 295foreach (var implemented in comIface.Interfaces) 326private static bool TryGetGuid(INamedTypeSymbol interfaceSymbol, InterfaceDeclarationSyntax syntax, [NotNullWhen(true)] out Guid? guid, [NotNullWhen(false)] out DiagnosticInfo? diagnostic)
ComMethodInfo.cs (1)
40public static SequenceEqualImmutableArray<DiagnosticOr<(ComMethodInfo ComMethod, IMethodSymbol Symbol)>> GetMethodsFromInterface((ComInterfaceInfo ifaceContext, INamedTypeSymbol ifaceSymbol) data, CancellationToken ct)
GeneratedComInterfaceAttributeData.cs (2)
39public static bool TryGetGeneratedComInterfaceAttributeFromInterface(INamedTypeSymbol interfaceSymbol, [NotNullWhen(true)] out AttributeData? generatedComInterfaceAttribute) 53public static GeneratedComInterfaceCompilationData GetAttributeDataFromInterfaceSymbol(INamedTypeSymbol interfaceSymbol)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
VirtualMethodIndexData.cs (1)
47public INamedTypeSymbol? ExceptionMarshallingCustomType { get; init; }
VtableIndexStubGenerator.cs (8)
149INamedTypeSymbol? exceptionMarshallingCustomType = null; 181if (exceptionMarshallingCustomTypeValue.Value is not INamedTypeSymbol) 185exceptionMarshallingCustomType = (INamedTypeSymbol)exceptionMarshallingCustomTypeValue.Value; 201INamedTypeSymbol? lcidConversionAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.LCIDConversionAttribute); 202INamedTypeSymbol? suppressGCTransitionAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.SuppressGCTransitionAttribute); 203INamedTypeSymbol? unmanagedCallConvAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute); 204INamedTypeSymbol iUnmanagedInterfaceTypeType = environment.Compilation.GetTypeByMetadataName(TypeNames.IUnmanagedInterfaceType_Metadata)!; 292INamedTypeSymbol expectedUnmanagedInterfaceType = iUnmanagedInterfaceTypeType;
Microsoft.Interop.JavaScript.JSImportGenerator (11)
JSManagedTypeInfo.cs (6)
102case INamedTypeSymbol { ConstructedFrom.SpecialType: SpecialType.System_Nullable_T } nullable: 120case INamedTypeSymbol { TypeArguments.Length: 1 } taskType when fullTypeName.StartsWith(Constants.TaskGlobal, StringComparison.Ordinal): 128case INamedTypeSymbol { TypeArguments.Length: 1 } spanType when fullTypeName.StartsWith(Constants.SpanGlobal, StringComparison.Ordinal): 136case INamedTypeSymbol { TypeArguments.Length: 1 } arraySegmentType when fullTypeName.StartsWith(Constants.ArraySegmentGlobal, StringComparison.Ordinal): 146case INamedTypeSymbol actionType when fullTypeName.StartsWith(Constants.ActionGlobal, StringComparison.Ordinal): 157case INamedTypeSymbol funcType when fullTypeName.StartsWith(Constants.FuncGlobal, StringComparison.Ordinal):
JSMarshalAsAttributeInfoParser.cs (5)
15private readonly INamedTypeSymbol _jsMarshalAsAttribute; 21public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.IsGenericType && SymbolEqualityComparer.Default.Equals(_jsMarshalAsAttribute, attributeType.ConstructUnboundGenericType()); 26INamedTypeSymbol? jsTypeArgs = attributeData.AttributeClass.TypeArguments[0] as INamedTypeSymbol; 35foreach (var ta in jsTypeArgs.TypeArguments.Cast<INamedTypeSymbol>().Select(x => x.ToDisplayString()))
Microsoft.Interop.LibraryImportGenerator (70)
Analyzers\ConvertToLibraryImportAnalyzer.cs (3)
55INamedTypeSymbol? libraryImportAttrType = context.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute); 67private static void AnalyzeSymbol(SymbolAnalysisContext context, INamedTypeSymbol libraryImportAttrType, StubEnvironment env) 95INamedTypeSymbol libraryImportAttrType,
Analyzers\ConvertToLibraryImportFixer.cs (4)
205INamedTypeSymbol? dllImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.DllImportAttribute); 210INamedTypeSymbol libraryImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute)!; 416INamedTypeSymbol libraryImportAttrType, 659private static bool TryGetAttribute(IMethodSymbol method, INamedTypeSymbol attributeType, out AttributeData? attr)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (15)
631private readonly INamedTypeSymbol _spanOfT; 632private readonly INamedTypeSymbol _readOnlySpanOfT; 633private readonly INamedTypeSymbol _customMarshallerAttribute; 635public PerCompilationAnalyzer(Compilation compilation, INamedTypeSymbol customMarshallerAttribute) 648INamedTypeSymbol entryType = (INamedTypeSymbol)context.ContainingSymbol!; 701(INamedTypeSymbol)marshallerType, 708private void AnalyzeMarshallerType(DiagnosticReporter diagnosticReporter, ITypeSymbol managedType, MarshalMode mode, INamedTypeSymbol marshallerType, bool isLinearCollectionMarshaller) 724private void AnalyzeStatelessMarshallerType(DiagnosticReporter diagnosticReporter, ITypeSymbol managedType, MarshalMode mode, INamedTypeSymbol marshallerType, bool isLinearCollectionMarshaller) 963private void VerifyUnmanagedCollectionElementType(DiagnosticReporter diagnosticReporter, IMethodSymbol? unmanagedValuesCollectionMethod, ITypeSymbol expectedElementType, INamedTypeSymbol expectedSpanType) 983private static void CheckForBufferSizeMember(DiagnosticReporter diagnosticReporter, DiagnosticDescriptor descriptor, INamedTypeSymbol marshallerType, IMethodSymbol callerAllocatedBufferMethod) 987INamedTypeSymbol allocatedBufferType = (INamedTypeSymbol)callerAllocatedBufferMethod.Parameters[1].Type; 1000elementType = ((INamedTypeSymbol)spanTypeMaybe).TypeArguments[0]; 1008private void AnalyzeStatefulMarshallerType(DiagnosticReporter diagnosticReporter, ITypeSymbol managedType, MarshalMode mode, INamedTypeSymbol marshallerType, bool isLinearCollectionMarshaller)
Analyzers\CustomMarshallerAttributeFixer.cs (27)
32Dictionary<(INamedTypeSymbol marshallerType, ITypeSymbol managedType, bool isLinearCollectionMarshaller), HashSet<string>> uniqueMarshallersToFix = new(); 39var entryPointTypeSymbol = (INamedTypeSymbol)model.GetEnclosingSymbol(diagnostic.Location.SourceSpan.Start, fixAllContext.CancellationToken); 45var marshallerType = (INamedTypeSymbol)model.GetSymbolInfo(node, fixAllContext.CancellationToken).Symbol; 55Dictionary<INamedTypeSymbol, INamedTypeSymbol> partiallyUpdatedSymbols = new(SymbolEqualityComparer.Default); 65if (!partiallyUpdatedSymbols.TryGetValue(marshallerType, out INamedTypeSymbol newMarshallerType)) 70newMarshallerType = (INamedTypeSymbol)await symbolEditor.EditOneDeclarationAsync( 149private static void IgnoreArityMismatch(INamedTypeSymbol marshallerType, INamedTypeSymbol managedType) 158var entryPointTypeSymbol = (INamedTypeSymbol)model.GetEnclosingSymbol(node.SpanStart, ct); 171INamedTypeSymbol marshallerType = (INamedTypeSymbol)model.GetSymbolInfo(node, ct).Symbol; 181private static ITypeSymbol GetManagedTypeInAttributeSyntax(Location locationInAttribute, INamedTypeSymbol attributedTypeSymbol) 189INamedTypeSymbol marshallerType, 204private static void AddMissingMembersToStatelessMarshaller(DocumentEditor editor, SyntaxNode declaringSyntax, INamedTypeSymbol marshallerType, ITypeSymbol managedType, HashSet<string> missingMemberNames, bool isLinearCollectionMarshaller) 209INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 210INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 389return ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 393return ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 400private static void AddMissingMembersToStatefulMarshaller(DocumentEditor editor, SyntaxNode declaringSyntax, INamedTypeSymbol marshallerType, ITypeSymbol managedType, HashSet<string> missingMemberNames, bool isLinearCollectionMarshaller) 405INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 406INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 556return ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 560return ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0];
Analyzers\NativeMarshallingAttributeAnalyzer.cs (4)
103(INamedTypeSymbol?)typeOfOp.TypeOperand); 111INamedTypeSymbol? entryType) 125if (managedType is not INamedTypeSymbol namedManagedType) 145entryType = (INamedTypeSymbol)resolvedEntryType;
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (8)
43if (FindContainingEntryPointTypeAndManagedType(diagnosedSymbol.ContainingType) is (INamedTypeSymbol entryPointMarshallerType, INamedTypeSymbol managedType)) 56private static (INamedTypeSymbol EntryPointType, INamedTypeSymbol ManagedType)? FindContainingEntryPointTypeAndManagedType(INamedTypeSymbol marshallerType) 58for (INamedTypeSymbol containingType = marshallerType; containingType is not null; containingType = containingType.ContainingType) 64&& attr.ConstructorArguments[2].Value is INamedTypeSymbol marshallerTypeInAttribute 69return (containingType, (INamedTypeSymbol)attrData.ConstructorArguments[0].Value);
LibraryImportGenerator.cs (5)
226INamedTypeSymbol? lcidConversionAttrType = environment.LcidConversionAttrType; 227INamedTypeSymbol? suppressGCTransitionAttrType = environment.SuppressGCTransitionAttrType; 228INamedTypeSymbol? unmanagedCallConvAttrType = environment.UnmanagedCallConvAttrType; 229INamedTypeSymbol? defaultDllImportSearchPathsAttrType = environment.DefaultDllImportSearchPathsAttrType; 230INamedTypeSymbol? wasmImportLinkageAttrType = environment.WasmImportLinkageAttrType;
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
Microsoft.Interop.LibraryImportGenerator.Downlevel (6)
DownlevelLibraryImportGenerator.cs (2)
167INamedTypeSymbol? lcidConversionAttrType = environment.LcidConversionAttrType; 168INamedTypeSymbol? defaultDllImportSearchPathsAttrType = environment.DefaultDllImportSearchPathsAttrType;
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
Microsoft.Interop.SourceGeneration (123)
ArrayMarshallingInfoProvider.cs (1)
48INamedTypeSymbol? arrayMarshaller;
BlittableTypeMarshallingInfoProvider.cs (1)
23public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type is INamedTypeSymbol { IsUnmanagedType: true } unmanagedType
ComInterfaceMarshallingInfoProvider.cs (2)
24public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute; 35INamedTypeSymbol? comInterfaceMarshaller = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_ComInterfaceMarshaller_Metadata);
CustomMarshallingInfoHelper.cs (7)
15INamedTypeSymbol entryPointType, 58else if (type is INamedTypeSymbol namedManagedCollectionType && entryPointType.IsUnboundGenericType) 70entryPointType = (INamedTypeSymbol)resolvedEntryPointType; 90if (type is INamedTypeSymbol namedManagedType && entryPointType.IsUnboundGenericType) 102entryPointType = (INamedTypeSymbol)resolvedEntryPointType; 135INamedTypeSymbol entryPointType, 175INamedTypeSymbol? marshallerType = compilation.GetBestTypeByMetadataName(marshallerName);
InteropAttributeData.cs (4)
50public INamedTypeSymbol? StringMarshallingCustomType { get; init; } 60INamedTypeSymbol? stringMarshallingCustomType = null; 85if (stringMarshallingCustomTypeValue.Value is not INamedTypeSymbol) 89stringMarshallingCustomType = (INamedTypeSymbol)stringMarshallingCustomTypeValue.Value;
ISymbolExtensions.cs (2)
15public static bool IsAccessibleFromFileScopedClass(this INamedTypeSymbol symbol, [NotNullWhen(false)] out string? details) 23for (ISymbol current = symbol.ContainingSymbol; current is INamedTypeSymbol currentType; current = currentType.ContainingSymbol)
ManagedTypeInfo.cs (1)
50return new EnumTypeInfo(typeName, diagnosticFormattedName, ((INamedTypeSymbol)type).EnumUnderlyingType!.SpecialType);
ManualTypeMarshallingHelper.cs (40)
81private static void IgnoreArityMismatch(INamedTypeSymbol _, INamedTypeSymbol __) { } 83public static bool IsLinearCollectionEntryPoint(INamedTypeSymbol entryPointType) 95INamedTypeSymbol entryPointType, 104INamedTypeSymbol entryPointType, 107Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, 114INamedTypeSymbol entryPointType, 124INamedTypeSymbol entryPointType, 128Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, 135INamedTypeSymbol entryPointType, 138Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, 146INamedTypeSymbol entryPointType, 151Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, 241public static bool TryResolveEntryPointType(INamedTypeSymbol managedType, ITypeSymbol typeInAttribute, bool isLinearCollectionMarshalling, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? entryPoint) 243if (typeInAttribute is not INamedTypeSymbol entryPointType) 255INamedTypeSymbol instantiatedEntryType = entryPointType.ResolveUnboundConstructedTypeToConstructedType(managedType, out int numOriginalArgsSubstituted, out int extraArgumentsInTemplate); 283public static bool TryResolveManagedType(INamedTypeSymbol entryPointType, ITypeSymbol typeInAttribute, bool isLinearCollectionMarshalling, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? managed) 285if (typeInAttribute is not INamedTypeSymbol namedMarshallerType) 298INamedTypeSymbol instantiatedManagedType = namedMarshallerType.ResolveUnboundConstructedTypeToConstructedType(entryPointType, out int numOriginalArgsSubstituted, out int extraArgumentsInTemplate); 326public static bool TryResolveMarshallerType(INamedTypeSymbol entryPointType, ITypeSymbol typeInAttribute, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? marshallerType) 328if (typeInAttribute is not INamedTypeSymbol namedMarshallerType) 334INamedTypeSymbol instantiatedMarshallerType = namedMarshallerType.ResolveUnboundConstructedTypeToConstructedType(entryPointType, out int numOriginalArgsSubstituted, out int extraArgumentsInTemplate); 348/// Resolve a non-<see cref="INamedTypeSymbol"/> <paramref name="managedType"/> to the correct 356public static ITypeSymbol ReplaceGenericPlaceholderInType(ITypeSymbol managedType, INamedTypeSymbol entryType, Compilation compilation) 467collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 498collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 525bufferElementType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(((INamedTypeSymbol)methods.ToUnmanagedWithBuffer.Parameters[1].Type).TypeArguments[0]); 573collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 591collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 605bufferElementType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(((INamedTypeSymbol)methods.FromManagedWithBuffer.Parameters[1].Type).TypeArguments[0]);
MarshalAsParser.cs (1)
131public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute;
MarshalAsWithCustomMarshallersParser.cs (3)
35public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute; 46return type is INamedTypeSymbol { IsComImport: true } 66else if (arrayInfo.ArraySubType == UnmanagedType.Interface && elementType is not INamedTypeSymbol { IsComImport: true })
MarshallerShape.cs (15)
116INamedTypeSymbol spanOfT = compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!; 120INamedTypeSymbol readOnlySpanOfT = compilation.GetTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 226if (typeToCheck is INamedTypeSymbol namedType) 236INamedTypeSymbol currentType = containingType as INamedTypeSymbol; 346.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 356.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 386.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 396.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 454INamedTypeSymbol spanOfT = compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!; 459INamedTypeSymbol readOnlySpanOfT = compilation.GetTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 690.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 699.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 708.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 718.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType }
MarshallingAttributeInfo.cs (2)
15/// Since it contains a <see cref="INamedTypeSymbol"/>, it should not be used as a field on any types 20INamedTypeSymbol? StringMarshallingCustomType
MarshallingInfoParser.cs (2)
39bool CanParseAttributeType(INamedTypeSymbol attributeType); 61bool CanParseAttributeType(INamedTypeSymbol attributeType);
MarshalUsingAttributeParser.cs (2)
26public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.MarshalUsingAttribute; 46if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol namedType)
NativeMarshallingAttributeParser.cs (2)
20public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.NativeMarshallingAttribute; 31if (attributeData.ConstructorArguments[0].Value is not INamedTypeSymbol entryPointType)
SafeHandleMarshallingInfoProvider.cs (4)
18private readonly INamedTypeSymbol? _safeHandleType = compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_SafeHandle); 19private readonly INamedTypeSymbol? _safeHandleMarshallerType = compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_SafeHandleMarshaller_Metadata); 44if (type is INamedTypeSymbol named && !named.IsAbstract && named.InstanceConstructors.Length > 0) 63INamedTypeSymbol entryPointType = _safeHandleMarshallerType.Construct(type);
SignatureContext.cs (1)
161for (INamedTypeSymbol type = method.ContainingType; type is not null; type = type.ContainingType)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
StubEnvironment.cs (15)
21private Optional<INamedTypeSymbol?> _lcidConversionAttrType; 22public INamedTypeSymbol? LcidConversionAttrType 30_lcidConversionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.LCIDConversionAttribute)); 35private Optional<INamedTypeSymbol?> _suppressGCTransitionAttrType; 36public INamedTypeSymbol? SuppressGCTransitionAttrType 44_suppressGCTransitionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.SuppressGCTransitionAttribute)); 49private Optional<INamedTypeSymbol?> _unmanagedCallConvAttrType; 50public INamedTypeSymbol? UnmanagedCallConvAttrType 58_unmanagedCallConvAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute)); 63private Optional<INamedTypeSymbol?> _defaultDllImportSearchPathsAttrType; 64public INamedTypeSymbol? DefaultDllImportSearchPathsAttrType 72_defaultDllImportSearchPathsAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.DefaultDllImportSearchPathsAttribute)); 77private Optional<INamedTypeSymbol?> _wasmImportLinkageAttrType; 78public INamedTypeSymbol? WasmImportLinkageAttrType 86_wasmImportLinkageAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.WasmImportLinkageAttribute));
TypePositionInfo.cs (2)
118INamedTypeSymbol outAttributeType = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_OutAttribute)!; 119INamedTypeSymbol inAttributeType = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_InAttribute)!;
TypeSymbolExtensions.cs (12)
210(INamedTypeSymbol namedType, INamedTypeSymbol namedOther) => SymbolEqualityComparer.Default.Equals(namedType.ConstructedFrom, namedOther.ConstructedFrom), 223public static INamedTypeSymbol ResolveUnboundConstructedTypeToConstructedType(this INamedTypeSymbol unboundConstructedType, INamedTypeSymbol instantiatedTemplateType, out int numOriginalTypeArgumentsSubstituted, out int extraTypeArgumentsInTemplate) 229Stack<INamedTypeSymbol> originalNestedTypes = new(); 230for (INamedTypeSymbol originalTypeDefinition = unboundConstructedType.OriginalDefinition; originalTypeDefinition is not null; originalTypeDefinition = originalTypeDefinition.ContainingType) 237INamedTypeSymbol currentType = null; 249INamedTypeSymbol originalNestedType = originalNestedTypes.Pop(); 305public static (ImmutableArray<ITypeSymbol> TypeArguments, ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations) GetAllTypeArgumentsIncludingInContainingTypes(this INamedTypeSymbol genericType) 310for (INamedTypeSymbol instantiatedType = genericType; instantiatedType is not null; instantiatedType = instantiatedType.ContainingType) 330public static bool IsOfType(this INamedTypeSymbol type, string typeName)
Microsoft.Maui.Controls.BindingSourceGen (3)
ISymbolExtensions.cs (1)
31 var containgType = propertySymbol.ContainingType;
ITypeSymbolExtensions.cs (2)
28 typeInfo is INamedTypeSymbol namedTypeSymbol 41 return ((INamedTypeSymbol)typeSymbol).TypeArguments[0].ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
Microsoft.Maui.Controls.SourceGen (5)
CodeBehindGenerator.cs (5)
186 INamedTypeSymbol? xmlnsDefinitonAttribute = compilation.GetTypesByMetadataName(typeof(XmlnsDefinitionAttribute).FullName) 190 INamedTypeSymbol? internalsVisibleToAttribute = compilation.GetTypeByMetadataName(typeof(InternalsVisibleToAttribute).FullName); 548 IList<INamedTypeSymbol> types = compilation.GetTypesByMetadataName(fullName); 555 foreach (INamedTypeSymbol type in types) 583 static bool IsPublicOrVisibleInternal(INamedTypeSymbol type, IEnumerable<IAssemblySymbol> internalsVisible)
Microsoft.ML.InternalCodeAnalyzer (23)
BaseTestClassAnalyzer.cs (10)
52private readonly INamedTypeSymbol _factAttribute; 53private readonly INamedTypeSymbol _baseTestClass; 54private readonly INamedTypeSymbol _ITbaseTestClass; 55private readonly ConcurrentDictionary<INamedTypeSymbol, bool> _knownTestAttributes = new ConcurrentDictionary<INamedTypeSymbol, bool>(); 57public AnalyzerImpl(Compilation compilation, INamedTypeSymbol factAttribute) 67var namedType = (INamedTypeSymbol)context.Symbol; 84private bool ExtendsBaseTestClass(INamedTypeSymbol namedType) 90for (var current = namedType; current is object; current = current.BaseType)
BestFriendAnalyzer.cs (2)
55var bestFriendAttributeType = comp.GetTypeByMetadataName(attributeName); 58var wantsToBeBestFriendsAttributeType = comp.GetTypeByMetadataName(assemblyAttributeName);
BestFriendOnPublicDeclarationsAnalyzer.cs (2)
48var attribute = context.Compilation.GetTypeByMetadataName(attributeName); 57private void AnalyzeCore(SymbolAnalysisContext context, INamedTypeSymbol attributeType)
IMethodSymbolExtensions.cs (2)
12public static bool IsTestMethod(this IMethodSymbol method, ConcurrentDictionary<INamedTypeSymbol, bool> knownTestAttributes, INamedTypeSymbol factAttribute)
INamedTypeSymbolExtensions.cs (6)
13public static bool IsTestAttribute(this INamedTypeSymbol attributeClass, ConcurrentDictionary<INamedTypeSymbol, bool> knownTestAttributes, INamedTypeSymbol factAttribute) 21private static bool ExtendsFactAttribute(INamedTypeSymbol namedType, INamedTypeSymbol factAttribute) 24for (var current = namedType; current is object; current = current.BaseType)
RelaxTestNamingSuppressor.cs (1)
31var knownTestAttributes = new ConcurrentDictionary<INamedTypeSymbol, bool>();
Microsoft.VisualStudio.LanguageServices (85)
ExtractClass\ExtractClassViewModel.cs (2)
19private readonly INamedTypeSymbol _selectedType; 24INamedTypeSymbol selectedType,
ExtractClass\VisualStudioExtractClassOptionsService.cs (1)
43INamedTypeSymbol selectedType,
Implementation\ContainedLanguageRefactorNotifyService.cs (2)
77else if (symbol is INamedTypeSymbol && (symbol as INamedTypeSymbol).TypeKind == TypeKind.Class)
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (5)
174var symbol = typeListItem.ResolveTypedSymbol(compilation); 233protected abstract Task BuildDelegateDeclarationAsync(INamedTypeSymbol typeSymbol, _VSOBJDESCOPTIONS options, CancellationToken cancellationToken); 234protected abstract Task BuildTypeDeclarationAsync(INamedTypeSymbol typeSymbol, _VSOBJDESCOPTIONS options, CancellationToken cancellationToken); 418if (DocumentationCommentId.GetFirstSymbolForDeclarationId(exceptionType, compilation) is INamedTypeSymbol exceptionTypeSymbol) 443return symbol is INamedTypeSymbol { TypeKind: TypeKind.Delegate }
Library\ObjectBrowser\AbstractListItemFactory.cs (25)
59protected static string GetSimpleDisplayText(INamedTypeSymbol namedTypeSymbol) 88var containingType = memberSymbol.ContainingType; 98protected TypeListItem CreateSimpleTypeListItem(INamedTypeSymbol namedTypeSymbol, ProjectId projectId, bool hidden) 111protected TypeListItem CreateFullyQualifiedTypeListItem(INamedTypeSymbol namedTypeSymbol, ProjectId projectId, bool hidden) 205private ImmutableArray<ObjectListItem> GetBaseTypeListItems(INamedTypeSymbol namedTypeSymbol, Compilation compilation, ProjectId projectId) 213var symbolBuilder = ImmutableArray.CreateBuilder<INamedTypeSymbol>(); 221foreach (var interfaceSymbol in namedTypeSymbol.Interfaces) 240var typeSymbol = parentTypeItem.ResolveTypedSymbol(compilation); 264var typeSymbol = parentTypeItem.ResolveTypedSymbol(compilation); 291INamedTypeSymbol namedTypeSymbol, 316private static ImmutableArray<ISymbol> GetMemberSymbols(INamedTypeSymbol namedTypeSymbol, Compilation compilation) 332private static ImmutableArray<ISymbol> GetInheritedMemberSymbols(INamedTypeSymbol namedTypeSymbol, Compilation compilation) 374private static void AddOverriddenMembers(INamedTypeSymbol namedTypeSymbol, ref HashSet<ISymbol> overriddenMembers) 400var typeSymbol = parentTypeItem.ResolveTypedSymbol(compilation); 537foreach (var typeMember in namespaceOrTypeSymbol.GetTypeMembers()) 548private static ImmutableArray<INamedTypeSymbol> GetAccessibleTypeMembers(INamespaceOrTypeSymbol namespaceOrTypeSymbol, IAssemblySymbol assemblySymbol) 551var builder = ImmutableArray.CreateBuilder<INamedTypeSymbol>(typeMembers.Length); 553foreach (var typeMember in typeMembers) 564private static bool IncludeTypeMember(INamedTypeSymbol typeMember, IAssemblySymbol assemblySymbol) 663private static ImmutableArray<INamedTypeSymbol> GetAccessibleTypes(INamespaceSymbol namespaceSymbol, Compilation compilation) 666var builder = ImmutableArray.CreateBuilder<INamedTypeSymbol>(typeMembers.Length); 667using var _ = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var stack); 669foreach (var typeMember in typeMembers) 677foreach (var nestedTypeMember in GetAccessibleTypeMembers(typeSymbol, compilation.Assembly)) 787foreach (var type in types)
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
438return this.LibraryService.NavInfoFactory.CreateForType((INamedTypeSymbol)symbol, project, compilation, useExpandedHierarchy);
Library\ObjectBrowser\Lists\TypeListItem.cs (2)
11internal class TypeListItem : SymbolListItem<INamedTypeSymbol> 13internal TypeListItem(ProjectId projectId, INamedTypeSymbol typeSymbol, string displayText, string fullNameText, string searchText, bool isHidden)
Library\ObjectBrowser\ObjectList.cs (1)
432var typeSymbol = typeListItem.ResolveTypedSymbol(compilation);
Library\VsNavInfo\NavInfoFactory.cs (1)
79typeSymbol = ((INamedTypeSymbol)typeSymbol).TypeArguments[0];
MoveStaticMembers\TypeNameItem.cs (2)
14public INamedTypeSymbol? NamedType { get; } 20public TypeNameItem(bool isFromHistory, string declarationFile, INamedTypeSymbol type)
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (8)
39public readonly LinkedList<INamedTypeSymbol> History = new(); 41public MoveStaticMembersOptions GetMoveMembersToTypeOptions(Document document, INamedTypeSymbol selectedType, ImmutableArray<ISymbol> selectedNodeSymbols) 89INamedTypeSymbol selectedType, 91LinkedList<INamedTypeSymbol> history, 161INamedTypeSymbol currentType, 163LinkedList<INamedTypeSymbol> history, 184private static bool IsValidTypeToMoveBetween(INamedTypeSymbol destinationType, INamedTypeSymbol sourceType)
Progression\GraphBuilder.cs (4)
272node = await GetOrCreateNodeForNamedTypeAsync(graph, (INamedTypeSymbol)symbol, solution, cancellationToken).ConfigureAwait(false); 358var typeSymbol = (INamedTypeSymbol)symbol; 564private static async Task<GraphNode> GetOrCreateNodeForNamedTypeAsync(Graph graph, INamedTypeSymbol namedType, Solution solution, CancellationToken cancellationToken)
Progression\GraphNodeIdCreation.cs (2)
127else if (symbol is INamedTypeSymbol namedType) 153private static async Task<GraphNodeId> GetPartialForNamedTypeAsync(INamedTypeSymbol namedType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false)
Progression\GraphQueries\ImplementedByGraphQuery.cs (1)
28if (symbol is INamedTypeSymbol or
Progression\GraphQueries\ImplementsGraphQuery.cs (1)
29if (symbol is INamedTypeSymbol namedType)
Progression\GraphQueries\InheritedByGraphQuery.cs (1)
26if (symbol is not INamedTypeSymbol namedType)
Progression\GraphQueries\InheritsGraphQuery.cs (2)
32if (symbol is INamedTypeSymbol namedType) 43foreach (var baseNode in namedType.OriginalDefinition.AllInterfaces.Distinct())
Progression\SymbolContainment.cs (1)
70if (symbol is INamedTypeSymbol namedType)
ProjectSystem\AbstractEntryPointFinder.cs (2)
13protected readonly HashSet<INamedTypeSymbol> EntryPoints = []; 25public override void VisitNamedType(INamedTypeSymbol symbol)
ProjectSystem\AbstractEntryPointFinderService.cs (2)
12protected abstract IEnumerable<INamedTypeSymbol> FindEntryPoints(Compilation compilation, bool findFormsOnly); 14public IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol, bool findFormsOnly)
ProjectSystem\IEntryPointFinderService.cs (1)
21IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol, bool findFormsOnly);
PullMemberUp\MainDialog\BaseTypeTreeNodeViewModel.cs (4)
22internal class BaseTypeTreeNodeViewModel : SymbolViewModel<INamedTypeSymbol> 36private BaseTypeTreeNodeViewModel(INamedTypeSymbol node, IGlyphService glyphService) : base(node, glyphService) 46INamedTypeSymbol root, 55var currentTypeSymbol = currentTreeNode.Symbol;
PullMemberUp\VisualStudioPullMemberUpService.cs (1)
43var containingType = selectedMembers[0].ContainingType;
Venus\ContainedLanguageCodeSupport.cs (13)
47var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 60var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 91var type = compilation.GetTypeByMetadataName(className); 109var methods = type.GetMembers().OfType<IMethodSymbol>().Where(m => m.CompatibleSignatureToDelegate((INamedTypeSymbol)eventType)); 159var type = thisCompilation.GetTypeByMetadataName(className); 178if (eventType.Kind != SymbolKind.NamedType || ((INamedTypeSymbol)eventType).DelegateInvokeMethod == null) 189var invokeMethod = ((INamedTypeSymbol)eventType).DelegateInvokeMethod; 261var type = thisDocument.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 294var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(className); 423var type = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GetTypeByMetadataName(typeName); 462internal static ISymbol LookupMemberId(INamedTypeSymbol type, string uniqueMemberID) 479Document document, string objectTypeName, string nameOfEvent, INamedTypeSymbol type, CancellationToken cancellationToken) 484var objectType = compilation.GetTypeByMetadataName(objectTypeName);
Microsoft.VisualStudio.LanguageServices.CSharp (21)
CodeModel\CSharpCodeModelService.cs (3)
2059public override EnvDTE80.vsCMClassKind GetClassKind(SyntaxNode typeNode, INamedTypeSymbol typeSymbol) 2155public override EnvDTE80.vsCMDataTypeKind GetDataTypeKind(SyntaxNode typeNode, INamedTypeSymbol symbol) 2218public override EnvDTE80.vsCMInheritanceKind GetInheritanceKind(SyntaxNode typeNode, INamedTypeSymbol typeSymbol)
CodeModel\CSharpCodeModelService_Prototype.cs (9)
39var namedType = (INamedTypeSymbol)symbol; 42return GetDelegatePrototype((INamedTypeSymbol)symbol, flags); 64return GetDelegatePrototype(delegateDeclaration, (INamedTypeSymbol)symbol, flags); 75private string GetDelegatePrototype(INamedTypeSymbol symbol, PrototypeFlags flags) 97private string GetDelegatePrototype(DelegateDeclarationSyntax node, INamedTypeSymbol symbol, PrototypeFlags flags) 304private void AppendDelegatePrototype(StringBuilder builder, INamedTypeSymbol symbol, PrototypeFlags flags, string baseName) 587var namedType = (INamedTypeSymbol)current;
ObjectBrowser\DescriptionBuilder.cs (6)
31INamedTypeSymbol typeSymbol, _VSOBJDESCOPTIONS options, CancellationToken cancellationToken) 62INamedTypeSymbol typeSymbol, _VSOBJDESCOPTIONS options, CancellationToken cancellationToken) 96var underlyingType = typeSymbol.EnumUnderlyingType; 108var baseType = typeSymbol.BaseType; 161private void BuildTypeModifiers(INamedTypeSymbol typeSymbol) 318private async Task BuildGenericConstraintsAsync(INamedTypeSymbol typeSymbol, CancellationToken cancellationToken)
Progression\CSharpProgressionLanguageService.cs (1)
121case INamedTypeSymbol n: return n.IsDelegateType() ? n.DelegateInvokeMethod.ReturnType : null;
ProjectSystemShim\CSharpEntryPointFinder.cs (1)
17public static IEnumerable<INamedTypeSymbol> FindEntryPoints(Compilation compilation)
ProjectSystemShim\CSharpEntryPointFinderService.cs (1)
19protected override IEnumerable<INamedTypeSymbol> FindEntryPoints(Compilation compilation, bool findFormsOnly)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (8)
GlyphExtensionsTests.cs (7)
71pointedAtType: (INamedTypeSymbol)CreateSymbolMock(SymbolKind.NamedType, typeKind: TypeKind.Class)); 80containingType: (INamedTypeSymbol)CreateSymbolMock(SymbolKind.NamedType, typeKind: TypeKind.Enum)); 100elementType: (INamedTypeSymbol)CreateSymbolMock(SymbolKind.NamedType, typeKind: TypeKind.Class)); 105target: (INamedTypeSymbol)CreateSymbolMock(SymbolKind.NamedType, typeKind: TypeKind.Class)); 181INamedTypeSymbol containingType = null, 198INamedTypeSymbol containingType = null, 233var namedTypeMock = symbolMock.As<INamedTypeSymbol>();
ProjectSystemShim\EntryPointFinderTests.cs (1)
35private static void Validate(string signature, Action<IEnumerable<INamedTypeSymbol>> validate)
Microsoft.VisualStudio.LanguageServices.UnitTests (4)
CommonControls\NewTypeDestinationSelectionViewModelTests.vb (1)
238Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
ExtractInterface\ExtractInterfaceViewModelTests.vb (1)
301Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
MoveStaticMembers\MoveStaticMembersViewModelTest.vb (1)
41New LinkedList(Of INamedTypeSymbol),
Progression\GraphNodeIdTests.vb (1)
130Function(s) DirectCast(s, INamedTypeSymbol).BaseType)
Microsoft.VisualStudio.LanguageServices.VisualBasic (18)
CodeModel\Extenders\GenericExtender.vb (2)
32Dim typeSymbol = CType(_codeType.Value.LookupTypeSymbol(), INamedTypeSymbol) 60Dim typeSymbol = CType(_codeType.Value.LookupTypeSymbol(), INamedTypeSymbol)
CodeModel\VisualBasicCodeModelService.vb (5)
2144Public Overrides Function GetClassKind(typeNode As SyntaxNode, typeSymbol As INamedTypeSymbol) As EnvDTE80.vsCMClassKind 2358Public Overrides Function GetDataTypeKind(typeNode As SyntaxNode, symbol As INamedTypeSymbol) As EnvDTE80.vsCMDataTypeKind 2571Public Overrides Function GetInheritanceKind(typeNode As SyntaxNode, typeSymbol As INamedTypeSymbol) As EnvDTE80.vsCMInheritanceKind 2907(symbol.Kind = SymbolKind.NamedType AndAlso DirectCast(symbol, INamedTypeSymbol).TypeKind = TypeKind.Module) OrElse 3115Dim namedTypeSymbol = TryCast(typeSymbol, INamedTypeSymbol)
CodeModel\VisualBasicCodeModelService_Prototype.vb (2)
44Dim namedTypeSymbol = DirectCast(symbol, INamedTypeSymbol) 50Dim eventType = TryCast(eventSymbol.Type, INamedTypeSymbol)
Help\VisualBasicHelpContextService.vb (2)
105If Not isContainingType AndAlso TypeOf symbol Is INamedTypeSymbol Then 106Dim type = DirectCast(symbol, INamedTypeSymbol)
ObjectBrowser\DescriptionBuilder.vb (4)
30typeSymbol As INamedTypeSymbol, 68typeSymbol As INamedTypeSymbol, 304Dim delegateInvokeMethod = CType(eventType, INamedTypeSymbol).DelegateInvokeMethod 332Private Sub BuildTypeModifiers(typeSymbol As INamedTypeSymbol)
ProjectSystemShim\VisualBasicEntryPointFinder.vb (2)
27Public Shared Function FindEntryPoints(compilation As Compilation, findFormsOnly As Boolean) As IEnumerable(Of INamedTypeSymbol) 41Public Overrides Sub VisitNamedType(symbol As INamedTypeSymbol)
ProjectSystemShim\VisualBasicEntryPointFinderService.vb (1)
20Protected Overrides Function FindEntryPoints(compilation As Compilation, findFormsOnly As Boolean) As IEnumerable(Of INamedTypeSymbol)
Mvc.Analyzers.Test (61)
CodeAnalysisExtensionsTest.cs (52)
25var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 26var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 53var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 54var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 90var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 91var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 127var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 128var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 164var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 165var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 209var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 210var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 252var attribute = compilation.GetTypeByMetadataName(typeof(ProducesResponseTypeAttribute).FullName); 253var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 279var attribute = compilation.GetTypeByMetadataName(typeof(ApiConventionTypeAttribute).FullName); 280var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 306var attribute = compilation.GetTypeByMetadataName(typeof(ApiConventionTypeAttribute).FullName); 307var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 349var attribute = compilation.GetTypeByMetadataName(typeof(ApiConventionTypeAttribute).FullName); 350var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 397var attribute = compilation.GetTypeByMetadataName(typeof(ApiConventionTypeAttribute).FullName); 398var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 435var attribute = compilation.GetTypeByMetadataName(typeof(ApiConventionTypeAttribute).FullName); 436var testClass = compilation.GetTypeByMetadataName("TestApp.TestClass"); 473var attribute = compilation.GetTypeByMetadataName("TestApp.HasAttribute_ReturnsFalseIfTypeDoesNotHaveAttribute"); 474var testClass = compilation.GetTypeByMetadataName("TestApp.HasAttribute_ReturnsFalseIfTypeDoesNotHaveAttributeTest"); 503var attribute = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.ControllerAttribute"); 504var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 529var attribute = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.ControllerAttribute"); 530var testClass = compilation.GetTypeByMetadataName($"TestApp.TestController"); 560var @interface = compilation.GetTypeByMetadataName("TestApp.ITestInterface"); 561var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 590var attribute = compilation.GetTypeByMetadataName("TestApp.TestAttribute"); 591var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 624var attribute = compilation.GetTypeByMetadataName("TestApp.TestAttribute"); 625var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 655var attribute = compilation.GetTypeByMetadataName("TestApp.TestAttribute"); 656var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 689var attribute = compilation.GetTypeByMetadataName("TestApp.TestAttribute"); 690var testClass = compilation.GetTypeByMetadataName("TestApp.TestController"); 715var sourceType = compilation.GetTypeByMetadataName("TestApp.TypeA"); 716var target = compilation.GetTypeByMetadataName("TestApp.TypeB"); 736var sourceType = compilation.GetTypeByMetadataName("TestApp.TypeA"); 737var target = compilation.GetTypeByMetadataName("System.IDisposable"); 757var sourceType = compilation.GetTypeByMetadataName("TestApp.TestType"); 758var target = compilation.GetTypeByMetadataName("TestApp.TestType"); 782var sourceType = compilation.GetTypeByMetadataName("TestApp.ITestInterface"); 783var target = compilation.GetTypeByMetadataName("TestApp.TestType"); 805var sourceType = compilation.GetTypeByMetadataName("TestApp.ITestInterface"); 806var target = compilation.GetTypeByMetadataName("TestApp.ITestInterface"); 838var sourceType = compilation.GetTypeByMetadataName("TestApp.ITestInterface"); 839var target = compilation.GetTypeByMetadataName("TestApp.TestClass");
TopLevelParameterNameAnalyzerTest.cs (9)
320var modelType = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzerTestFiles.TestController"); 410var modelType = compilation.Assembly.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzerTestFiles.TestController"); 435var type = compilation.GetTypeByMetadataName("TestApp.GetNameTests"); 460var type = compilation.GetTypeByMetadataName("TestApp.GetNameTests"); 484var type = compilation.GetTypeByMetadataName("TestApp.GetNameTests"); 508var type = compilation.GetTypeByMetadataName("TestApp.GetNameTests"); 532var type = compilation.GetTypeByMetadataName("TestApp.SpecifiesModelTypeTests"); 555var type = compilation.GetTypeByMetadataName("TestApp.SpecifiesModelTypeTests"); 578var type = compilation.GetTypeByMetadataName("TestApp.SpecifiesModelTypeTests");
Mvc.Api.Analyzers.Test (64)
ActualApiResponseMetadataFactoryTest.cs (4)
73var returnType = compilation.GetTypeByMetadataName($"{Namespace}.TestController"); 369var type = compilation.GetTypeByMetadataName(typeName); 390var controllerType = compilation.GetTypeByMetadataName(controllerTypeName); 409var returnType = compilation.GetTypeByMetadataName($"{Namespace}.{test}");
ApiControllerFactsTest.cs (5)
52var type = compilation.GetTypeByMetadataName(typeof(ApiConventionAnalyzerTest_IndexModel).FullName); 68var type = compilation.GetTypeByMetadataName(typeof(ApiConventionAnalyzerTest_NotApiController).FullName); 84var type = compilation.GetTypeByMetadataName(typeof(ApiConventionAnalyzerTest_NotAction).FullName); 100var type = compilation.GetTypeByMetadataName(typeof(ApiConventionAnalyzerTest_Valid).FullName); 116var type = compilation.GetTypeByMetadataName(typeof(IsApiControllerAction_ReturnsTrue_IfAttributeIsDeclaredOnAssemblyController).FullName);
DeclaredApiResponseMetadataTest.cs (1)
155protected override INamedTypeSymbol CommonAttributeClass => throw new System.NotImplementedException();
MvcFactsTest.cs (13)
66var controllerAttribute = compilation.GetTypeByMetadataName(ControllerAttribute); 67var nonControllerAttribute = compilation.GetTypeByMetadataName(NonControllerAttribute); 68var typeSymbol = compilation.GetTypeByMetadataName(type.FullName); 80var controllerAttribute = compilation.GetTypeByMetadataName(ControllerAttribute); 81var nonControllerAttribute = compilation.GetTypeByMetadataName(NonControllerAttribute); 82var typeSymbol = compilation.GetTypeByMetadataName(type.FullName); 150var nonActionAttribute = compilation.GetTypeByMetadataName(NonActionAttribute); 152var typeSymbol = compilation.GetTypeByMetadataName(type.FullName); 182var nonActionAttribute = compilation.GetTypeByMetadataName(NonActionAttribute); 184var typeSymbol = compilation.GetTypeByMetadataName(typeof(NotDisposableWithDisposeThatIsNotInterfaceContract).FullName); 197var nonActionAttribute = compilation.GetTypeByMetadataName(NonActionAttribute); 199var typeSymbol = compilation.GetTypeByMetadataName(type.FullName); 211var type = compilation.GetSpecialType(SpecialType.System_IDisposable);
SymbolApiConventionMatcherTest.cs (18)
274var typeSymbol = compilation.GetTypeByMetadataName(type.FullName); 275var conventionTypeSymbol = compilation.GetTypeByMetadataName(conventionType.FullName); 290var type = compilation.GetTypeByMetadataName(BaseTypeName); 291var conventionType = compilation.GetTypeByMetadataName(BaseTypeName); 306var type = compilation.GetTypeByMetadataName(DerivedTypeName); 307var conventionType = compilation.GetTypeByMetadataName(BaseTypeName); 322var type = compilation.GetTypeByMetadataName(BaseTypeName); 323var conventionType = compilation.GetTypeByMetadataName(DerivedTypeName); 338var type = compilation.GetSpecialType(SpecialType.System_String); 339var conventionType = compilation.GetTypeByMetadataName(BaseTypeName); 430var testController = compilation.GetTypeByMetadataName(TestControllerName); 431var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 450var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 468var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 486var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 504var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 523var testConvention = compilation.GetTypeByMetadataName(TestConventionName); 542var testConvention = compilation.GetTypeByMetadataName(TestConventionName);
SymbolApiResponseMetadataProviderTest.cs (23)
18var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerWithoutConvention)}"); 36var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerWithoutConvention)}"); 54var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 72var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 95var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 118var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 141var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 164var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 186var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 217var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 239var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 272var controller = compilation.GetTypeByMetadataName($"{Namespace}.{typeName}"); 295var controller = compilation.GetTypeByMetadataName(type.FullName); 317var controller = compilation.GetTypeByMetadataName(type.FullName); 391var controller = compilation.GetTypeByMetadataName($"{Namespace}.{nameof(GetResponseMetadata_ControllerActionWithAttributes)}"); 405var expected = compilation.GetTypeByMetadataName(typeof(ProblemDetails).FullName); 407var type = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsProblemDetails_IfNoAttributeIsDiscoveredController).FullName); 423var expected = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtAssemblyModel).FullName); 425var type = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtAssemblyController).FullName); 441var expected = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtControllerModel).FullName); 443var type = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtControllerController).FullName); 459var expected = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtActionModel).FullName); 461var type = compilation.GetTypeByMetadataName(typeof(GetErrorResponseType_ReturnsTypeDefinedAtActionController).FullName);
SemanticSearch.BuildTask (6)
GenerateFilteredReferenceAssembliesTask.cs (6)
198List<INamedTypeSymbol> types, 210case INamedTypeSymbol type: 250var isIncluded = symbol is not INamedTypeSymbol; 285var types = new List<INamedTypeSymbol>(); 351private static unsafe void UpdateTypeDefinitions(BinaryWriter writer, MetadataReader metadataReader, ImmutableArray<ApiPattern> patterns, ImmutableArray<INamedTypeSymbol> symbols, int metadataOffset) 359var symbol = GetSymbolWithToken(symbols, ref symbolIndex, handle);
System.Private.CoreLib.Generators (72)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (72)
86private static IEnumerable<INamedTypeSymbol> GetNestedTypes(INamedTypeSymbol type) 88foreach (var typeSymbol in type.GetTypeMembers()) 91foreach (var nestedTypeSymbol in GetNestedTypes(typeSymbol)) 98private static IEnumerable<INamedTypeSymbol> GetSubtypes(INamespaceSymbol namespaceSymbol) 100foreach (var typeSymbol in namespaceSymbol.GetTypeMembers()) 103foreach (var nestedTypeSymbol in GetNestedTypes(typeSymbol)) 111foreach (var typeSymbol in GetSubtypes(namespaceMember)) 120public IntrinsicsAnalyzerOnLoadData(HashSet<INamedTypeSymbol> namedTypesToBeProtected, 121INamedTypeSymbol? bypassReadyToRunAttribute, 122INamedTypeSymbol? compExactlyDependsOn) 128public readonly HashSet<INamedTypeSymbol> NamedTypesToBeProtected; 129public readonly INamedTypeSymbol? BypassReadyToRunAttribute; 130public readonly INamedTypeSymbol? CompExactlyDependsOn; 139HashSet<INamedTypeSymbol> namedTypesToBeProtected = new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default); 141INamedTypeSymbol? bypassReadyToRunAttribute = context.Compilation.Assembly.GetTypeByMetadataName("System.Runtime.BypassReadyToRunAttribute"); 142INamedTypeSymbol? compExactlyDependsOn = context.Compilation.Assembly.GetTypeByMetadataName("System.Runtime.CompilerServices.CompExactlyDependsOnAttribute"); 150foreach (var typeSymbol in GetSubtypes(architectureSpecificNamespace)) 198private static INamedTypeSymbol? GetIsSupportedTypeSymbol(SemanticModel model, MemberAccessExpressionSyntax memberAccessExpression) 203return symbolInfo.Symbol.ContainingSymbol as INamedTypeSymbol; 211private static INamedTypeSymbol? GetIsSupportedTypeSymbol(SemanticModel model, IdentifierNameSyntax identifierName) 216return symbolInfo.Symbol.ContainingSymbol as INamedTypeSymbol; 221private static INamedTypeSymbol[] GatherAndConditions(SemanticModel model, ExpressionSyntax expressionToDecompose) 230var isSupportedType = GetIsSupportedTypeSymbol(model, memberAccessExpression); 233return Array.Empty<INamedTypeSymbol>(); 236return new INamedTypeSymbol[] { isSupportedType }; 240var isSupportedType = GetIsSupportedTypeSymbol(model, identifier); 243return Array.Empty<INamedTypeSymbol>(); 246return new INamedTypeSymbol[] { isSupportedType }; 258var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length]; 265return Array.Empty<INamedTypeSymbol>(); 270return Array.Empty<INamedTypeSymbol>(); 273private static INamedTypeSymbol[][] DecomposePropertySymbolForIsSupportedGroups_Property(OperationAnalysisContext context, SemanticModel model, ExpressionSyntax expressionToDecompose) 278return Array.Empty<INamedTypeSymbol[]>(); 283var typeSymbol = symbolInfo.Symbol.ContainingSymbol as INamedTypeSymbol; 286return new INamedTypeSymbol[][] { new INamedTypeSymbol[] { typeSymbol } }; 306return Array.Empty<INamedTypeSymbol[]>(); 309private static INamedTypeSymbol[][] DecomposeConditionForIsSupportedGroups(OperationAnalysisContext context, SemanticModel model, ExpressionSyntax expressionToDecompose) 335return new INamedTypeSymbol[][] { GatherAndConditions(model, binaryExpression) }; 345return Array.Empty<INamedTypeSymbol[]>(); 347var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length][]; 376return Array.Empty<INamedTypeSymbol[]>(); 379private static IEnumerable<INamedTypeSymbol> GetCompExactlyDependsOnUseList(ISymbol symbol, IntrinsicsAnalyzerOnLoadData onLoadData) 381var compExactlyDependsOn = onLoadData.CompExactlyDependsOn; 388if (attributeData.ConstructorArguments[0].Value is INamedTypeSymbol attributeTypeSymbol) 397private static bool ConditionAllowsSymbol(ISymbol symbolOfInvokeTarget, INamedTypeSymbol namedTypeThatIsSafeToUse, IntrinsicsAnalyzerOnLoadData onLoadData) 399HashSet<INamedTypeSymbol> examinedSymbols = new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default); 400Stack<INamedTypeSymbol> symbolsToExamine = new Stack<INamedTypeSymbol>(); 405INamedTypeSymbol symbol = symbolsToExamine.Pop(); 409foreach (var helperForType in GetCompExactlyDependsOnUseList(symbolOfInvokeTarget, onLoadData)) 425private static bool TypeSymbolAllowsTypeSymbol(INamedTypeSymbol namedTypeToCheckForSupport, INamedTypeSymbol namedTypeThatProvidesSupport) 427HashSet<INamedTypeSymbol> examinedSymbols = new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default); 428Stack<INamedTypeSymbol> symbolsToExamine = new Stack<INamedTypeSymbol>(); 433INamedTypeSymbol symbol = symbolsToExamine.Pop(); 487var compExactlyDependsOn = onLoadData.CompExactlyDependsOn; 521if (attributeData.ConstructorArguments[0].Value is INamedTypeSymbol attributeTypeSymbol) 555foreach (var attributeTypeSymbol in GetCompExactlyDependsOnUseList(symbolThatMightHaveCompExactlyDependsOnAttribute, onLoadData)) 568HashSet<INamedTypeSymbol> notTypes = new HashSet<INamedTypeSymbol>(SymbolEqualityComparer.Default); 609foreach (var symbolInOrClause in andClause) 624foreach (var symbolInAndClause in decomposedCondition[andClauseIndex]) 626foreach (var notType in notTypes) 652foreach (var symbolFromCondition in andClause) 672foreach (var symbolFromCondition in decomposedCondition[0])
System.Text.Json.SourceGeneration (222)
Helpers\KnownTypeSymbols.cs (159)
25public INamedTypeSymbol? IListOfTType => GetOrResolveType(typeof(IList<>), ref _IListOfTType); 26private Option<INamedTypeSymbol?> _IListOfTType; 28public INamedTypeSymbol? ICollectionOfTType => GetOrResolveType(typeof(ICollection<>), ref _ICollectionOfTType); 29private Option<INamedTypeSymbol?> _ICollectionOfTType; 31public INamedTypeSymbol? IEnumerableType => GetOrResolveType(typeof(IEnumerable), ref _IEnumerableType); 32private Option<INamedTypeSymbol?> _IEnumerableType; 34public INamedTypeSymbol? IEnumerableOfTType => GetOrResolveType(typeof(IEnumerable<>), ref _IEnumerableOfTType); 35private Option<INamedTypeSymbol?> _IEnumerableOfTType; 37public INamedTypeSymbol? ListOfTType => GetOrResolveType(typeof(List<>), ref _ListOfTType); 38private Option<INamedTypeSymbol?> _ListOfTType; 40public INamedTypeSymbol? DictionaryOfTKeyTValueType => GetOrResolveType(typeof(Dictionary<,>), ref _DictionaryOfTKeyTValueType); 41private Option<INamedTypeSymbol?> _DictionaryOfTKeyTValueType; 43public INamedTypeSymbol? IAsyncEnumerableOfTType => GetOrResolveType("System.Collections.Generic.IAsyncEnumerable`1", ref _AsyncEnumerableOfTType); 44private Option<INamedTypeSymbol?> _AsyncEnumerableOfTType; 46public INamedTypeSymbol? IDictionaryOfTKeyTValueType => GetOrResolveType(typeof(IDictionary<,>), ref _IDictionaryOfTKeyTValueType); 47private Option<INamedTypeSymbol?> _IDictionaryOfTKeyTValueType; 49public INamedTypeSymbol? IReadonlyDictionaryOfTKeyTValueType => GetOrResolveType(typeof(IReadOnlyDictionary<,>), ref _IReadonlyDictionaryOfTKeyTValueType); 50private Option<INamedTypeSymbol?> _IReadonlyDictionaryOfTKeyTValueType; 52public INamedTypeSymbol? ISetOfTType => GetOrResolveType(typeof(ISet<>), ref _ISetOfTType); 53private Option<INamedTypeSymbol?> _ISetOfTType; 55public INamedTypeSymbol? StackOfTType => GetOrResolveType(typeof(Stack<>), ref _StackOfTType); 56private Option<INamedTypeSymbol?> _StackOfTType; 58public INamedTypeSymbol? QueueOfTType => GetOrResolveType(typeof(Queue<>), ref _QueueOfTType); 59private Option<INamedTypeSymbol?> _QueueOfTType; 61public INamedTypeSymbol? ConcurrentStackType => GetOrResolveType(typeof(ConcurrentStack<>), ref _ConcurrentStackType); 62private Option<INamedTypeSymbol?> _ConcurrentStackType; 64public INamedTypeSymbol? ConcurrentQueueType => GetOrResolveType(typeof(ConcurrentQueue<>), ref _ConcurrentQueueType); 65private Option<INamedTypeSymbol?> _ConcurrentQueueType; 67public INamedTypeSymbol? IDictionaryType => GetOrResolveType(typeof(IDictionary), ref _IDictionaryType); 68private Option<INamedTypeSymbol?> _IDictionaryType; 70public INamedTypeSymbol? IListType => GetOrResolveType(typeof(IList), ref _IListType); 71private Option<INamedTypeSymbol?> _IListType; 73public INamedTypeSymbol? StackType => GetOrResolveType(typeof(Stack), ref _StackType); 74private Option<INamedTypeSymbol?> _StackType; 76public INamedTypeSymbol? QueueType => GetOrResolveType(typeof(Queue), ref _QueueType); 77private Option<INamedTypeSymbol?> _QueueType; 79public INamedTypeSymbol? KeyValuePair => GetOrResolveType(typeof(KeyValuePair<,>), ref _KeyValuePair); 80private Option<INamedTypeSymbol?> _KeyValuePair; 82public INamedTypeSymbol? ImmutableArrayType => GetOrResolveType(typeof(ImmutableArray<>), ref _ImmutableArrayType); 83private Option<INamedTypeSymbol?> _ImmutableArrayType; 85public INamedTypeSymbol? ImmutableListType => GetOrResolveType(typeof(ImmutableList<>), ref _ImmutableListType); 86private Option<INamedTypeSymbol?> _ImmutableListType; 88public INamedTypeSymbol? IImmutableListType => GetOrResolveType(typeof(IImmutableList<>), ref _IImmutableListType); 89private Option<INamedTypeSymbol?> _IImmutableListType; 91public INamedTypeSymbol? ImmutableStackType => GetOrResolveType(typeof(ImmutableStack<>), ref _ImmutableStackType); 92private Option<INamedTypeSymbol?> _ImmutableStackType; 94public INamedTypeSymbol? IImmutableStackType => GetOrResolveType(typeof(IImmutableStack<>), ref _IImmutableStackType); 95private Option<INamedTypeSymbol?> _IImmutableStackType; 97public INamedTypeSymbol? ImmutableQueueType => GetOrResolveType(typeof(ImmutableQueue<>), ref _ImmutableQueueType); 98private Option<INamedTypeSymbol?> _ImmutableQueueType; 100public INamedTypeSymbol? IImmutableQueueType => GetOrResolveType(typeof(IImmutableQueue<>), ref _IImmutableQueueType); 101private Option<INamedTypeSymbol?> _IImmutableQueueType; 103public INamedTypeSymbol? ImmutableSortedType => GetOrResolveType(typeof(ImmutableSortedSet<>), ref _ImmutableSortedType); 104private Option<INamedTypeSymbol?> _ImmutableSortedType; 106public INamedTypeSymbol? ImmutableHashSetType => GetOrResolveType(typeof(ImmutableHashSet<>), ref _ImmutableHashSetType); 107private Option<INamedTypeSymbol?> _ImmutableHashSetType; 109public INamedTypeSymbol? IImmutableSetType => GetOrResolveType(typeof(IImmutableSet<>), ref _IImmutableSetType); 110private Option<INamedTypeSymbol?> _IImmutableSetType; 112public INamedTypeSymbol? ImmutableDictionaryType => GetOrResolveType(typeof(ImmutableDictionary<,>), ref _ImmutableDictionaryType); 113private Option<INamedTypeSymbol?> _ImmutableDictionaryType; 115public INamedTypeSymbol? ImmutableSortedDictionaryType => GetOrResolveType(typeof(ImmutableSortedDictionary<,>), ref _ImmutableSortedDictionaryType); 116private Option<INamedTypeSymbol?> _ImmutableSortedDictionaryType; 118public INamedTypeSymbol? IImmutableDictionaryType => GetOrResolveType(typeof(IImmutableDictionary<,>), ref _IImmutableDictionaryType); 119private Option<INamedTypeSymbol?> _IImmutableDictionaryType; 121public INamedTypeSymbol? KeyedCollectionType => GetOrResolveType(typeof(KeyedCollection<,>), ref _KeyedCollectionType); 122private Option<INamedTypeSymbol?> _KeyedCollectionType; 124public INamedTypeSymbol ObjectType => _ObjectType ??= Compilation.GetSpecialType(SpecialType.System_Object); 125private INamedTypeSymbol? _ObjectType; 127public INamedTypeSymbol StringType => _StringType ??= Compilation.GetSpecialType(SpecialType.System_String); 128private INamedTypeSymbol? _StringType; 130public INamedTypeSymbol? DateTimeOffsetType => GetOrResolveType(typeof(DateTimeOffset), ref _DateTimeOffsetType); 131private Option<INamedTypeSymbol?> _DateTimeOffsetType; 133public INamedTypeSymbol? TimeSpanType => GetOrResolveType(typeof(TimeSpan), ref _TimeSpanType); 134private Option<INamedTypeSymbol?> _TimeSpanType; 136public INamedTypeSymbol? DateOnlyType => GetOrResolveType("System.DateOnly", ref _DateOnlyType); 137private Option<INamedTypeSymbol?> _DateOnlyType; 139public INamedTypeSymbol? TimeOnlyType => GetOrResolveType("System.TimeOnly", ref _TimeOnlyType); 140private Option<INamedTypeSymbol?> _TimeOnlyType; 142public INamedTypeSymbol? Int128Type => GetOrResolveType("System.Int128", ref _Int128Type); 143private Option<INamedTypeSymbol?> _Int128Type; 145public INamedTypeSymbol? UInt128Type => GetOrResolveType("System.UInt128", ref _UInt128Type); 146private Option<INamedTypeSymbol?> _UInt128Type; 148public INamedTypeSymbol? HalfType => GetOrResolveType("System.Half", ref _HalfType); 149private Option<INamedTypeSymbol?> _HalfType; 157public INamedTypeSymbol? MemoryByteType => _MemoryByteType.HasValue 161private Option<INamedTypeSymbol?> _MemoryByteType; 163public INamedTypeSymbol? ReadOnlyMemoryByteType => _ReadOnlyMemoryByteType.HasValue 167private Option<INamedTypeSymbol?> _ReadOnlyMemoryByteType; 169public INamedTypeSymbol? GuidType => GetOrResolveType(typeof(Guid), ref _GuidType); 170private Option<INamedTypeSymbol?> _GuidType; 172public INamedTypeSymbol? UriType => GetOrResolveType(typeof(Uri), ref _UriType); 173private Option<INamedTypeSymbol?> _UriType; 175public INamedTypeSymbol? VersionType => GetOrResolveType(typeof(Version), ref _VersionType); 176private Option<INamedTypeSymbol?> _VersionType; 179public INamedTypeSymbol? JsonConverterType => GetOrResolveType("System.Text.Json.Serialization.JsonConverter", ref _JsonConverterType); 180private Option<INamedTypeSymbol?> _JsonConverterType; 182public INamedTypeSymbol? JsonSerializerContextType => GetOrResolveType("System.Text.Json.Serialization.JsonSerializerContext", ref _JsonSerializerContextType); 183private Option<INamedTypeSymbol?> _JsonSerializerContextType; 185public INamedTypeSymbol? JsonSerializableAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonSerializableAttribute", ref _JsonSerializableAttributeType); 186private Option<INamedTypeSymbol?> _JsonSerializableAttributeType; 188public INamedTypeSymbol? JsonDocumentType => GetOrResolveType("System.Text.Json.JsonDocument", ref _JsonDocumentType); 189private Option<INamedTypeSymbol?> _JsonDocumentType; 191public INamedTypeSymbol? JsonElementType => GetOrResolveType("System.Text.Json.JsonElement", ref _JsonElementType); 192private Option<INamedTypeSymbol?> _JsonElementType; 194public INamedTypeSymbol? JsonNodeType => GetOrResolveType("System.Text.Json.Nodes.JsonNode", ref _JsonNodeType); 195private Option<INamedTypeSymbol?> _JsonNodeType; 197public INamedTypeSymbol? JsonValueType => GetOrResolveType("System.Text.Json.Nodes.JsonValue", ref _JsonValueType); 198private Option<INamedTypeSymbol?> _JsonValueType; 200public INamedTypeSymbol? JsonObjectType => GetOrResolveType("System.Text.Json.Nodes.JsonObject", ref _JsonObjectType); 201private Option<INamedTypeSymbol?> _JsonObjectType; 203public INamedTypeSymbol? JsonArrayType => GetOrResolveType("System.Text.Json.Nodes.JsonArray", ref _JsonArrayType); 204private Option<INamedTypeSymbol?> _JsonArrayType; 207public INamedTypeSymbol? JsonConverterAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonConverterAttribute", ref _JsonConverterAttributeType); 208private Option<INamedTypeSymbol?> _JsonConverterAttributeType; 210public INamedTypeSymbol? JsonDerivedTypeAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonDerivedTypeAttribute", ref _JsonDerivedTypeAttributeType); 211private Option<INamedTypeSymbol?> _JsonDerivedTypeAttributeType; 213public INamedTypeSymbol? JsonNumberHandlingAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonNumberHandlingAttribute", ref _JsonNumberHandlingAttributeType); 214private Option<INamedTypeSymbol?> _JsonNumberHandlingAttributeType; 216public INamedTypeSymbol? JsonObjectCreationHandlingAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonObjectCreationHandlingAttribute", ref _JsonObjectCreationHandlingAttributeType); 217private Option<INamedTypeSymbol?> _JsonObjectCreationHandlingAttributeType; 219public INamedTypeSymbol? JsonSourceGenerationOptionsAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonSourceGenerationOptionsAttribute", ref _JsonSourceGenerationOptionsAttributeType); 220private Option<INamedTypeSymbol?> _JsonSourceGenerationOptionsAttributeType; 222public INamedTypeSymbol? JsonUnmappedMemberHandlingAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonUnmappedMemberHandlingAttribute", ref _JsonUnmappedMemberHandlingAttributeType); 223private Option<INamedTypeSymbol?> _JsonUnmappedMemberHandlingAttributeType; 225public INamedTypeSymbol? JsonConstructorAttributeType => GetOrResolveType("System.Text.Json.Serialization.JsonConstructorAttribute", ref _JsonConstructorAttributeType); 226private Option<INamedTypeSymbol?> _JsonConstructorAttributeType; 228public INamedTypeSymbol? SetsRequiredMembersAttributeType => GetOrResolveType("System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute", ref _SetsRequiredMembersAttributeType); 229private Option<INamedTypeSymbol?> _SetsRequiredMembersAttributeType; 231public INamedTypeSymbol? JsonStringEnumConverterType => GetOrResolveType("System.Text.Json.Serialization.JsonStringEnumConverter", ref _JsonStringEnumConverterType); 232private Option<INamedTypeSymbol?> _JsonStringEnumConverterType; 234public INamedTypeSymbol? JsonStringEnumConverterOfTType => GetOrResolveType("System.Text.Json.Serialization.JsonStringEnumConverter`1", ref _JsonStringEnumConverterOfTType); 235private Option<INamedTypeSymbol?> _JsonStringEnumConverterOfTType; 237public INamedTypeSymbol? IJsonOnSerializingType => GetOrResolveType(JsonConstants.IJsonOnSerializingFullName, ref _IJsonOnSerializingType); 238private Option<INamedTypeSymbol?> _IJsonOnSerializingType; 240public INamedTypeSymbol? IJsonOnSerializedType => GetOrResolveType(JsonConstants.IJsonOnSerializedFullName, ref _IJsonOnSerializedType); 241private Option<INamedTypeSymbol?> _IJsonOnSerializedType; 244public INamedTypeSymbol? DelegateType => _DelegateType ??= Compilation.GetSpecialType(SpecialType.System_Delegate); 245private INamedTypeSymbol? _DelegateType; 247public INamedTypeSymbol? MemberInfoType => GetOrResolveType(typeof(MemberInfo), ref _MemberInfoType); 248private Option<INamedTypeSymbol?> _MemberInfoType; 250public INamedTypeSymbol? SerializationInfoType => GetOrResolveType(typeof(Runtime.Serialization.SerializationInfo), ref _SerializationInfoType); 251private Option<INamedTypeSymbol?> _SerializationInfoType; 253public INamedTypeSymbol? IntPtrType => GetOrResolveType(typeof(IntPtr), ref _IntPtrType); 254private Option<INamedTypeSymbol?> _IntPtrType; 256public INamedTypeSymbol? UIntPtrType => GetOrResolveType(typeof(UIntPtr), ref _UIntPtrType); 257private Option<INamedTypeSymbol?> _UIntPtrType; 259public INamedTypeSymbol? MemoryType => GetOrResolveType(typeof(Memory<>), ref _MemoryType); 260private Option<INamedTypeSymbol?> _MemoryType; 262public INamedTypeSymbol? ReadOnlyMemoryType => GetOrResolveType(typeof(ReadOnlyMemory<>), ref _ReadOnlyMemoryType); 263private Option<INamedTypeSymbol?> _ReadOnlyMemoryType; 267if (type is not INamedTypeSymbol { IsGenericType: true, ConstructedFrom: INamedTypeSymbol genericTypeDef }) 320if (type is not INamedTypeSymbol { IsGenericType: true, ConstructedFrom: INamedTypeSymbol genericTypeDef }) 345private INamedTypeSymbol? GetOrResolveType(Type type, ref Option<INamedTypeSymbol?> field) 348private INamedTypeSymbol? GetOrResolveType(string fullyQualifiedName, ref Option<INamedTypeSymbol?> field) 355INamedTypeSymbol? type = Compilation.GetBestTypeByMetadataName(fullyQualifiedName);
Helpers\RoslynExtensions.cs (25)
21public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) 59if (type is INamedTypeSymbol namedType) 82INamedTypeSymbol? containingType = namedType.ContainingType; 86containingType = (INamedTypeSymbol)compilation.EraseCompileTimeMetadata(containingType); 106if (type.IsAbstract || type.TypeKind is TypeKind.Interface || type is not INamedTypeSymbol namedType) 116public static IEnumerable<IMethodSymbol> GetExplicitlyDeclaredInstanceConstructors(this INamedTypeSymbol type) 119public static bool ContainsAttribute(this ISymbol memberInfo, INamedTypeSymbol? attributeType) 140for (INamedTypeSymbol? current = type as INamedTypeSymbol; current != null; current = current.BaseType) 151public static INamedTypeSymbol? GetCompatibleGenericBaseType(this ITypeSymbol type, INamedTypeSymbol? baseType) 162foreach (INamedTypeSymbol interfaceType in type.AllInterfaces) 171for (INamedTypeSymbol? current = type as INamedTypeSymbol; current != null; current = current.BaseType) 181static bool IsMatchingGenericType(INamedTypeSymbol candidate, INamedTypeSymbol baseType) 188=> type is INamedTypeSymbol { IsGenericType: true } namedType && SymbolEqualityComparer.Default.Equals(namedType, namedType.ConstructedFrom); 203if (type.IsValueType && type is INamedTypeSymbol { OriginalDefinition.SpecialType: SpecialType.System_Nullable_T }) 205elementType = ((INamedTypeSymbol)type).TypeArguments[0]; 229public static INamedTypeSymbol[] GetSortedTypeHierarchy(this ITypeSymbol type) 231if (type is not INamedTypeSymbol namedType) 233return Array.Empty<INamedTypeSymbol>(); 238var list = new List<INamedTypeSymbol>(); 239for (INamedTypeSymbol? current = namedType; current != null; current = current.BaseType) 251return JsonHelpers.TraverseGraphWithTopologicalSort<INamedTypeSymbol>(namedType, static t => t.AllInterfaces, SymbolEqualityComparer.Default);
JsonSourceGenerator.Parser.cs (30)
92INamedTypeSymbol? contextTypeSymbol = semanticModel.GetDeclaredSymbol(contextClassDeclaration, cancellationToken); 194INamedTypeSymbol? typeSymbol = semanticModel.GetDeclaredSymbol(currentType, cancellationToken); 230INamedTypeSymbol contextClassSymbol, 242INamedTypeSymbol? attributeClass = attributeData.AttributeClass; 261private SourceGenerationOptionsSpec ParseJsonSourceGenerationOptionsAttribute(INamedTypeSymbol contextType, AttributeData attributeData) 499private TypeGenerationSpec ParseTypeGenerationSpec(in TypeToGenerate typeToGenerate, INamedTypeSymbol contextType, SourceGenerationOptionsSpec? options) 531if (type is { IsRefLikeType: true } or INamedTypeSymbol { IsUnboundGenericType: true } or IErrorTypeSymbol) 559INamedTypeSymbol converterSymbol = _knownSymbols.JsonStringEnumConverterOfTType.Construct(type); 684INamedTypeSymbol contextType, 701INamedTypeSymbol? attributeType = attributeData.AttributeClass; 748INamedTypeSymbol? actualTypeToConvert; 758valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 766valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 772if (type.GetCompatibleGenericBaseType(_knownSymbols.IAsyncEnumerableOfTType) is INamedTypeSymbol iAsyncEnumerableType) 810ImmutableArray<ITypeSymbol> genericArgs = ((INamedTypeSymbol)type).TypeArguments; 831valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 906INamedTypeSymbol? dictionary = _knownSymbols.DictionaryOfTKeyTValueType?.Construct(keyType, valueType); 911INamedTypeSymbol contextType, 923foreach (INamedTypeSymbol currentType in typeToGenerate.Type.GetSortedTypeHierarchy()) 1101INamedTypeSymbol? actualDictionaryType = type.GetCompatibleGenericBaseType(_knownSymbols.IDictionaryOfTKeyTValueType); 1113INamedTypeSymbol contextType, 1230INamedTypeSymbol contextType, 1256INamedTypeSymbol? attributeType = attributeData.AttributeClass; 1332INamedTypeSymbol contextType, 1562private TypeRef? GetConverterTypeFromJsonConverterAttribute(INamedTypeSymbol contextType, ISymbol declaringSymbol, AttributeData attributeData) 1577private TypeRef? GetConverterTypeFromAttribute(INamedTypeSymbol contextType, ITypeSymbol? converterType, ISymbol declaringSymbol, AttributeData attributeData) 1579if (converterType is not INamedTypeSymbol namedConverterType || 1693if (type is not INamedTypeSymbol namedType || !namedType.IsGenericType) 1724if (type is not INamedTypeSymbol namedType) 1781private bool IsSymbolAccessibleWithin(ISymbol symbol, INamedTypeSymbol within)
JsonSourceGenerator.Roslyn3.11.cs (1)
129INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType;
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
src\libraries\Common\src\SourceGenerators\TypeModelHelper.cs (3)
13public static List<ITypeSymbol>? GetAllTypeArgumentsInScope(this INamedTypeSymbol type) 24void TraverseContainingTypes(INamedTypeSymbol current) 26if (current.ContainingType is INamedTypeSymbol parent)
System.Text.RegularExpressions.Generator (14)
RegexGenerator.Parser.cs (1)
42INamedTypeSymbol? regexSymbol = compilation.GetBestTypeByMetadataName(RegexName);
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (4)
38public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) 41var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); 53var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); 88public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, Type type) =>
UpgradeToGeneratedRegexAnalyzer.cs (6)
44if (!ProjectSupportsRegexSourceGenerator(compilation, out INamedTypeSymbol? regexTypeSymbol)) 62static HashSet<IMethodSymbol> GetMethodSymbolHash(INamedTypeSymbol regexTypeSymbol, HashSet<string> methodNames) 90private static void AnalyzeInvocation(OperationAnalysisContext context, INamedTypeSymbol regexTypeSymbol, HashSet<IMethodSymbol> staticMethodsToDetect) 122private static void AnalyzeObjectCreation(OperationAnalysisContext context, INamedTypeSymbol regexTypeSymbol) 231private static bool ProjectSupportsRegexSourceGenerator(Compilation compilation, [NotNullWhen(true)] out INamedTypeSymbol? regexTypeSymbol) 239INamedTypeSymbol? generatedRegexAttributeTypeSymbol = compilation.GetTypeByMetadataName(GeneratedRegexTypeName);
UpgradeToGeneratedRegexCodeFixer.cs (3)
86INamedTypeSymbol? regexSymbol = compilation.GetTypeByMetadataName(RegexTypeName); 87INamedTypeSymbol? generatedRegexAttributeSymbol = compilation.GetTypeByMetadataName(GeneratedRegexTypeName); 109INamedTypeSymbol? typeSymbol = typeDeclarationOrCompilationUnit is TypeDeclarationSyntax typeDeclaration ?
System.Windows.Forms.Analyzers.CSharp (5)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (4)
49if (funcParameter.Type is not INamedTypeSymbol funcType 58if (objectTypeInfo.Type is not INamedTypeSymbol objectType 66if (funcType.DelegateInvokeMethod?.ReturnType is INamedTypeSymbol returnType 77static bool IsAncestorOrSelfOfType(INamedTypeSymbol? type, string typeName) =>
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
58INamedTypeSymbol classSymbol = propertySymbol.ContainingType;
System.Windows.Forms.Analyzers.VisualBasic (7)
Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.vb (6)
54If Not (TypeOf funcParameter.Type Is INamedTypeSymbol) Then 58Dim funcType = DirectCast(funcParameter.Type, INamedTypeSymbol) 66If Not (TypeOf objectTypeInfo.Type Is INamedTypeSymbol) Then 70Dim objectType = DirectCast(objectTypeInfo.Type, INamedTypeSymbol) 79Dim returnType = TryCast(funcType.DelegateInvokeMethod.ReturnType, INamedTypeSymbol) 92Private Shared Function IsAncestorOrSelfOfType(type As INamedTypeSymbol, typeName As String) As Boolean
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
61Dim classSymbol As INamedTypeSymbol = propertySymbol.ContainingType
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
205INamedTypeSymbol? flagsAttributeType = compilation.GetTypeByMetadataName("System.FlagsAttribute");