6 interfaces inheriting from ITypeSymbol
Microsoft.CodeAnalysis (6)
Symbols\IArrayTypeSymbol.cs (1)
17public interface IArrayTypeSymbol : ITypeSymbol
Symbols\IDynamicTypeSymbol.cs (1)
16public interface IDynamicTypeSymbol : ITypeSymbol
Symbols\IFunctionPointerTypeSymbol.cs (1)
14public interface IFunctionPointerTypeSymbol : ITypeSymbol
Symbols\INamedTypeSymbol.cs (1)
19public interface INamedTypeSymbol : ITypeSymbol
Symbols\IPointerTypeSymbol.cs (1)
18public interface IPointerTypeSymbol : ITypeSymbol
Symbols\ITypeParameterSymbol.cs (1)
16public interface ITypeParameterSymbol : ITypeSymbol
4 implementations of ITypeSymbol
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (1)
17internal abstract class CodeGenerationTypeSymbol : CodeGenerationNamespaceOrTypeSymbol, ITypeSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\TypeSymbol.cs (1)
12internal abstract class TypeSymbol : NamespaceOrTypeSymbol, ISymbol, ITypeSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\TypeSymbol.vb (1)
23Implements ITypeSymbol, ITypeSymbolInternal
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (1)
17internal abstract class CodeGenerationTypeSymbol : CodeGenerationNamespaceOrTypeSymbol, ITypeSymbol
4582 references to ITypeSymbol
Aspire.Hosting.Analyzers (5)
Infrastructure\WellKnownTypes.cs (5)
111public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes) => IsType(type, wellKnownTypes, out var _); 113public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes, [NotNullWhen(true)] out WellKnownTypeData.WellKnownType? match) 128public bool Implements(ITypeSymbol type, WellKnownTypeData.WellKnownType[] interfaceWellKnownTypes) 141public static bool Implements(ITypeSymbol? type, ITypeSymbol interfaceType)
ConfigurationSchemaGenerator (69)
ConfigSchemaEmitter.cs (2)
385var typeSymbol = _compilation.GetBestTypeByMetadataName(type.FullName) as ITypeSymbol;
ConfigurationBindingGenerator.ForSchemaGeneration.cs (1)
74ITypeSymbol typeSymbol = typeParseInfo.TypeSymbol;
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (31)
26private readonly Dictionary<ITypeSymbol, TypeSpec> _createdTypeSpecs = new(SymbolEqualityComparer.Default); 64private bool IsValidRootConfigType([NotNullWhen(true)] ITypeSymbol? type) 110ITypeSymbol typeSymbol = typeParseInfo.TypeSymbol; 145private void EnqueueTargetTypeForRootInvocation(ITypeSymbol? typeSymbol, MethodsToGen overload, BinderInvocation invocation) 159private TypeRef EnqueueTransitiveType(TypeParseInfo containingTypeParseInfo, ITypeSymbol memberTypeSymbol, DiagnosticDescriptor diagDescriptor, string? memberName = null) 175ITypeSymbol type = typeParseInfo.TypeSymbol; 178if (IsNullable(type, out ITypeSymbol? underlyingType)) 219private static bool IsNullable(ITypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? underlyingType) 233private bool IsParsableFromString(ITypeSymbol type, out StringParsableTypeKind typeKind) 367if (IsCandidateDictionary(type, out ITypeSymbol? keyType, out ITypeSymbol? elementType)) 381private TypeSpec CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol keyTypeSymbol, ITypeSymbol elementTypeSymbol) 447if (!TryGetElementType(type, out ITypeSymbol? elementType)) 525private bool IsAssignableTo(ITypeSymbol source, ITypeSymbol dest) 531private bool IsUnsupportedType(ITypeSymbol type, int recursionDepth = 0) 566if (IsCandidateDictionary(collectionType, out ITypeSymbol? keyType, out ITypeSymbol? elementType)) 753private bool TryGetElementType(INamedTypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? elementType) 767private bool IsCandidateDictionary(INamedTypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? keyType, [NotNullWhen(true)] out ITypeSymbol? elementType) 790private bool IsCollection(ITypeSymbol type) => 832private static bool ContainsGenericParameters(ITypeSymbol type) 839foreach (ITypeSymbol typeArg in genericType.TypeArguments) 854private static bool HasAddMethod(INamedTypeSymbol type, ITypeSymbol element) 870private static bool HasAddMethod(INamedTypeSymbol type, ITypeSymbol key, ITypeSymbol element) 887private static bool IsEnum(ITypeSymbol type) => type is INamedTypeSymbol { EnumUnderlyingType: INamedTypeSymbol { } }; 937foreach (var typeSymbol in _createdTypeSpecs.Keys)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (6)
87ITypeSymbol? type = ResolveType(instanceArg.Value)?.WithNullableAnnotation(NullableAnnotation.None); 103static ITypeSymbol? ResolveType(IOperation conversionOperation) => 146ITypeSymbol? type; 196ITypeSymbol? type; 246ITypeSymbol effectiveType = IsNullable(type, out ITypeSymbol? underlyingType) ? underlyingType : type;
RuntimeSource\Configuration.Binder\Parser\Extensions.cs (8)
17public ITypeSymbol TypeSymbol { get; private init; } 27public static TypeParseInfo Create(ITypeSymbol typeSymbol, MethodsToGen overload, BinderInvocation invocation, ContainingTypeDiagnosticInfo? containingTypeDiagInfo = null) => 37public TypeParseInfo ToTransitiveTypeParseInfo(ITypeSymbol memberType, DiagnosticDescriptor? diagDescriptor = null, string? memberName = null) 92public static string ToIdentifierCompatibleSubstring(this ITypeSymbol type) 112if (namedType.GetAllTypeArgumentsInScope() is List<ITypeSymbol> typeArgsInScope) 114foreach (ITypeSymbol genericArg in typeArgsInScope) 123public static (string DisplayString, string FullName) GetTypeNames(this ITypeSymbol type) 131public static string GetFullName(this ITypeSymbol type) => GetTypeNames(type).FullName;
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (3)
28ITypeSymbol? typeSymbol = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None); 42private void ParseBindInvocation_OptionsBuilderExt(BinderInvocation invocation, ITypeSymbol? type) 70private void ParseBindConfigurationInvocation(BinderInvocation invocation, ITypeSymbol? type)
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (3)
41ITypeSymbol? secondParamType = @params[1].Type; 42ITypeSymbol? thirdParamType = @params[2].Type; 72ITypeSymbol? typeSymbol = targetMethod.TypeArguments[0].WithNullableAnnotation(NullableAnnotation.None);
RuntimeSource\Configuration.Binder\Specs\Types\CollectionSpec.cs (4)
11protected CollectionSpec(ITypeSymbol type) : base(type) { } 19protected CollectionWithCtorInitSpec(ITypeSymbol type) : base(type) { } 30public ArraySpec(ITypeSymbol type) : base(type) { } 35public EnumerableSpec(ITypeSymbol type) : base(type) { }
RuntimeSource\Configuration.Binder\Specs\Types\SimpleTypeSpec.cs (3)
10public SimpleTypeSpec(ITypeSymbol type) : base(type) { } 15public ConfigurationSectionSpec(ITypeSymbol type) : base(type) { } 20public ParsableFromStringSpec(ITypeSymbol type) : base(type) { }
RuntimeSource\Configuration.Binder\Specs\Types\TypeSpec.cs (4)
13public TypeSpec(ITypeSymbol type) 43protected ComplexTypeSpec(ITypeSymbol type) : base(type) { } 48public NullableSpec(ITypeSymbol type, TypeRef underlyingTypeRef) : base(type) => 54public UnsupportedTypeSpec(ITypeSymbol type) : base(type) { }
RuntimeSource\SourceGenerators\TypeModelHelper.cs (3)
13public static List<ITypeSymbol>? GetAllTypeArgumentsInScope(this INamedTypeSymbol type) 20List<ITypeSymbol>? args = null; 38public static string GetFullyQualifiedName(this ITypeSymbol type) => type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
RuntimeSource\SourceGenerators\TypeRef.cs (1)
16public TypeRef(ITypeSymbol type)
ILLink.RoslynAnalyzer (67)
COMAnalyzer.cs (3)
83 ITypeSymbol? typeSymbol = symbol is ITypeSymbol ? symbol as ITypeSymbol : null;
DataFlow\DynamicallyAccessedMembersBinder.cs (30)
17 public static IEnumerable<ISymbol> GetDynamicallyAccessedMembers (this ITypeSymbol typeDefinition, DynamicallyAccessedMemberTypes memberTypes, bool declaredOnly = false) 68 foreach (var nested in typeDefinition.GetNestedTypesOnType (filter: null, bindingFlags: BindingFlags.NonPublic)) { 78 foreach (var nested in typeDefinition.GetNestedTypesOnType (filter: null, bindingFlags: BindingFlags.Public)) { 108 foreach (var i in typeDefinition.GetAllInterfaceImplementations (declaredOnly)) 112 public static IEnumerable<IMethodSymbol> GetConstructorsOnType (this ITypeSymbol type, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null) 138 public static IEnumerable<IMethodSymbol> GetMethodsOnTypeHierarchy (this ITypeSymbol thisType, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null) 140 ITypeSymbol? type = thisType; 181 public static IEnumerable<IFieldSymbol> GetFieldsOnTypeHierarchy (this ITypeSymbol thisType, Func<IFieldSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default) 183 ITypeSymbol? type = thisType; 220 public static IEnumerable<ITypeSymbol> GetNestedTypesOnType (this ITypeSymbol type, Func<ITypeSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default) 222 foreach (var nestedType in type.GetTypeMembers ().OfType<ITypeSymbol> ()) { 240 public static IEnumerable<IPropertySymbol> GetPropertiesOnTypeHierarchy (this ITypeSymbol thisType, Func<IPropertySymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default) 242 ITypeSymbol? type = thisType; 289 public static IEnumerable<IEventSymbol> GetEventsOnTypeHierarchy (this ITypeSymbol thisType, Func<IEventSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default) 291 ITypeSymbol? type = thisType; 341 public static IEnumerable<ITypeSymbol> GetAllInterfaceImplementations (this ITypeSymbol thisType, bool declaredOnly) 343 ITypeSymbol? type = thisType; 348 ITypeSymbol? interfaceType = i; 351 foreach (var innerInterface in interfaceType.GetAllInterfaceImplementations (declaredOnly: true)) 367 public static void GetAllOnType (this ITypeSymbol type, bool declaredOnly, List<ISymbol> members) => GetAllOnType (type, declaredOnly, members, new HashSet<ITypeSymbol> (SymbolEqualityComparer.Default)); 370 static void GetAllOnType (ITypeSymbol type, bool declaredOnly, List<ISymbol> members, HashSet<ITypeSymbol> types) 375 foreach (var nestedType in type.GetTypeMembers ().OfType<ITypeSymbol> ()) { 389 foreach (var iface in type.GetAllInterfaceImplementations (declaredOnly: true))
ISymbolExtensions.cs (3)
182 var typeSymbol = namedTypeSymbol as ITypeSymbol; 188 if (symbol is not ITypeSymbol typeSymbol)
ITypeSymbolExtensions.cs (5)
19 public static bool IsTypeInterestingForDataflow (this ITypeSymbol type, bool isByRef) 38 ITypeSymbol? baseType = type; 58 public static bool IsTypeOf (this ITypeSymbol symbol, string @namespace, string name) 63 public static bool IsTypeOf (this ITypeSymbol symbol, WellKnownType wellKnownType) 68 public static WellKnownType? TryGetWellKnownType (this ITypeSymbol symbol)
RequiresAnalyzerBase.cs (2)
71 var typeArgs = ImmutableArray<ITypeSymbol>.Empty; 89 var typeArg = typeArgs[i];
RequiresISymbolExtensions.cs (2)
45 if (member is ITypeSymbol) { 58 if (member.ContainingType is ITypeSymbol containingType && containingType.TryGetAttribute (attributeName, out requiresAttribute))
TrimAnalysis\FlowAnnotations.cs (2)
189 public static DynamicallyAccessedMemberTypes GetTypeAnnotation(ITypeSymbol type) 193 ITypeSymbol? baseType = type.BaseType;
TrimAnalysis\GenericArgumentDataFlow.cs (4)
37 ImmutableArray<ITypeSymbol> typeArguments, 43 var typeArgument = typeArguments[i]; 65 foreach (var typeArgument in type.TypeArguments) { 83 foreach (var typeArgument in method.TypeArguments) {
TrimAnalysis\GenericParameterProxy.cs (1)
19 foreach (ITypeSymbol constraintType in TypeParameterSymbol.ConstraintTypes) {
TrimAnalysis\HandleCallAction.cs (4)
89 ITypeSymbol? staticType = (valueNode as IValueWithStaticType)?.StaticType?.Type; 90 ITypeSymbol? staticTypeDef = staticType?.OriginalDefinition; 94 foreach (var constraintType in genericParam.ConstraintTypes) { 172 foreach (var nestedType in type.Type.GetNestedTypesOnType (t => t.Name == name, bindingFlags))
TrimAnalysis\MethodProxy.cs (1)
57 static bool IsTypeOf (ITypeSymbol type, string fullTypeName)
TrimAnalysis\ReflectionAccessAnalyzer.cs (6)
27 internal void GetReflectionAccessDiagnostics (Location location, ITypeSymbol typeSymbol, DynamicallyAccessedMemberTypes requiredMemberTypes, bool declaredOnly = false) 56 internal void GetReflectionAccessDiagnosticsForEventsOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags) 62 internal void GetReflectionAccessDiagnosticsForFieldsOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags) 68 internal void GetReflectionAccessDiagnosticsForPropertiesOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags) 74 internal void GetReflectionAccessDiagnosticsForConstructorsOnType (Location location, ITypeSymbol typeSymbol, BindingFlags? bindingFlags, int? parameterCount) 80 internal void GetReflectionAccessDiagnosticsForPublicParameterlessConstructor (Location location, ITypeSymbol typeSymbol)
TrimAnalysis\SingleValueExtensions.cs (2)
14 public static SingleValue? FromTypeSymbol (ITypeSymbol type) 17 var underlyingType = (type as INamedTypeSymbol)?.TypeArguments.FirstOrDefault ();
TrimAnalysis\TypeProxy.cs (2)
12 public TypeProxy (ITypeSymbol type) => Type = type; 28 public readonly ITypeSymbol Type;
Microsoft.Analyzers.Extra (24)
AsyncCallInsideUsingBlockAnalyzer.cs (1)
130var returnType = operation.Type?.OriginalDefinition;
AsyncMethodWithoutCancellation.cs (3)
49var knownTypes = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 116var returnType = method.ReturnType.OriginalDefinition; 154private static bool MethodParametersContainKnownTypes(IMethodSymbol method, HashSet<ITypeSymbol> typeSymbols)
CallAnalysis\Arrays.cs (2)
107var keyType = type.TypeArguments[0]; 122var valueType = keyType;
CallAnalysis\CallAnalyzer.State.cs (2)
19public readonly Dictionary<ITypeSymbol, List<Action<OperationAnalysisContext, IThrowOperation>>> ExceptionTypes = new(SymbolEqualityComparer.Default); 20public readonly Dictionary<ITypeSymbol, List<MethodHandlers>> Interfaces = new(SymbolEqualityComparer.Default);
CallAnalysis\Fixers\LegacyLoggingFixer.cs (4)
366var t = invocationOp.Arguments[0].Value.Type!; 404var type = e.SemanticModel?.GetTypeInfo(e.Syntax).Type!; 427private static List<ITypeSymbol> MakeArgumentList(FixDetails details, IInvocationOperation invocationOp) 429var args = new List<ITypeSymbol>
CoalesceAnalyzer.cs (2)
34var type = op.Target.Type; 61var type = op.Value.Type;
ConditionalAccessAnalyzer.cs (1)
36ITypeSymbol? type;
MakeExeTypesInternalAnalyzer.cs (6)
59var disqualifyingMemberAttributes = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 69var disqualifyingTypeAttributes = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 79var disqualifyingBaseClasses = new List<ITypeSymbol>(); 93var type = (ITypeSymbol)symbolActionContext.Symbol; 109foreach (var c in disqualifyingBaseClasses)
Utilities\SymbolExtensions.cs (3)
16public static bool IsAncestorOf(this ITypeSymbol potentialAncestor, ITypeSymbol potentialDescendant) 18ITypeSymbol? t = potentialDescendant;
Microsoft.Analyzers.Local (3)
CallAnalysis\CallAnalyzer.State.cs (2)
19public readonly Dictionary<ITypeSymbol, List<Action<OperationAnalysisContext, IThrowOperation>>> ExceptionTypes = new(SymbolEqualityComparer.Default); 20public readonly Dictionary<ITypeSymbol, List<MethodHandlers>> Interfaces = new(SymbolEqualityComparer.Default);
Utilities\SymbolExtensions.cs (1)
164internal static ITypeSymbol? GetFieldOrPropertyType(this ISymbol symbol)
Microsoft.AspNetCore.App.Analyzers (53)
Http\RequestDelegateReturnTypeAnalyzer.cs (3)
36var returnType = methodReference.Method.ReturnType; 59var returnType = resolvedOperation.Type; 76private static void AddDiagnosticWarning(OperationAnalysisContext context, Location location, ITypeSymbol returnType)
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
34foreach (var currentClass in controllerSymbol.GetTypeHierarchy()) 64foreach (var currentClass in actionSymbol.ContainingType.GetTypeHierarchy()) 136INamedTypeSymbol commonAttribute, ITypeSymbol attributeInterface, bool mustBeInheritable)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
368if (attributeTypeSymbol.ContainingSymbol is ITypeSymbol typeSymbol &&
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
69ITypeSymbol typeSymbol => typeSymbol.GetMembers().OfType<IPropertySymbol>().ToImmutableArray().As<ISymbol>(),
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (4)
34var returnType = UnwrapPossibleAsyncReturnType(methodSymbol.ReturnType); 67var type = returnedValue.Type; 89private static ITypeSymbol UnwrapPossibleAsyncReturnType(ITypeSymbol returnType)
RouteHandlers\RouteHandlerAnalyzer.cs (1)
208var parmeterType = targetMethod.Parameters[DelegateParameterOrdinal].Type;
src\Shared\Roslyn\CodeAnalysisExtensions.cs (15)
15public static bool HasAttribute(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 21public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, ITypeSymbol attribute) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 54public static IEnumerable<AttributeData> GetAttributes(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 59foreach (var type in GetTypeHierarchy(typeSymbol)) 73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 97public static bool IsAssignableFrom(this ITypeSymbol source, ITypeSymbol target) 120foreach (var type in target.GetTypeHierarchy()) 131public static bool HasAttribute(this ISymbol symbol, ITypeSymbol attribute) 144public static IEnumerable<ITypeSymbol> GetTypeHierarchy(this ITypeSymbol? typeSymbol)
src\Shared\RoslynUtils\ParsabilityHelper.cs (12)
20private static readonly BoundedCacheWithFactory<ITypeSymbol, (BindabilityMethod?, IMethodSymbol?)> BindabilityCache = new(); 21private static readonly BoundedCacheWithFactory<ITypeSymbol, (Parsability, ParsabilityMethod?)> ParsabilityCache = new(); 23private static bool IsTypeAlwaysParsable(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out ParsabilityMethod? parsabilityMethod) 50internal static Parsability GetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 55internal static Parsability GetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(false)] out ParsabilityMethod? parsabilityMethod) 115internal static bool IsParsableViaIParsable(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 124private static bool IsBindableViaIBindableFromHttpContext(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 134private static bool IsBindAsync(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 145private static bool IsBindAsyncWithParameter(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 156private static bool IsReturningValueTaskOfTOrNullableT(INamedTypeSymbol returnType, ITypeSymbol containingType, WellKnownTypes wellKnownTypes) 162internal static Bindability GetBindability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, out BindabilityMethod? bindabilityMethod, out IMethodSymbol? bindMethodSymbol) 180foreach (var candidate in searchCandidates)
src\Shared\RoslynUtils\SymbolExtensions.cs (8)
19public static ITypeSymbol UnwrapTypeSymbol(this ITypeSymbol typeSymbol, bool unwrapArray = false, bool unwrapNullable = false) 42public static IEnumerable<ITypeSymbol> GetThisAndBaseTypes(this ITypeSymbol? type) 44var current = type; 125public static bool Implements(this ITypeSymbol type, ITypeSymbol interfaceType) 143public static ITypeSymbol GetParameterType(this ISymbol symbol)
src\Shared\RoslynUtils\WellKnownTypes.cs (5)
116public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes) => IsType(type, wellKnownTypes, out var _); 118public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes, [NotNullWhen(true)] out WellKnownTypeData.WellKnownType? match) 133public bool Implements(ITypeSymbol type, WellKnownTypeData.WellKnownType[] interfaceWellKnownTypes) 146public static bool Implements(ITypeSymbol? type, ITypeSymbol interfaceType)
Microsoft.AspNetCore.App.CodeFixes (4)
Dependencies\AddPackageFixer.cs (1)
67var symbolType = symbol switch
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
64var symbolType = symbol.Symbol switch
Dependencies\ThisAndExtensionMethod.cs (2)
8internal readonly struct ThisAndExtensionMethod(ITypeSymbol thisType, string extensionMethod) 10public ITypeSymbol ThisType { get; } = thisType;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (57)
src\Shared\RoslynUtils\ParsabilityHelper.cs (12)
20private static readonly BoundedCacheWithFactory<ITypeSymbol, (BindabilityMethod?, IMethodSymbol?)> BindabilityCache = new(); 21private static readonly BoundedCacheWithFactory<ITypeSymbol, (Parsability, ParsabilityMethod?)> ParsabilityCache = new(); 23private static bool IsTypeAlwaysParsable(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out ParsabilityMethod? parsabilityMethod) 50internal static Parsability GetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 55internal static Parsability GetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(false)] out ParsabilityMethod? parsabilityMethod) 115internal static bool IsParsableViaIParsable(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 124private static bool IsBindableViaIBindableFromHttpContext(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 134private static bool IsBindAsync(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 145private static bool IsBindAsyncWithParameter(IMethodSymbol methodSymbol, ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes) 156private static bool IsReturningValueTaskOfTOrNullableT(INamedTypeSymbol returnType, ITypeSymbol containingType, WellKnownTypes wellKnownTypes) 162internal static Bindability GetBindability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, out BindabilityMethod? bindabilityMethod, out IMethodSymbol? bindMethodSymbol) 180foreach (var candidate in searchCandidates)
src\Shared\RoslynUtils\SymbolExtensions.cs (8)
19public static ITypeSymbol UnwrapTypeSymbol(this ITypeSymbol typeSymbol, bool unwrapArray = false, bool unwrapNullable = false) 42public static IEnumerable<ITypeSymbol> GetThisAndBaseTypes(this ITypeSymbol? type) 44var current = type; 125public static bool Implements(this ITypeSymbol type, ITypeSymbol interfaceType) 143public static ITypeSymbol GetParameterType(this ISymbol symbol)
src\Shared\RoslynUtils\WellKnownTypes.cs (5)
116public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes) => IsType(type, wellKnownTypes, out var _); 118public bool IsType(ITypeSymbol type, WellKnownTypeData.WellKnownType[] wellKnownTypes, [NotNullWhen(true)] out WellKnownTypeData.WellKnownType? match) 133public bool Implements(ITypeSymbol type, WellKnownTypeData.WellKnownType[] interfaceWellKnownTypes) 146public static bool Implements(ITypeSymbol? type, ITypeSymbol interfaceType)
StaticRouteHandlerModel\Emitters\DiagnosticEmitter.cs (1)
32var typeSymbol = parameterSymbol.Type;
StaticRouteHandlerModel\Emitters\EmitterExtensions.cs (1)
25public static bool IsSerializableJsonResponse(this EndpointResponse endpointResponse, [NotNullWhen(true)] out ITypeSymbol? responseTypeSymbol)
StaticRouteHandlerModel\Emitters\EndpointJsonPreparationEmitter.cs (1)
16if (endpoint.Response?.IsSerializableJsonResponse(out var responseType) == true)
StaticRouteHandlerModel\Emitters\EndpointParameterEmitter.cs (3)
337var receiverType = endpointParameter.BindableMethodSymbol?.ReceiverType is { TypeKind: TypeKind.Interface } targetType 340var bindMethodReceiverType = receiverType?.UnwrapTypeSymbol(unwrapNullable: true); 343var unwrappedType = endpointParameter.UnwrapParameterType();
StaticRouteHandlerModel\EndpointParameter.cs (13)
53private EndpointParameter(Endpoint endpoint, ITypeSymbol typeSymbol, string parameterName, WellKnownTypes wellKnownTypes) 59IsArray = TryGetArrayElementType(typeSymbol, out var elementType); 266private static bool ImplementsIEndpointMetadataProvider(ITypeSymbol type, WellKnownTypes wellKnownTypes) 269private static bool ImplementsIEndpointParameterMetadataProvider(ITypeSymbol type, WellKnownTypes wellKnownTypes) 272public ITypeSymbol Type { get; } 273public ITypeSymbol ElementType { get; } 303private static bool HasBindAsync(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out BindabilityMethod? bindMethod, [NotNullWhen(true)] out IMethodSymbol? bindMethodSymbol) 305var parameterType = typeSymbol.UnwrapTypeSymbol(unwrapArray: true, unwrapNullable: true); 309private static bool TryGetArrayElementType(ITypeSymbol type, [NotNullWhen(true)] out ITypeSymbol elementType) 323private bool TryGetParsability(ITypeSymbol typeSymbol, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out Func<string, string, string>? preferredTryParseInvocation) 325var parameterType = typeSymbol.UnwrapTypeSymbol(unwrapArray: true, unwrapNullable: true); 380private static bool TryGetSpecialTypeAssigningCode(ITypeSymbol type, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out string? callingCode)
StaticRouteHandlerModel\EndpointResponse.cs (5)
16public ITypeSymbol? ResponseType { get; set; } 17public ITypeSymbol WrappedResponseType { get; set; } 41private static bool ImplementsIEndpointMetadataProvider(ITypeSymbol? responseType, WellKnownTypes wellKnownTypes) 44private ITypeSymbol? UnwrapResponseType(IMethodSymbol method, out bool isAwaitable, out bool awaitableIsVoid) 48var returnType = method.ReturnType;
StaticRouteHandlerModel\Model\EndpointParameterExtensions.cs (5)
10public static ITypeSymbol UnwrapParameterType(this EndpointParameter parameter) 12var handlerParameterType = parameter.Type; 13var bindAsyncReturnType = parameter.GetBindAsyncReturnType(); 54public static ITypeSymbol? GetBindAsyncReturnType(this EndpointParameter parameter) 57public static bool IsNullableOfT(this ITypeSymbol? typeSymbol)
StaticRouteHandlerModel\Model\ParameterLookupKey.cs (2)
12public ParameterLookupKey(string name, ITypeSymbol type) 19public ITypeSymbol Type { get; }
StaticRouteHandlerModel\StaticRouteHandlerModel.Emitter.cs (1)
39var type = p.UnwrapParameterType();
Microsoft.AspNetCore.Mvc.Analyzers (17)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (15)
15public static bool HasAttribute(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 21public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, ITypeSymbol attribute) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 54public static IEnumerable<AttributeData> GetAttributes(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 59foreach (var type in GetTypeHierarchy(typeSymbol)) 73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 97public static bool IsAssignableFrom(this ITypeSymbol source, ITypeSymbol target) 120foreach (var type in target.GetTypeHierarchy()) 131public static bool HasAttribute(this ISymbol symbol, ITypeSymbol attribute) 144public static IEnumerable<ITypeSymbol> GetTypeHierarchy(this ITypeSymbol? typeSymbol)
TopLevelParameterNameAnalyzer.cs (2)
105var type = parameter.Type; 130private static bool IsComplexType(ITypeSymbol type)
Microsoft.AspNetCore.Mvc.Api.Analyzers (44)
ActualApiResponseMetadata.cs (3)
14public ActualApiResponseMetadata(IReturnOperation returnExpression, ITypeSymbol returnType) 21public ActualApiResponseMetadata(IReturnOperation returnExpression, int statusCode, ITypeSymbol? returnType) 34public ITypeSymbol? ReturnType { get; }
ActualApiResponseMetadataFactory.cs (6)
79var statementReturnType = returnedValue.Type; 116ITypeSymbol? returnType = null; 155private static (int? statusCode, ITypeSymbol? returnType) InspectInitializers( 160ITypeSymbol? typeSymbol = null; 191private static (int? statusCode, ITypeSymbol? returnType) InspectMethodArguments(ImmutableArray<IArgumentOperation> arguments) 194ITypeSymbol? typeSymbol = null;
AddResponseTypeAttributeCodeFixAction.cs (6)
56var errorResponseType = SymbolApiResponseMetadataProvider.GetErrorResponseType(context.SymbolCache, context.Method); 70var returnType = item.typeSymbol; 169private static ICollection<(int statusCode, ITypeSymbol? typeSymbol)> CalculateStatusCodesToApply(in CodeActionContext context, IList<DeclaredApiResponseMetadata> declaredResponseMetadata) 176return Array.Empty<(int, ITypeSymbol?)>(); 179var statusCodes = new Dictionary<int, (int, ITypeSymbol?)>(); 214private static AttributeSyntax CreateProducesResponseTypeAttribute(in CodeActionContext context, int statusCode, ITypeSymbol typeSymbol, out bool addUsingDirective)
ApiControllerSymbolCache.cs (2)
144ITypeSymbol modelStateDictionary, 191public ITypeSymbol ModelStateDictionary { get; }
src\Shared\Roslyn\CodeAnalysisExtensions.cs (15)
15public static bool HasAttribute(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 18public static bool HasAttribute(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 21public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, ITypeSymbol attribute) 32public static IEnumerable<AttributeData> GetAttributes(this IMethodSymbol methodSymbol, ITypeSymbol attribute, bool inherit) 54public static IEnumerable<AttributeData> GetAttributes(this ITypeSymbol typeSymbol, ITypeSymbol attribute, bool inherit) 59foreach (var type in GetTypeHierarchy(typeSymbol)) 73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 97public static bool IsAssignableFrom(this ITypeSymbol source, ITypeSymbol target) 120foreach (var type in target.GetTypeHierarchy()) 131public static bool HasAttribute(this ISymbol symbol, ITypeSymbol attribute) 144public static IEnumerable<ITypeSymbol> GetTypeHierarchy(this ITypeSymbol? typeSymbol)
SymbolApiConventionMatcher.cs (2)
184internal static bool IsTypeMatch(ITypeSymbol type, ITypeSymbol conventionType, SymbolApiConventionTypeMatchBehavior typeMatchBehavior)
SymbolApiResponseMetadataProvider.cs (10)
43public static ITypeSymbol GetErrorResponseType( 52ITypeSymbol errorType = symbolCache.ProblemDetails; 56errorTypeAttribute.ConstructorArguments[0].Value is ITypeSymbol typeSymbol) 67IReadOnlyList<ITypeSymbol> conventionTypes) 99!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType)) 119IReadOnlyList<ITypeSymbol> conventionTypes) 121foreach (var conventionType in conventionTypes) 161internal static IReadOnlyList<ITypeSymbol> GetConventionTypes(in ApiControllerSymbolCache symbolCache, IMethodSymbol method) 169var conventionTypes = new List<ITypeSymbol>(); 175!(attribute.ConstructorArguments[0].Value is ITypeSymbol conventionType))
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (5)
HubClientProxyGenerator.Parser.cs (3)
240var providerSymbols = new Dictionary<string, (ITypeSymbol, MemberAccessExpressionSyntax)>(); 246ITypeSymbol symbol; 252symbol = (ITypeSymbol)argModel.GetSymbolInfo(argType).Symbol;
HubServerProxyGenerator.Parser.cs (2)
228var hubSymbols = new Dictionary<string, (ITypeSymbol, MemberAccessExpressionSyntax)>(); 237if (ModelExtensions.GetSymbolInfo(argumentModel, proxyType).Symbol is not ITypeSymbol { IsAbstract: true } symbol)
Microsoft.CodeAnalysis (445)
Compilation\Compilation.cs (39)
998internal abstract bool IsAttributeType(ITypeSymbol type); 1011public ITypeSymbol DynamicType { get { return CommonDynamicType; } } 1012protected abstract ITypeSymbol CommonDynamicType { get; } 1017internal ITypeSymbol? ScriptGlobalsType => CommonScriptGlobalsType; 1018protected abstract ITypeSymbol? CommonScriptGlobalsType { get; } 1076public IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation elementNullableAnnotation = NullableAnnotation.None) 1086public IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank) 1091protected abstract IArrayTypeSymbol CommonCreateArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation elementNullableAnnotation); 1098public IPointerTypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 1103protected abstract IPointerTypeSymbol CommonCreatePointerTypeSymbol(ITypeSymbol elementType); 1119ITypeSymbol returnType, 1121ImmutableArray<ITypeSymbol> parameterTypes, 1130ITypeSymbol returnType, 1132ImmutableArray<ITypeSymbol> parameterTypes, 1288ImmutableArray<ITypeSymbol> elementTypes, 1329ImmutableArray<ITypeSymbol> elementTypes, 1393ImmutableArray<ITypeSymbol> elementTypes, 1445ImmutableArray<ITypeSymbol> memberTypes, 1514ImmutableArray<ITypeSymbol> memberTypes, 1523ImmutableArray<ITypeSymbol> memberTypes, 1539public IMethodSymbol CreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol leftType, ITypeSymbol rightType) 1555protected abstract IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol leftType, ITypeSymbol rightType); 1566public IMethodSymbol CreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol operandType) 1579protected abstract IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol operandType); 1589public abstract CommonConversion ClassifyCommonConversion(ITypeSymbol source, ITypeSymbol destination); 1597public bool HasImplicitConversion(ITypeSymbol? fromType, ITypeSymbol? toType) 1620ITypeSymbol? throughType = null) 1749ITypeSymbol? throughType); 1751internal abstract IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol destination, out ConstantValue? constantValue); 3645internal string GetMessage(ITypeSymbol source, ITypeSymbol destination)
Compilation\Expression.cs (1)
9public static ConstantValue SynthesizeNumeric(ITypeSymbol type, int value)
Compilation\TypeInfo.cs (4)
20public ITypeSymbol? Type { get; } 31public ITypeSymbol? ConvertedType { get; } 40internal TypeInfo(ITypeSymbol? type, ITypeSymbol? convertedType, NullabilityInfo nullability, NullabilityInfo convertedNullability)
Diagnostic\CommonMessageProvider.cs (2)
270protected abstract void ReportInvalidNamedArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName); 272public void ReportInvalidNamedArgument(BindingDiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName)
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
407var typeSymbol = result.Value.Type; 696private ITypeSymbol ParseArrayType(ITypeSymbol typeSymbol) 764var boundReturnType = BindParameterOrReturnType(methodSymbol, returnType.Value); 801var parameterType = BindParameterOrReturnType(symbol.ContainingSymbol, parameterInfo.Type); 806private ITypeSymbol BindParameterOrReturnType(ISymbol bindingContext, TypeInfo type) 868public readonly ITypeSymbol Type; 876private TypeInfo(ITypeSymbol type, int startIndex) 882public static TypeInfo Create(ITypeSymbol type)
DocumentationCommentId.cs (14)
864private static ITypeSymbol? ParseTypeSymbol(string id, ref int index, Compilation compilation, ISymbol? typeParameterContext) 876return (ITypeSymbol)results[0]; 918results.AddRange(contexts.OfType<ITypeSymbol>()); 944var typeSymbol = (ITypeSymbol)results[i]; 1022List<ITypeSymbol>? typeArguments = null; 1028typeArguments = new List<ITypeSymbol>(); 1121private static bool ParseTypeArguments(string id, ref int index, Compilation compilation, ISymbol? typeParameterContext, List<ITypeSymbol> typeArguments) 1127var type = ParseTypeSymbol(id, ref index, compilation, typeParameterContext); 1261ITypeSymbol? returnType = ParseTypeSymbol(id, ref index, compilation, methodSymbol); 1405var parameterType = parameterInfo.Type; 1441internal readonly ITypeSymbol Type; 1444public ParameterInfo(ITypeSymbol type, bool isRefOrOut) 1498var type = ParseTypeSymbol(id, ref index, compilation, typeParameterContext);
Generated\Operations.Generated.cs (273)
718ITypeSymbol? ConstrainedToType { get; } 781ITypeSymbol? ConstrainedToType { get; } 911ITypeSymbol? ConstrainedToType { get; } 1081ITypeSymbol? ConstrainedToType { get; } 1140ITypeSymbol? ConstrainedToType { get; } 1401ITypeSymbol TypeOperand { get; } 1533ITypeSymbol? ConstrainedToType { get; } 1838ITypeSymbol? NaturalType { get; } 1900ImmutableArray<ITypeSymbol> TypeArguments { get; } 1904ITypeSymbol? ContainingType { get; } 2076ITypeSymbol TypeOperand { get; } 2100ITypeSymbol TypeOperand { get; } 2203ITypeSymbol? ConstrainedToType { get; } 2612ITypeSymbol ExceptionType { get; } 2889ITypeSymbol InputType { get; } 2893ITypeSymbol NarrowedType { get; } 2941ITypeSymbol? MatchedType { get; } 3221ITypeSymbol MatchedType { get; } 3565ITypeSymbol MatchedType { get; } 3989ITypeSymbol? ElementType { get; } 4050public override ITypeSymbol? Type => null; 4105public override ITypeSymbol? Type => null; 4175public override ITypeSymbol? Type => null; 4281public override ITypeSymbol? Type => null; 4373public override ITypeSymbol? Type => null; 4485public override ITypeSymbol? Type => null; 4509public override ITypeSymbol? Type => null; 4562public override ITypeSymbol? Type => null; 4582public override ITypeSymbol? Type => null; 4596public override ITypeSymbol? Type => null; 4648public override ITypeSymbol? Type => null; 4712public override ITypeSymbol? Type => null; 4791public override ITypeSymbol? Type => null; 4859public override ITypeSymbol? Type => null; 4910public override ITypeSymbol? Type => null; 4974public override ITypeSymbol? Type => null; 4988public override ITypeSymbol? Type => null; 5002public override ITypeSymbol? Type => null; 5068public override ITypeSymbol? Type => null; 5076internal LiteralOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5086public override ITypeSymbol? Type { get; } 5094internal ConversionOperation(IOperation operand, IConvertibleConversion conversion, bool isTryCast, bool isChecked, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5146public override ITypeSymbol? Type { get; } 5154internal InvocationOperation(IMethodSymbol targetMethod, ITypeSymbol? constrainedToType, IOperation? instance, bool isVirtual, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5165public ITypeSymbol? ConstrainedToType { get; } 5219public override ITypeSymbol? Type { get; } 5227internal ArrayElementReferenceOperation(IOperation arrayReference, ImmutableArray<IOperation> indices, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5286public override ITypeSymbol? Type { get; } 5294internal LocalReferenceOperation(ILocalSymbol local, bool isDeclaration, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5308public override ITypeSymbol? Type { get; } 5316internal ParameterReferenceOperation(IParameterSymbol parameter, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5327public override ITypeSymbol? Type { get; } 5341public abstract ITypeSymbol? ConstrainedToType { get; } 5345internal FieldReferenceOperation(IFieldSymbol field, bool isDeclaration, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5392public override ITypeSymbol? Type { get; } 5400internal MethodReferenceOperation(IMethodSymbol method, ITypeSymbol? constrainedToType, bool isVirtual, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5409public override ITypeSymbol? ConstrainedToType { get; } 5448public override ITypeSymbol? Type { get; } 5456internal PropertyReferenceOperation(IPropertySymbol property, ITypeSymbol? constrainedToType, ImmutableArray<IArgumentOperation> arguments, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5465public override ITypeSymbol? ConstrainedToType { get; } 5517public override ITypeSymbol? Type { get; } 5525internal EventReferenceOperation(IEventSymbol @event, ITypeSymbol? constrainedToType, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5533public override ITypeSymbol? ConstrainedToType { get; } 5571public override ITypeSymbol? Type { get; } 5579internal UnaryOperation(UnaryOperatorKind operatorKind, IOperation operand, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5596public ITypeSymbol? ConstrainedToType { get; } 5634public override ITypeSymbol? Type { get; } 5642internal BinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, bool isLifted, bool isChecked, bool isCompareText, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IMethodSymbol? unaryOperatorMethod, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5664public ITypeSymbol? ConstrainedToType { get; } 5712public override ITypeSymbol? Type { get; } 5720internal ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation? whenFalse, bool isRef, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5789public override ITypeSymbol? Type { get; } 5797internal CoalesceOperation(IOperation value, IOperation whenNull, IConvertibleConversion valueConversion, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5856public override ITypeSymbol? Type { get; } 5909public override ITypeSymbol? Type => null; 5917internal ObjectCreationOperation(IMethodSymbol? constructor, IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5979public override ITypeSymbol? Type { get; } 5987internal TypeParameterObjectCreationOperation(IObjectOrCollectionInitializerOperation? initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6031public override ITypeSymbol? Type { get; } 6039internal ArrayCreationOperation(ImmutableArray<IOperation> dimensionSizes, IArrayInitializerOperation? initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6098public override ITypeSymbol? Type { get; } 6106internal InstanceReferenceOperation(InstanceReferenceKind referenceKind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6117public override ITypeSymbol? Type { get; } 6125internal IsTypeOperation(IOperation valueOperand, ITypeSymbol typeOperand, bool isNegated, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6134public ITypeSymbol TypeOperand { get; } 6173public override ITypeSymbol? Type { get; } 6181internal AwaitOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6225public override ITypeSymbol? Type { get; } 6244internal SimpleAssignmentOperation(bool isRef, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6298public override ITypeSymbol? Type { get; } 6306internal CompoundAssignmentOperation(IConvertibleConversion inConversion, IConvertibleConversion outConversion, BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6326public ITypeSymbol? ConstrainedToType { get; } 6373public override ITypeSymbol? Type { get; } 6381internal ParenthesizedOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6426public override ITypeSymbol? Type { get; } 6434internal EventAssignmentOperation(IOperation eventReference, IOperation handlerValue, bool adds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6491public override ITypeSymbol? Type { get; } 6499internal ConditionalAccessOperation(IOperation operation, IOperation whenNotNull, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6554public override ITypeSymbol? Type { get; } 6562internal ConditionalAccessInstanceOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6571public override ITypeSymbol? Type { get; } 6579internal InterpolatedStringOperation(ImmutableArray<IInterpolatedStringContentOperation> parts, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6628public override ITypeSymbol? Type { get; } 6636internal AnonymousObjectCreationOperation(ImmutableArray<IOperation> initializers, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6684public override ITypeSymbol? Type { get; } 6692internal ObjectOrCollectionInitializerOperation(ImmutableArray<IOperation> initializers, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6740public override ITypeSymbol? Type { get; } 6748internal MemberInitializerOperation(IOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6803public override ITypeSymbol? Type { get; } 6811internal NameOfOperation(IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6856public override ITypeSymbol? Type { get; } 6864internal TupleOperation(ImmutableArray<IOperation> elements, ITypeSymbol? naturalType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6872public ITypeSymbol? NaturalType { get; } 6914public override ITypeSymbol? Type { get; } 6922internal DynamicMemberReferenceOperation(IOperation? instance, string memberName, ImmutableArray<ITypeSymbol> typeArguments, ITypeSymbol? containingType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6933public ImmutableArray<ITypeSymbol> TypeArguments { get; } 6934public ITypeSymbol? ContainingType { get; } 6972public override ITypeSymbol? Type { get; } 6980internal TranslatedQueryOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7024public override ITypeSymbol? Type { get; } 7032internal DelegateCreationOperation(IOperation target, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7076public override ITypeSymbol? Type { get; } 7084internal DefaultValueOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 7094public override ITypeSymbol? Type { get; } 7102internal TypeOfOperation(ITypeSymbol typeOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7108public ITypeSymbol TypeOperand { get; } 7113public override ITypeSymbol? Type { get; } 7121internal SizeOfOperation(ITypeSymbol typeOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 7128public ITypeSymbol TypeOperand { get; } 7133public override ITypeSymbol? Type { get; } 7141internal AddressOfOperation(IOperation reference, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7185public override ITypeSymbol? Type { get; } 7193internal IsPatternOperation(IOperation value, IPatternOperation pattern, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7248public override ITypeSymbol? Type { get; } 7256internal IncrementOrDecrementOperation(bool isPostfix, bool isLifted, bool isChecked, IOperation target, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7273public ITypeSymbol? ConstrainedToType { get; } 7311public override ITypeSymbol? Type { get; } 7319internal ThrowOperation(IOperation? exception, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7363public override ITypeSymbol? Type { get; } 7371internal DeconstructionAssignmentOperation(IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7422public override ITypeSymbol? Type { get; } 7430internal DeclarationExpressionOperation(IOperation expression, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7474public override ITypeSymbol? Type { get; } 7482internal OmittedArgumentOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7491public override ITypeSymbol? Type { get; } 7553public override ITypeSymbol? Type => null; 7600public override ITypeSymbol? Type => null; 7651public override ITypeSymbol? Type => null; 7702public override ITypeSymbol? Type => null; 7757public override ITypeSymbol? Type => null; 7825public override ITypeSymbol? Type => null; 7906public override ITypeSymbol? Type => null; 7967public override ITypeSymbol? Type => null; 7975internal CatchClauseOperation(IOperation? exceptionDeclarationOrExpression, ITypeSymbol exceptionType, ImmutableArray<ILocalSymbol> locals, IOperation? filter, IBlockOperation handler, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7985public ITypeSymbol ExceptionType { get; } 8044public override ITypeSymbol? Type => null; 8118public override ITypeSymbol? Type => null; 8142public override ITypeSymbol? Type => null; 8205public override ITypeSymbol? Type => null; 8267public override ITypeSymbol? Type => null; 8320public override ITypeSymbol? Type => null; 8371public override ITypeSymbol? Type => null; 8427public override ITypeSymbol? Type => null; 8500public override ITypeSymbol? Type => null; 8508protected BasePatternOperation(ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8514public ITypeSymbol InputType { get; } 8515public ITypeSymbol NarrowedType { get; } 8519internal ConstantPatternOperation(IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8562public override ITypeSymbol? Type => null; 8570internal DeclarationPatternOperation(ITypeSymbol? matchedType, bool matchesNull, ISymbol? declaredSymbol, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8577public ITypeSymbol? MatchedType { get; } 8584public override ITypeSymbol? Type => null; 8592internal TupleBinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8649public override ITypeSymbol? Type { get; } 8716public override ITypeSymbol? Type => null; 8787public override ITypeSymbol? Type => null; 8795internal DiscardOperation(IDiscardSymbol discardSymbol, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8806public override ITypeSymbol? Type { get; } 8859public override ITypeSymbol? Type => null; 8867internal FlowCaptureReferenceOperation(CaptureId id, bool isInitialization, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 8881public override ITypeSymbol? Type { get; } 8889internal IsNullOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 8934public override ITypeSymbol? Type { get; } 8942internal CaughtExceptionOperation(SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8951public override ITypeSymbol? Type { get; } 8959internal StaticLocalInitializationSemaphoreOperation(ILocalSymbol local, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8970public override ITypeSymbol? Type { get; } 8978internal CoalesceAssignmentOperation(IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9029public override ITypeSymbol? Type { get; } 9037internal RangeOperation(IOperation? leftOperand, IOperation? rightOperand, bool isLifted, IMethodSymbol? method, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9096public override ITypeSymbol? Type { get; } 9153public override ITypeSymbol? Type => null; 9219public override ITypeSymbol? Type => null; 9227internal RecursivePatternOperation(ITypeSymbol matchedType, ISymbol? deconstructSymbol, ImmutableArray<IPatternOperation> deconstructionSubpatterns, ImmutableArray<IPropertySubpatternOperation> propertySubpatterns, ISymbol? declaredSymbol, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9236public ITypeSymbol MatchedType { get; } 9295public override ITypeSymbol? Type => null; 9303internal DiscardPatternOperation(ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9309public override ITypeSymbol? Type => null; 9317internal SwitchExpressionOperation(IOperation value, ImmutableArray<ISwitchExpressionArmOperation> arms, bool isExhaustive, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9378public override ITypeSymbol? Type { get; } 9453public override ITypeSymbol? Type => null; 9515public override ITypeSymbol? Type => null; 9523internal AggregateQueryOperation(IOperation group, IOperation aggregation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9578public override ITypeSymbol? Type { get; } 9642public override ITypeSymbol? Type => null; 9650internal NoPiaObjectCreationOperation(IObjectOrCollectionInitializerOperation? initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9694public override ITypeSymbol? Type { get; } 9702internal PlaceholderOperation(PlaceholderKind placeholderKind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9713public override ITypeSymbol? Type { get; } 9775public override ITypeSymbol? Type => null; 9830public override ITypeSymbol? Type => null; 9838internal NegatedPatternOperation(IPatternOperation pattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9881public override ITypeSymbol? Type => null; 9889internal BinaryPatternOperation(BinaryOperatorKind operatorKind, IPatternOperation leftPattern, IPatternOperation rightPattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9945public override ITypeSymbol? Type => null; 9953internal TypePatternOperation(ITypeSymbol matchedType, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9958public ITypeSymbol MatchedType { get; } 9963public override ITypeSymbol? Type => null; 9971internal RelationalPatternOperation(BinaryOperatorKind operatorKind, IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10016public override ITypeSymbol? Type => null; 10024internal WithOperation(IOperation operand, IMethodSymbol? cloneMethod, IObjectOrCollectionInitializerOperation initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10081public override ITypeSymbol? Type { get; } 10089internal InterpolatedStringHandlerCreationOperation(IOperation handlerCreation, bool handlerCreationHasSuccessParameter, bool handlerAppendCallsReturnBool, IOperation content, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10148public override ITypeSymbol? Type { get; } 10210public override ITypeSymbol? Type => null; 10262public override ITypeSymbol? Type => null; 10282public override ITypeSymbol? Type => null; 10290internal FunctionPointerInvocationOperation(IOperation target, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10349public override ITypeSymbol? Type { get; } 10357internal ListPatternOperation(ISymbol? lengthSymbol, ISymbol? indexerSymbol, ImmutableArray<IPatternOperation> patterns, ISymbol? declaredSymbol, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10410public override ITypeSymbol? Type => null; 10418internal SlicePatternOperation(ISymbol? sliceSymbol, IPatternOperation? pattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10463public override ITypeSymbol? Type => null; 10471internal ImplicitIndexerReferenceOperation(IOperation instance, IOperation argument, ISymbol lengthSymbol, ISymbol indexerSymbol, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10530public override ITypeSymbol? Type { get; } 10538internal Utf8StringOperation(string value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10549public override ITypeSymbol? Type { get; } 10600public override ITypeSymbol? Type => null; 10608internal InlineArrayAccessOperation(IOperation instance, IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10663public override ITypeSymbol? Type { get; } 10671internal CollectionExpressionOperation(IMethodSymbol? constructMethod, ImmutableArray<IOperation> elements, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10721public override ITypeSymbol? Type { get; } 10729internal SpreadOperation(IOperation operand, ITypeSymbol? elementType, IConvertibleConversion elementConversion, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10737public ITypeSymbol? ElementType { get; } 10777public override ITypeSymbol? Type => null;
Operations\CommonConversion.cs (2)
32internal CommonConversion(bool exists, bool isIdentity, bool isNumeric, bool isReference, bool isImplicit, bool isNullable, IMethodSymbol? methodSymbol, ITypeSymbol? constrainedToType) 86public ITypeSymbol? ConstrainedToType { get; }
Operations\ControlFlowGraphBuilder.cs (21)
2456private IOperation CreateConversion(IOperation operand, ITypeSymbol type) 2988ITypeSymbol? valueTypeOpt = operationValue.Type; 3288private static IOperation MakeInvalidOperation(ITypeSymbol? type, IOperation child) 3295private static IOperation MakeInvalidOperation(SyntaxNode syntax, ITypeSymbol? type, IOperation child1, IOperation child2) 3300private static IOperation MakeInvalidOperation(SyntaxNode syntax, ITypeSymbol? type, ImmutableArray<IOperation> children) 3312private static IsNullOperation MakeIsNullOperation(IOperation operand, ITypeSymbol booleanType) 3330ITypeSymbol? valueType = value.Type; 3531ITypeSymbol? testExpressionType = testExpression.Type; 3785private void AddExceptionStore(ITypeSymbol exceptionType, IOperation? exceptionDeclarationOrExpression) 3961ITypeSymbol iDisposable = isAsynchronous 4112private void AddDisposingFinally(IOperation resource, bool requiresRuntimeConversion, ITypeSymbol iDisposable, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, bool isAsynchronous) 4204bool isNotNullableValueType([NotNullWhen(true)] ITypeSymbol? type) 4210private IOperation ConvertToIDisposable(IOperation operand, ITypeSymbol iDisposable, bool isTryCast = false) 4273ITypeSymbol objectType = _compilation.GetSpecialType(SpecialType.System_Object); 4537var iDisposable = isAsynchronous 4559IOperation applyConversion(IConvertibleConversion? conversionOpt, IOperation operand, ITypeSymbol? targetType) 4742ITypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean); 4755ITypeSymbol? stepEnumUnderlyingTypeOrSelf = ITypeSymbolHelpers.GetEnumUnderlyingTypeOrSelf(operation.StepValue.Type); 4926ITypeSymbol? stepValueEnumUnderlyingTypeOrSelf = ITypeSymbolHelpers.GetEnumUnderlyingTypeOrSelf(stepValue.Type); 5662private IOperation MakeNullable(IOperation operand, ITypeSymbol type) 5832ITypeSymbol booleanType = _compilation.GetSpecialType(SpecialType.System_Boolean);
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (2)
19public readonly ITypeSymbol? ExceptionType; 31public RegionBuilder(ControlFlowRegionKind kind, ITypeSymbol? exceptionType = null, ImmutableArray<ILocalSymbol> locals = default, bool isStackSpillRegion = false)
Operations\ControlFlowRegion.cs (2)
31public ITypeSymbol? ExceptionType { get; } 68ITypeSymbol? exceptionType,
Operations\IOperation.cs (1)
40ITypeSymbol? Type { get; }
Operations\Loops\ForEachLoopOperationInfo.cs (2)
15public readonly ITypeSymbol ElementType; 44ITypeSymbol elementType,
Operations\Operation.cs (1)
75public abstract ITypeSymbol? Type { get; }
Operations\OperationNodes.cs (16)
18public NoneOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 64public override ITypeSymbol? Type { get; } 82public ITypeSymbol? ConstrainedToType => Conversion.ConstrainedToType; 87public InvalidOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 135public override ITypeSymbol? Type { get; } 169public override ITypeSymbol? Type => null; 205public override ITypeSymbol? ConstrainedToType => null; 235protected HasDynamicArgumentsExpression(ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 247public override ITypeSymbol? Type { get; } 252public DynamicObjectCreationOperation(IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 334public DynamicInvocationOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 416public DynamicIndexerAccessOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 641public FlowCaptureReferenceOperation(int id, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isInitialization = false) : 658public IsNullOperation(SyntaxNode syntax, IOperation operand, ITypeSymbol type, ConstantValue? constantValue) : 667public CaughtExceptionOperation(SyntaxNode syntax, ITypeSymbol type) : 675public StaticLocalInitializationSemaphoreOperation(ILocalSymbol local, SyntaxNode syntax, ITypeSymbol type) :
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (2)
133protected void AddNonNullConstantValue(ITypeSymbol type, object constantValue, bool preferNumericValueOrExpandedFlagsForEnum = false) 181private static bool IsFlagsEnum(ITypeSymbol typeSymbol)
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (5)
52var type1 = GetSymbolType(normalSymbol); 53var type2 = GetSymbolType(typeOnlySymbol); 97protected static ITypeSymbol? GetSymbolType(ISymbol symbol) 126return aliasSymbol.Target as ITypeSymbol; 129return symbol as ITypeSymbol;
SymbolDisplay\SymbolDisplayPart.cs (1)
29/// For example, the <see cref="ITypeSymbol"/> associated with a class name.
Symbols\IArrayTypeSymbol.cs (1)
50ITypeSymbol ElementType { get; }
Symbols\IDiscardSymbol.cs (1)
18ITypeSymbol Type { get; }
Symbols\IEventSymbol.cs (1)
22ITypeSymbol Type { get; }
Symbols\IFieldSymbol.cs (1)
77ITypeSymbol Type { get; }
Symbols\ILocalSymbol.cs (1)
19ITypeSymbol Type { get; }
Symbols\IMethodSymbol.cs (7)
94ITypeSymbol ReturnType { get; } 106ImmutableArray<ITypeSymbol> TypeArguments { get; } 164ITypeSymbol? ReceiverType { get; } 185ITypeSymbol? GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter); 191IMethodSymbol? ReduceExtensionMethod(ITypeSymbol receiverType); 247IMethodSymbol Construct(params ITypeSymbol[] typeArguments); 252IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations);
Symbols\INamedTypeSymbol.cs (3)
80ImmutableArray<ITypeSymbol> TypeArguments { get; } 130INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments); 135INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations);
Symbols\IParameterSymbol.cs (1)
63ITypeSymbol Type { get; }
Symbols\IPointerTypeSymbol.cs (1)
23ITypeSymbol PointedAtType { get; }
Symbols\IPropertySymbol.cs (1)
63ITypeSymbol Type { get; }
Symbols\ISymbolExtensions.cs (7)
33var typeArgs = new ITypeSymbol[reducedFrom.TypeParameters.Length]; 38var arg = method.TypeArguments[i]; 54var inferredType = method.GetTypeInferredDuringReduction(reducedFrom.TypeParameters[i]); 123internal static bool IsWellKnownTypeLock(this ITypeSymbol type) 143internal static LockTypeInfo? TryFindLockTypeInfo(this ITypeSymbol lockType) 151ITypeSymbol? scopeType = enterScopeMethod.ReturnType; 172private static IMethodSymbol? TryFindPublicVoidParameterlessMethod(ITypeSymbol type, string name)
Symbols\ITypeParameterSymbol.cs (1)
85ImmutableArray<ITypeSymbol> ConstraintTypes { get; }
Symbols\ITypeSymbol.cs (16)
89new ITypeSymbol OriginalDefinition { get; } 196ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation); 203internal static bool IsNullableType([NotNullWhen(returnValue: true)] ITypeSymbol? typeOpt) 208internal static bool IsNullableOfBoolean([NotNullWhen(returnValue: true)] ITypeSymbol? type) 213internal static ITypeSymbol GetNullableUnderlyingType(ITypeSymbol type) 219internal static bool IsBooleanType([NotNullWhen(returnValue: true)] ITypeSymbol? type) 224internal static bool IsObjectType([NotNullWhen(returnValue: true)] ITypeSymbol? type) 229internal static bool IsSignedIntegralType([NotNullWhen(returnValue: true)] ITypeSymbol? type) 234internal static bool IsUnsignedIntegralType([NotNullWhen(returnValue: true)] ITypeSymbol? type) 239internal static bool IsNumericType([NotNullWhen(returnValue: true)] ITypeSymbol? type) 244internal static ITypeSymbol? GetEnumUnderlyingType(ITypeSymbol? type) 250internal static ITypeSymbol? GetEnumUnderlyingTypeOrSelf(ITypeSymbol? type) 255internal static bool IsDynamicType([NotNullWhen(returnValue: true)] ITypeSymbol? type)
Symbols\ITypeSymbolInternal.cs (2)
37/// Returns an <see cref="ITypeSymbol"/> instance associated with this symbol. 40ITypeSymbol GetITypeSymbol();
Symbols\NullableFlowState.cs (1)
31/// ignoring the <see cref="ITypeSymbol"/> to which it is attached. It should only be used when converting
Symbols\TypedConstant.cs (2)
48/// Returns the <see cref="ITypeSymbol"/> of the constant, 51public ITypeSymbol? Type
Symbols\TypedConstantValue.cs (1)
25Debug.Assert(value == null || value is string || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is System.IntPtr) && !(value is System.UIntPtr)) || value is ITypeSymbol);
Microsoft.CodeAnalysis.CodeStyle (308)
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (5)
41protected abstract (CommonConversion conversion, ITypeSymbol? collectionElementType) GetForEachInfo(SemanticModel semanticModel, TForEachStatementSyntax node); 68variableDeclarator.Symbol.Type is not ITypeSymbol iterationType) 74var collectionType = semanticModel.GetTypeInfo(syntaxFacts.GetExpressionOfForeachStatement(node), cancellationToken).Type; 157private static bool IsStronglyTyped(ITypeSymbol collectionType, ITypeSymbol collectionElementType)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
182if (symbol is ITypeSymbol typeSymbol && typeSymbol.DeclaringSyntaxReferences.Length > 1)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (5)
60var type = value.Type; 82private (bool missingCases, bool missingDefaultCase) AnalyzeSwitch(TSwitchOperation switchOperation, ITypeSymbol type) 84var typeWithoutNullable = type.RemoveNullableIfPresent(); 100private (bool missingCases, bool missingDefaultCase) AnalyzeBooleanSwitch(TSwitchOperation operation, ITypeSymbol type) 117private (bool missingCases, bool missingDefaultCase) AnalyzeEnumSwitch(TSwitchOperation operation, ITypeSymbol type)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (4)
19var switchExpressionType = switchExpression?.Type; 25switchExpressionType = switchExpressionType.IsNullable(out var underlyingType) ? underlyingType : switchExpressionType; 108var type = operation.Value.Type; 109var underlyingType = type.RemoveNullableIfPresent();
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (5)
58var switchExpressionType = switchExpression?.Type; 66switchExpressionType = switchExpressionType.IsNullable(out var underlyingType) ? underlyingType : switchExpressionType; 152ITypeSymbol enumType, 185var type = operation.Value.Type; 186var underlyingType = type.RemoveNullableIfPresent();
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
85var leftType = leftOperand.Type; 86var rightType = rightOperand.Type;
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
61var compilerAnalyzerType = assembly.GetType(compilerAnalyzerTypeName)!;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
292ITypeSymbol containingType,
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
166var exprType = semanticModel.GetTypeInfo(initializer, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
104var conditionType = semanticModel.GetTypeInfo(
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
187var type = this.SemanticModel.GetTypeInfo(_objectCreationExpression, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
252var convertedType = this.SemanticModel.GetTypeInfo(SyntaxFacts.GetExpressionOfArgument(arguments[0]), cancellationToken).ConvertedType;
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (2)
81static bool AreEqualOrHaveImplicitConversion(ITypeSymbol? firstType, ITypeSymbol? secondType, Compilation compilation)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
154var parameterType = semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (3)
147var whenPartType = semanticModel.GetTypeInfo(whenPartMatch, cancellationToken).Type; 151var type = semanticModel.GetTypeInfo(conditionalExpression, cancellationToken).Type; 359var typeSymbol = semanticModel.GetTypeInfo(type, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
85var whenPartType = semanticModel.GetTypeInfo(whenPartMatch, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (2)
122var type = this.SemanticModel.GetTypeInfo(_objectCreationExpression, cancellationToken).Type; 175ITypeSymbol classOrStructType,
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
186var argsArgumentType = TryGetArgsArgumentType(semanticModel, arguments, parameters, syntaxFacts); 190private ITypeSymbol? TryGetArgsArgumentType(
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
407var typeSymbol = result.Value.Type; 696private ITypeSymbol ParseArrayType(ITypeSymbol typeSymbol) 764var boundReturnType = BindParameterOrReturnType(methodSymbol, returnType.Value); 801var parameterType = BindParameterOrReturnType(symbol.ContainingSymbol, parameterInfo.Type); 806private ITypeSymbol BindParameterOrReturnType(ISymbol bindingContext, TypeInfo type) 868public readonly ITypeSymbol Type; 876private TypeInfo(ITypeSymbol type, int startIndex) 882public static TypeInfo Create(ITypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (2)
36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol) 665public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (21)
163=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 166=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 169=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 175=> symbol is ITypeSymbol { IsTupleType: true }; 244=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 275public static ITypeSymbol? GetMemberType(this ISymbol? symbol) 387public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol) 395public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol) 397var results = ArrayBuilder<ITypeSymbol>.GetInstance(); 411=> (symbol as ITypeSymbol)?.IsAttribute() == true; 425public static ITypeSymbol ConvertToType( 430if (symbol is ITypeSymbol type) 502public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination) 561public static ITypeSymbol? GetSymbolType(this ISymbol? symbol) 568IAliasSymbol aliasSymbol => aliasSymbol.Target as ITypeSymbol, 569_ => symbol as ITypeSymbol, 580ITypeSymbol? typeSymbol = null; 584typeSymbol = symbol as ITypeSymbol; 613var returnType = getAwaiter.ReturnType; 647var returnType = getEnumerator.ReturnType; 687var returnType = getAsyncEnumerator.ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (9)
19ITypeSymbol? throughType = null) 41ITypeSymbol? throughType = null) 53ITypeSymbol? throughType = null) 66ITypeSymbol? throughType, 85ITypeSymbol? throughType, 188foreach (var typeArg in type.TypeArguments) 248ITypeSymbol? throughType, 333ITypeSymbol? throughType, 373var originalThroughType = throughType?.OriginalDefinition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeGenerator.cs (6)
9ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank); 10ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType); 11ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (1)
15private static INamedTypeSymbol? GetNamedTypeSymbol(ITypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (8)
14private sealed class AnonymousTypeRemover(Compilation compilation) : SymbolVisitor<ITypeSymbol> 16public override ITypeSymbol DefaultVisit(ISymbol node) 19public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 22public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 33public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 41public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 53public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 64public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (2)
56foreach (var child in symbol.GetAllTypeArguments()) 85foreach (var constraint in symbol.ConstraintTypes)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CompilationTypeGenerator.cs (6)
13public ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank) 16public ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 19public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (98)
22public static bool IsIntegralType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 25public static bool IsSignedIntegralType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 28public static bool CanAddNullCheck([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 39public static IList<INamedTypeSymbol> GetAllInterfacesIncludingThis(this ITypeSymbol type) 55public static bool IsAbstractClass([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 58public static bool IsSystemVoid([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 61public static bool IsNullable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 64public static bool IsNonNullableValueType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 68[NotNullWhen(true)] this ITypeSymbol? symbol, 69[NotNullWhen(true)] out ITypeSymbol? underlyingType) 81public static bool IsModuleType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 84public static bool IsInterfaceType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 87public static bool IsDelegateType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 90public static bool IsFunctionPointerType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 93public static bool IsStructType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 100this ITypeSymbol type, 114public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol? type) 116var current = type; 124public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol type) 134public static IEnumerable<ITypeSymbol> GetContainingTypesAndThis(this ITypeSymbol? type) 136var current = type; 144public static IEnumerable<INamedTypeSymbol> GetContainingTypes(this ITypeSymbol type) 157this ITypeSymbol type, ITypeSymbol baseType, bool includeInterfaces) 170this ITypeSymbol type, ITypeSymbol baseType) 178this ITypeSymbol type, ITypeSymbol baseType) 180var originalBaseType = baseType.OriginalDefinition; 188IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 195this ITypeSymbol type, ITypeSymbol baseType) 197var originalBaseType = baseType.OriginalDefinition; 217this ITypeSymbol type, ITypeSymbol interfaceType) 219var originalInterfaceType = interfaceType.OriginalDefinition; 224this ITypeSymbol type, ITypeSymbol interfaceType) 229public static bool IsAttribute(this ITypeSymbol symbol) 247public static bool IsFormattableStringOrIFormattable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 256this ITypeSymbol typeSymbol, bool allowDelegateAndEnumConstraints = false) 284public static bool IsNumericType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 310public static Accessibility DetermineMinimalAccessibility(this ITypeSymbol typeSymbol) 313public static bool ContainsAnonymousType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 329foreach (var typeArg in type.GetAllTypeArguments()) 338public static string CreateParameterName(this ITypeSymbol type, bool capitalize = false) 359private static string GetParameterName(ITypeSymbol? type) 372public static bool IsSpecialType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 403public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within) 414public static INamedTypeSymbol? GetDelegateType(this ITypeSymbol? typeSymbol, Compilation compilation) 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 434public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol 443public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol 453public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol 463public static bool? AreMoreSpecificThan(this IList<ITypeSymbol> t1, IList<ITypeSymbol> t2) 498public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol 508private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol 518private static bool? IsMoreSpecificThan(this ITypeSymbol t1, ITypeSymbol t2) 597public static bool IsOrDerivesFromExceptionType([NotNullWhen(returnValue: true)] this ITypeSymbol? type, Compilation compilation) 604foreach (var baseType in type.GetBaseTypesAndThis()) 615foreach (var constraint in ((ITypeParameterSymbol)type).ConstraintTypes) 630public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type) 633public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type, [NotNullWhen(true)] out INamedTypeSymbol? enumType) 645public static bool? IsMutableValueType(this ITypeSymbol type) 647if (type.IsNullable(out var underlyingType)) 724public static bool IsDisposable([NotNullWhen(returnValue: true)] this ITypeSymbol? type, [NotNullWhen(returnValue: true)] ITypeSymbol? iDisposableType) 729public static ITypeSymbol WithNullableAnnotationFrom(this ITypeSymbol type, ITypeSymbol symbolForNullableAnnotation) 733public static ITypeSymbol? RemoveNullableIfPresent(this ITypeSymbol? symbol) 735if (symbol.IsNullable(out var underlyingType)) 743public static bool IsSpanOrReadOnlySpan([NotNullWhen(true)] this ITypeSymbol? type) 746public static bool IsSpan([NotNullWhen(true)] this ITypeSymbol? type) 762public static bool IsInlineArray([NotNullWhen(true)] this ITypeSymbol? type) 767public static ITypeSymbol? RemoveUnavailableTypeParameters( 768this ITypeSymbol? type, 776private static ITypeSymbol? RemoveUnavailableTypeParameters( 777this ITypeSymbol? type, 785public static ITypeSymbol? RemoveAnonymousTypes( 786this ITypeSymbol? type, 793public static ITypeSymbol? RemoveUnnamedErrorTypes( 794this ITypeSymbol? type, 800this ITypeSymbol? type, IList<ITypeParameterSymbol>? result = null) 808this ITypeSymbol? type, IList<ITypeParameterSymbol>? result = null) 816public static ITypeSymbol? SubstituteTypes<TType1, TType2>( 817this ITypeSymbol? type, 820where TType1 : ITypeSymbol 821where TType2 : ITypeSymbol 827public static ITypeSymbol? SubstituteTypes<TType1, TType2>( 828this ITypeSymbol? type, 831where TType1 : ITypeSymbol 832where TType2 : ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
52foreach (var arg in symbol.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (18)
15private sealed class SubstituteTypesVisitor<TType1, TType2> : SymbolVisitor<ITypeSymbol> 16where TType1 : ITypeSymbol 17where TType2 : ITypeSymbol 31public override ITypeSymbol DefaultVisit(ISymbol node) 34private ITypeSymbol VisitType(ITypeSymbol symbol) 44public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 47public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol) 50public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 57public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 59var mapped = VisitType(symbol); 78var updatedContainingType = symbol.ContainingType?.Accept(this); 95public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 97var mapped = VisitType(symbol); 103var elementType = symbol.ElementType.Accept(this); 112public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 114var mapped = VisitType(symbol); 120var pointedAtType = symbol.PointedAtType.Accept(this);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (8)
15private sealed class UnavailableTypeParameterRemover(Compilation compilation, ISet<string> availableTypeParameterNames) : SymbolVisitor<ITypeSymbol> 17public override ITypeSymbol DefaultVisit(ISymbol node) 20public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 23public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 34public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 40public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 51public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 62public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (8)
14private sealed class UnnamedErrorTypeRemover(Compilation compilation) : SymbolVisitor<ITypeSymbol> 16public override ITypeSymbol DefaultVisit(ISymbol node) 19public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 22public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 33public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 39public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 55public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 66public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (4)
150public static string GenerateNameFromType(this SemanticModel semanticModel, ITypeSymbol type, ISyntaxFacts syntaxFacts, bool capitalize) 181private static bool ShouldPluralize(this SemanticModel semanticModel, ITypeSymbol type) 196ImmutableArray<ITypeSymbol> typeArguments, 231public static ITypeSymbol GetType(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (1)
367SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (2)
15public readonly ITypeSymbol ElementType; 21ITypeSymbol elementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
118private static bool IsFloatingPoint([NotNullWhen(returnValue: true)] ITypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
41using var propertyTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ArrayTypeSymbolKey.cs (1)
32foreach (var typeSymbol in elementTypeResolution.OfType<ITypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (3)
30using var parameterTypes = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 47var returnTypeSymbol = (ITypeSymbol?)returnType.GetAnySymbol();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (2)
45visitor.WriteSymbolKeyArray(ImmutableArray<ITypeSymbol>.Empty); 73using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
58using var parameterTypes = reader.ReadSymbolKeyArray<IFunctionPointerTypeSymbol, ITypeSymbol>( 78if (returnType.GetAnySymbol() is not ITypeSymbol returnTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (5)
45foreach (var receiverType in receiverTypeResolution.OfType<ITypeSymbol>()) 71using var typeArguments = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 224_ = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 247var returnType = (ITypeSymbol?)reader.ReadSymbolKey(contextualSymbol: method.ReturnType, out _).GetAnySymbol();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (6)
35visitor.WriteSymbolKeyArray(ImmutableArray<ITypeSymbol>.Empty); 50using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 96ITypeSymbol[] typeArgumentsArray, 146ITypeSymbol[] typeArgumentsArray, 173ITypeSymbol[] typeArguments) 197private static INamedTypeSymbol Construct(INamedTypeSymbol type, bool isUnboundGenericType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PointerTypeSymbolKey.cs (1)
34foreach (var typeSymbol in pointedAtTypeResolution.OfType<ITypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
71_ = reader.ReadSymbolKeyArray<IPropertySymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (2)
383Func<TOwningSymbol, int, ITypeSymbol?> getContextualType, 387using var originalParameterTypes = this.ReadSymbolKeyArray<TOwningSymbol, ITypeSymbol>(owningSymbol, getContextualType, out _);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
98using var elementTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (25)
104protected abstract TConversion ClassifyConversion(SemanticModel model, TExpressionSyntax expression, ITypeSymbol targetType); 105protected abstract TConversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType); 107protected abstract bool ConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType); 108protected abstract bool IsReferenceConversion(Compilation model, ITypeSymbol sourceType, ITypeSymbol targetType); 114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables); 304private bool ImplicitConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType) 740var previousOriginalType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode).Type; 741var previousReplacedType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode).Type; 780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType, out var originalLocalVariables); 781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType, out var newLocalVariables); 826var expressionType = this.SpeculativeSemanticModel.GetTypeInfo(newForEachStatementExpression, CancellationToken).ConvertedType; 849var originalThrowExpressionType = this.OriginalSemanticModel.GetTypeInfo(originalThrowExpression).Type; 851var newThrowExpressionType = this.SpeculativeSemanticModel.GetTypeInfo(newThrowExpression).Type; 964var originalTargetType = this.OriginalSemanticModel.GetTypeInfo(originalLeft).Type; 967var newTargetType = this.SpeculativeSemanticModel.GetTypeInfo(newLeft).Type; 1000var newReceiverType = newReceiver != null 1039var receiverType = semanticModel.GetTypeInfo(receiver).Type; 1199ITypeSymbol originalTargetType, 1201ITypeSymbol newTargetType, 1216var originalConvertedTypeSymbol = this.OriginalSemanticModel.GetTypeInfo(originalExpression).ConvertedType; 1222var newConvertedTypeSymbol = this.SpeculativeSemanticModel.GetTypeInfo(newExpression).ConvertedType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (1)
25private IEqualityComparer<ITypeSymbol> SignatureTypeEquivalenceComparer => _symbolEquivalenceComparer.SignatureTypeEquivalenceComparer;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (1)
196=> symbol.IsKind(SymbolKind.NamedType, out ITypeSymbol? typeSymbol) && typeSymbol.SpecialType == SpecialType.System_Object;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
94private bool NullableAnnotationsEquivalent(ITypeSymbol x, ITypeSymbol y) 492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
47return Hash.Combine(GetNullableAnnotationsHashCode((ITypeSymbol)x), Hash.Combine(typeof(IDynamicTypeSymbol), currentHash)); 53private int GetNullableAnnotationsHashCode(ITypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.SignatureTypeSymbolEquivalenceComparer.cs (6)
11internal sealed class SignatureTypeSymbolEquivalenceComparer(SymbolEquivalenceComparer symbolEquivalenceComparer) : IEqualityComparer<ITypeSymbol?> 13public bool Equals(ITypeSymbol? x, ITypeSymbol? y) 16public bool Equals(ITypeSymbol? x, ITypeSymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 19public int GetHashCode(ITypeSymbol? x)
Microsoft.CodeAnalysis.CodeStyle.Fixes (234)
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (11)
30protected abstract TExpressionSyntax Cast(TExpressionSyntax expression, ITypeSymbol type); 48protected ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> GetPotentialTargetTypes( 52using var _ = ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)>.GetInstance(out var candidates); 63ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> candidates, 120ITypeSymbol conversionType, 143var castType = semanticModel.GetTypeInfo(castTypeNode, cancellationToken).Type; 161protected virtual (SyntaxNode finalTarget, SyntaxNode finalReplacement) Cast(SemanticModel semanticModel, TExpressionSyntax targetNode, ITypeSymbol conversionType) 164private static string GetSubItemName(SemanticModel semanticModel, int position, ITypeSymbol conversionType) 171private static ImmutableArray<(TExpressionSyntax, ITypeSymbol)> FilterValidPotentialConversionTypes( 174ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> candidates) 179using var _ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(candidates.Count, out var validPotentialConversionTypes);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (7)
24protected abstract TArgumentSyntax GenerateNewArgument(TArgumentSyntax oldArgument, ITypeSymbol conversionType); 38public ImmutableArray<(TExpressionSyntax, ITypeSymbol)> GetPotentialConversionTypes( 60using var __ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(out var mutablePotentialConversionTypes); 65targetArgument, cancellationToken, out var targetArgumentConversionType) 116[NotNullWhen(true)] out ITypeSymbol? targetArgumentConversionType) 153var parameterType = parameters[parameterIndex].Type; 169&& semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type is ITypeSymbol argumentType
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (8)
34: IComparer<(TExpressionSyntax syntax, ITypeSymbol symbol)> 39public int Compare((TExpressionSyntax syntax, ITypeSymbol symbol) x, 40(TExpressionSyntax syntax, ITypeSymbol symbol) y) 49var baseType = _semanticModel.GetTypeInfo(x.syntax).Type; 59private static int GetInheritanceDistanceRecursive(ITypeSymbol baseType, ITypeSymbol? derivedType) 83private int GetInheritanceDistance(ITypeSymbol? baseType, ITypeSymbol castType)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (4)
38protected abstract ITypeSymbol GetArgumentType(SyntaxNode argumentNode, SemanticModel semanticModel, CancellationToken cancellationToken); 393private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken) 397var argumentType = GetArgumentType(argument, semanticModel, cancellationToken); 535Compilation compilation, TypeInfo argumentTypeInfo, ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
76ITypeSymbol newParameterType, 161ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (7)
26protected abstract string GetTextPreviewOfChange(string aliasName, ITypeSymbol typeSymbol); 54foreach (var symbol in Sort(symbolInfo.CandidateSymbols.Cast<ITypeSymbol>(), placementOption.PlaceSystemNamespaceFirst)) 78private static IEnumerable<ITypeSymbol> Sort(IEnumerable<ITypeSymbol> types, bool sortSystemFirst) 82var typeToNameSegments = new Dictionary<ITypeSymbol, ImmutableArray<string>>(); 108ImmutableArray<string> GetNameSegments(ITypeSymbol symbol)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
25protected abstract ITypeSymbol GetForEachElementType(SemanticModel semanticModel, TForEachStatementSyntax forEachStatement); 73var elementType = GetForEachElementType(semanticModel, forEachStatement); 88ITypeSymbol iterationVariableType,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (3)
38protected abstract ITypeSymbol GetArgumentType(SemanticModel semanticModel, Argument argument, CancellationToken cancellationToken); 41protected abstract bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (9)
49public ImmutableArray<ITypeSymbol> ParameterTypes; 280internal ImmutableArray<ITypeSymbol> GetParameterTypes(CancellationToken cancellationToken) 289private static ITypeSymbol FixType(ITypeSymbol typeSymbol, SemanticModel semanticModel, IEnumerable<ITypeParameterSymbol> allTypeParameters) 363private static bool IsValidAttributeParameterType(ITypeSymbol type) 410ImmutableArray<ITypeSymbol> parameterTypes, 423var parameterType = parameterTypes[i]; 448ITypeSymbol parameterType, 537ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
28protected abstract ITypeSymbol DetermineReturnTypeForSimpleNameOrMemberAccessExpression(ITypeInferenceService typeInferenceService, SemanticModel semanticModel, TExpressionSyntax expression, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
181var expressionType = service.DetermineReturnTypeForSimpleNameOrMemberAccessExpression(typeInference, semanticModel, SimpleNameOrMemberAccessExpression, cancellationToken); 248ITypeSymbol expressionType)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (6)
83private List<ITypeSymbol> MergeClassTypes(List<ITypeSymbol> classTypes) 89var type1 = classTypes[i]; 96var type2 = classTypes[j]; 113protected abstract bool IsImplicitReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (3)
24protected override ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken) 39protected override ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken) 47protected override ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (12)
40private IDictionary<ITypeSymbol, ITypeParameterSymbol> _typeArgumentToTypeParameterMap; 52public ValueTask<ITypeSymbol> DetermineReturnTypeAsync(CancellationToken cancellationToken) 54var type = DetermineReturnTypeWorker(cancellationToken); 63protected abstract ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken); 64protected abstract ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken); 66protected abstract ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken); 102var returnType = await DetermineReturnTypeAsync(cancellationToken).ConfigureAwait(false); 144private async ValueTask<ITypeSymbol> FixTypeAsync( 145ITypeSymbol typeSymbol, 167private IDictionary<ITypeSymbol, ITypeParameterSymbol> GetTypeArgumentToTypeParameterMap( 173private IDictionary<ITypeSymbol, ITypeParameterSymbol> CreateTypeArgumentToTypeParameterMap( 183var result = new Dictionary<ITypeSymbol, ITypeParameterSymbol>(SymbolEqualityComparer.Default);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (8)
21private static async ValueTask<ITypeSymbol> ReplaceTypeParametersBasedOnTypeConstraintsAsync( 23ITypeSymbol type, 38public readonly Dictionary<ITypeSymbol, ITypeSymbol> Substitutions = []; 52foreach (var typeArg in symbol.TypeArguments) 80var commonDerivedType = await DetermineCommonDerivedTypeAsync(symbol).ConfigureAwait(false); 85private async ValueTask<ITypeSymbol> DetermineCommonDerivedTypeAsync(ITypeParameterSymbol symbol) 114var substitutedType = await ReplaceTypeParametersBasedOnTypeConstraintsAsync(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
37protected abstract bool TryConvertToLocalDeclaration(ITypeSymbol type, SyntaxToken identifierToken, SemanticModel semanticModel, CancellationToken cancellationToken, out SyntaxNode newRoot);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (3)
44public ITypeSymbol TypeMemberType { get; private set; } 45public ITypeSymbol LocalType { get; private set; } 435var inferredType = typeInference.InferType(
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
302private static bool InheritsFromOrEquals(ITypeSymbol type, ITypeSymbol baseType) 305private static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(ITypeSymbol? type) 307var current = type;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (6)
21Func<ITypeSymbol, bool> includeMemberType, 157foreach (var typeArg in methodSymbol.TypeArguments) 173private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, HashSet<ITypeSymbol> alreadyCheckingTypes) 182foreach (var constraint in typeParameter.ConstraintTypes) 203foreach (var genericParam in namedType.TypeArguments)
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
26protected abstract bool IsAsyncReturnType(ITypeSymbol type, KnownTaskTypes knownTypes);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (2)
39protected abstract ITypeSymbol GetSwitchType(TSwitchOperation switchStatement); 164var enumType = GetSwitchType(switchOperation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
43protected sealed override ITypeSymbol GetSwitchType(ISwitchExpressionOperation switchExpression)
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
59protected sealed override ITypeSymbol GetSwitchType(ISwitchOperation switchOperation)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (6)
108private static bool ShouldOfferFix(ITypeSymbol returnType, KnownTaskTypes knownTypes) 113private static bool IsTaskType(ITypeSymbol returnType, KnownTaskTypes knownTypes) 122ITypeSymbol returnType, 185ITypeSymbol returnType, 214private static SyntaxNode GetReturnTaskCompletedTaskStatement(SyntaxGenerator generator, ITypeSymbol returnType, KnownTaskTypes knownTypes) 231private static SyntaxNode WrapExpressionWithTaskFromResult(SyntaxGenerator generator, SyntaxNode expression, ITypeSymbol returnType, KnownTaskTypes knownTypes)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
602var type = semanticModel.GetTypeInfo(node, cancellationToken).Type; 687TLocalDeclarationStatementSyntax CreateLocalDeclarationStatement(ITypeSymbol type, string name)
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (1)
29protected virtual ITypeSymbol? TryGetExplicitCast(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (2)
113public TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 140public abstract TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType) 133public static bool TypesMatch(ITypeSymbol? type, object value)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (18)
35DeclarationModifiers modifiers, ITypeSymbol type, 52ITypeSymbol type, 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 110ITypeSymbol type, string name, 156ITypeSymbol? returnType, 178ITypeSymbol? returnType, 199ITypeSymbol returnType, 224ITypeSymbol toType, 252ITypeSymbol toType, 268public static IParameterSymbol CreateParameterSymbol(ITypeSymbol type, string name) 271public static IParameterSymbol CreateParameterSymbol(RefKind refKind, ITypeSymbol type, string name) 281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null) 294ITypeSymbol? type = null, 335ImmutableArray<ITypeSymbol> constraintTypes, 351public static IPointerTypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 357public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 467ITypeSymbol returnType, 524ITypeSymbol? returnType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (1)
119TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\NullableSyntaxAnnotation.cs (1)
10/// Annotation placed on <see cref="ITypeSymbol"/>s that the <see cref="SyntaxGenerator"/> converts to a node. This
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (7)
46public abstract ITypeSymbol ReturnType { get; } 47public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; } 55public abstract ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter); 56public abstract IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType); 66public virtual ITypeSymbol ReceiverType => this.ContainingType; 111public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 114public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
58public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 69public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 89public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 12public ITypeSymbol ElementType { get; } = elementType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (6)
14private readonly ImmutableArray<ITypeSymbol> _typeArguments; 18ImmutableArray<ITypeSymbol> typeArguments) 47public override ITypeSymbol ReturnType 56public override ImmutableArray<ITypeSymbol> TypeArguments => _typeArguments; 84public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 87public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (3)
16private readonly ImmutableArray<ITypeSymbol> _typeArguments; 20ImmutableArray<ITypeSymbol> typeArguments, 31public override ImmutableArray<ITypeSymbol> TypeArguments => _typeArguments;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
22ITypeSymbol toType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (2)
20ITypeSymbol type, 27public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (2)
22ITypeSymbol type, 27public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (6)
21public override ITypeSymbol ReturnType { get; } 32ITypeSymbol returnType, 100public override ImmutableArray<ITypeSymbol> TypeArguments 101=> this.TypeParameters.As<ITypeSymbol>(); 114public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 117public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (2)
127public override ImmutableArray<ITypeSymbol> TypeArguments 131return this.TypeParameters.As<ITypeSymbol>();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
23ITypeSymbol returnType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (2)
22ITypeSymbol type, 32public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 11public ITypeSymbol PointedAtType { get; } = pointedAtType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (2)
22ITypeSymbol type, 31public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
17ImmutableArray<ITypeSymbol> constraintTypes, 27public ImmutableArray<ITypeSymbol> ConstraintTypes { get; internal set; } = constraintTypes;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (6)
56public static ImmutableArray<ITypeSymbol> TupleElementTypes => default; 60public new ITypeSymbol OriginalDefinition => this; 80bool ITypeSymbol.IsRefLikeType => throw new System.NotImplementedException(); 82bool ITypeSymbol.IsUnmanagedType => throw new System.NotImplementedException(); 84bool ITypeSymbol.IsReadOnly => Modifiers.IsReadOnly; 90public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\TypeGenerator.cs (6)
15public ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank) 18public ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 21public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ContextQuery\SyntaxContext.cs (1)
56public ImmutableArray<ITypeSymbol> InferredTypes { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
56var mapping = new Dictionary<ITypeSymbol, ITypeSymbol>(SymbolEqualityComparer.Default); 110var mapping = new Dictionary<ITypeSymbol, ITypeSymbol>(SymbolEqualityComparer.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (7)
15public static ImmutableArray<ITypeSymbol> InferTypes(this ITypeInferenceService service, SemanticModel semanticModel, SyntaxNode expression, CancellationToken cancellationToken) 18public static ImmutableArray<ITypeSymbol> InferTypes(this ITypeInferenceService service, SemanticModel semanticModel, int position, CancellationToken cancellationToken) 47private static INamedTypeSymbol? GetFirstDelegateType(SemanticModel semanticModel, ImmutableArray<ITypeSymbol> types) 53public static ITypeSymbol? InferType( 65public static ITypeSymbol? InferType( 83public static ITypeSymbol? InferType( 95public static ITypeSymbol? InferType(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\KnownTypes.cs (1)
20public bool IsTaskLike(ITypeSymbol returnType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (3)
77ITypeSymbol type) 87private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol) 331var parameterType = parameter.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (3)
365public static string? GetLocalName(this ITypeSymbol containingType, string? fallback = "v") 387private static bool ImplementsIEquatable(ITypeSymbol memberType, INamedTypeSymbol iequatableType) 400private static bool ShouldUseEqualityOperator(ITypeSymbol typeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
457var type = variableExpression.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (3)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync) 128var currentType = type; 144var currentType = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\ISemanticFactsService.cs (1)
47CommonConversion ClassifyConversion(SemanticModel semanticModel, SyntaxNode expression, ITypeSymbol destination);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (2)
85/// Produces an appropriate TypeSyntax for the given <see cref="ITypeSymbol"/>. The <paramref name="typeContext"/> 99public abstract SyntaxNode Type(ITypeSymbol typeSymbol, bool typeContext);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (5)
39protected abstract bool IsUnusableType(ITypeSymbol arg); 86protected static IEnumerable<TypeInferenceInfo> CreateResult(ITypeSymbol type) 89protected static IEnumerable<ITypeSymbol> ExpandParamsParameter(IParameterSymbol parameterSymbol) 91var result = new List<ITypeSymbol> 113var elementType = parameters.ElementAtOrDefault(0);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (5)
17private static ImmutableArray<ITypeSymbol> InferTypeBasedOnNameIfEmpty( 18SemanticModel semanticModel, ImmutableArray<ITypeSymbol> result, string nameOpt) 43private static ImmutableArray<ITypeSymbol> InferTypeBasedOnName( 81public ImmutableArray<ITypeSymbol> InferTypes( 93public ImmutableArray<ITypeSymbol> InferTypes(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\ITypeInferenceService.cs (4)
29ImmutableArray<ITypeSymbol> InferTypes(SemanticModel semanticModel, SyntaxNode expression, string nameOpt, CancellationToken cancellationToken); 30ImmutableArray<ITypeSymbol> InferTypes(SemanticModel semanticModel, int position, string nameOpt, CancellationToken cancellationToken); 36internal readonly record struct TypeInferenceInfo(ITypeSymbol InferredType, bool IsParams) 38public TypeInferenceInfo(ITypeSymbol type) : this(type, IsParams: false)
Microsoft.CodeAnalysis.CSharp (254)
Binder\Semantics\Conversions\Conversion.cs (1)
1030public ITypeSymbol? ConstrainedToType
BoundTree\BoundExpression.cs (1)
144public CodeAnalysis.ITypeSymbol? GetPublicTypeSymbol()
Compilation\CSharpCompilation.cs (22)
1778protected override ITypeSymbol? CommonScriptGlobalsType 2286public Conversion ClassifyConversion(ITypeSymbol source, ITypeSymbol destination) 2320public override CommonConversion ClassifyCommonConversion(ITypeSymbol source, ITypeSymbol destination) 2326internal override IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol? destination, out ConstantValue? constantValue) 2335ITypeSymbol? sourceType = source.Type; 2394ITypeSymbol? throughType) 2410ITypeSymbol? throughType = null) 4004protected override IArrayTypeSymbol CommonCreateArrayTypeSymbol(ITypeSymbol elementType, int rank, CodeAnalysis.NullableAnnotation elementNullableAnnotation) 4009protected override IPointerTypeSymbol CommonCreatePointerTypeSymbol(ITypeSymbol elementType) 4015ITypeSymbol returnType, 4017ImmutableArray<ITypeSymbol> parameterTypes, 4112ImmutableArray<ITypeSymbol> elementTypes, 4120ITypeSymbol typeSymbol = elementTypes[i]; 4167ImmutableArray<ITypeSymbol> memberTypes, 4201ITypeSymbol returnType, 4202ITypeSymbol leftType, 4203ITypeSymbol rightType) 4427ITypeSymbol returnType, 4428ITypeSymbol operandType) 4501protected override ITypeSymbol CommonDynamicType
Compilation\CSharpSemanticModel.cs (5)
575private static SymbolInfo GetSymbolInfoFromSymbolOrNone(ITypeSymbol type) 589private (ITypeSymbol Type, CodeAnalysis.NullableAnnotation Annotation) TypeFromVariable(SingleVariableDesignationSyntax variableDesignation, CancellationToken cancellationToken) 963var (declarationType, annotation) = ((ITypeSymbol, CodeAnalysis.NullableAnnotation))TypeFromVariable((SingleVariableDesignationSyntax)parent.Designation, cancellationToken); 2808public abstract Conversion ClassifyConversion(ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false); 2826public Conversion ClassifyConversion(int position, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false)
Compilation\ForEachStatementInfo.cs (2)
47public ITypeSymbol? ElementType { get; } 70ITypeSymbol elementType,
Compilation\MemberSemanticModel.cs (1)
431ITypeSymbol destination,
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
222ITypeSymbol destination,
Compilation\SyntaxTreeSemanticModel.cs (1)
520public override Conversion ClassifyConversion(ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false)
CSharpExtensions.cs (4)
438public static Conversion ClassifyConversion(this Compilation? compilation, ITypeSymbol source, ITypeSymbol destination) 1306public static Conversion ClassifyConversion(this SemanticModel? semanticModel, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false) 1326public static Conversion ClassifyConversion(this SemanticModel? semanticModel, int position, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false)
Errors\MessageProvider.cs (1)
264protected override void ReportInvalidNamedArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName)
Operations\CSharpOperationFactory.cs (93)
320ITypeSymbol? type = boundNode switch 423ITypeSymbol? type = boundDeconstructValuePlaceholder.GetPublicTypeSymbol(); 435ITypeSymbol? type = boundDeconstructionAssignmentOperator.GetPublicTypeSymbol(); 444ITypeSymbol? type = boundCall.GetPublicTypeSymbol(); 474ITypeSymbol? type = boundFunctionPointerInvocation.GetPublicTypeSymbol(); 557ITypeSymbol? type = boundLocal.GetPublicTypeSymbol(); 577ITypeSymbol? type = boundFieldAccess.GetPublicTypeSymbol(); 618ITypeSymbol? type = boundPropertyAccess.GetPublicTypeSymbol(); 628ITypeSymbol? type = boundIndexerAccess.GetPublicTypeSymbol(); 648ITypeSymbol? type = boundEventAccess.GetPublicTypeSymbol(); 660ITypeSymbol? type = boundEventAssignmentOperator.GetPublicTypeSymbol(); 669ITypeSymbol? type = boundParameter.GetPublicTypeSymbol(); 677ITypeSymbol? type = boundLiteral.GetPublicTypeSymbol(); 686ITypeSymbol? type = boundNode.GetPublicTypeSymbol(); 694ITypeSymbol? type = boundAnonymousObjectCreationExpression.GetPublicTypeSymbol(); 705ITypeSymbol? type = boundObjectCreationExpression.GetPublicTypeSymbol(); 742ITypeSymbol? type = boundWithExpression.GetPublicTypeSymbol(); 754ITypeSymbol? type = boundDynamicObjectCreationExpression.GetPublicTypeSymbol(); 783ITypeSymbol? type = boundDynamicInvocation.GetPublicTypeSymbol(); 826ITypeSymbol? type = boundDynamicIndexerAccess.GetPublicTypeSymbol(); 835ITypeSymbol? type = boundObjectInitializerExpression.GetPublicTypeSymbol(); 844ITypeSymbol? type = boundCollectionInitializerExpression.GetPublicTypeSymbol(); 853ITypeSymbol? type = boundObjectInitializerMember.GetPublicTypeSymbol(); 914ImmutableArray<ITypeSymbol> typeArguments = ImmutableArray<ITypeSymbol>.Empty; 915ITypeSymbol containingType = boundDynamicObjectInitializerMember.ReceiverType.GetPublicSymbol(); 917ITypeSymbol? type = boundDynamicObjectInitializerMember.GetPublicTypeSymbol(); 929ITypeSymbol? type = boundCollectionElementInitializer.GetPublicTypeSymbol(); 954ITypeSymbol? type, 957ITypeSymbol? containingType = null; 964ImmutableArray<ITypeSymbol> typeArguments = ImmutableArray<ITypeSymbol>.Empty; 979ITypeSymbol? type = boundCollectionElementInitializer.GetPublicTypeSymbol(); 1031ITypeSymbol? type = boundConversion.GetPublicTypeSymbol(); 1114ITypeSymbol? type = boundConversion.GetPublicTypeSymbol(); 1146ITypeSymbol? type = boundAsOperator.GetPublicTypeSymbol(); 1155ITypeSymbol? type = boundDelegateCreationExpression.GetPublicTypeSymbol(); 1166ITypeSymbol? bindingType = null; 1174ITypeSymbol? typeOperand = boundIsOperator.TargetType.GetPublicTypeSymbol(); 1177ITypeSymbol? type = boundIsOperator.GetPublicTypeSymbol(); 1185ITypeSymbol? typeOperand = boundSizeOfOperator.SourceType.GetPublicTypeSymbol(); 1188ITypeSymbol? type = boundSizeOfOperator.GetPublicTypeSymbol(); 1196ITypeSymbol? typeOperand = boundTypeOfOperator.SourceType.GetPublicTypeSymbol(); 1199ITypeSymbol? type = boundTypeOfOperator.GetPublicTypeSymbol(); 1209ITypeSymbol? type = boundArrayCreation.GetPublicTypeSymbol(); 1226ITypeSymbol? collectionType = expr.GetPublicTypeSymbol(); 1273var elementType = element.EnumeratorInfoOpt?.ElementType.GetPublicSymbol(); 1295ITypeSymbol? type = boundDefaultExpression.GetPublicTypeSymbol(); 1305ITypeSymbol? type = boundBaseReference.GetPublicTypeSymbol(); 1314ITypeSymbol? type = boundThisReference.GetPublicTypeSymbol(); 1338ITypeSymbol? type = boundAssignmentOperator.GetPublicTypeSymbol(); 1350ITypeSymbol? type = boundAssignmentOperator.GetPublicTypeSymbol(); 1367ITypeSymbol? type = boundCompoundAssignmentOperator.GetPublicTypeSymbol(); 1394ITypeSymbol? type = boundIncrementOperator.GetPublicTypeSymbol(); 1405ITypeSymbol? type = syntax.IsMissing ? null : boundBadExpression.GetPublicTypeSymbol(); 1417ITypeSymbol? type = boundNewT.GetPublicTypeSymbol(); 1426ITypeSymbol? type = creation.GetPublicTypeSymbol(); 1437ITypeSymbol? type = boundUnaryOperator.GetPublicTypeSymbol(); 1491ITypeSymbol? type = boundBinaryOperator.GetPublicTypeSymbol(); 1523ITypeSymbol? type = boundBinaryOperator.GetPublicTypeSymbol(); 1567ITypeSymbol? type = boundTupleBinaryOperator.GetPublicTypeSymbol(); 1579ITypeSymbol? type = boundConditionalOperator.GetPublicTypeSymbol(); 1590ITypeSymbol? type = boundNullCoalescingOperator.GetPublicTypeSymbol(); 1609ITypeSymbol? type = boundNode.GetPublicTypeSymbol(); 1619ITypeSymbol? type = boundAwaitExpression.GetPublicTypeSymbol(); 1629ITypeSymbol? type = boundArrayAccess.GetPublicTypeSymbol(); 1640ITypeSymbol? type = boundIndexerAccess.GetPublicTypeSymbol(); 1662ITypeSymbol? type = boundInlineArrayAccess.GetPublicTypeSymbol(); 1672ITypeSymbol? type = boundNameOfOperator.GetPublicTypeSymbol(); 1682ITypeSymbol? type = boundThrowExpression.GetPublicTypeSymbol(); 1691ITypeSymbol? type = boundAddressOfOperator.GetPublicTypeSymbol(); 1700ITypeSymbol? type = boundImplicitReceiver.GetPublicTypeSymbol(); 1710ITypeSymbol? type = boundConditionalAccess.GetPublicTypeSymbol(); 1719ITypeSymbol? type = boundConditionalReceiver.GetPublicTypeSymbol(); 1832ITypeSymbol? type = null; 2012ITypeSymbol exceptionType = boundCatchBlock.ExceptionTypeOpt.GetPublicSymbol() ?? _semanticModel.Compilation.ObjectType; 2051ITypeSymbol? statementType = null; 2230ITypeSymbol? type = boundTupleExpression.GetPublicTypeSymbol(); 2265ITypeSymbol? type = boundInterpolatedString.GetPublicTypeSymbol(); 2485ITypeSymbol? type = placeholder.GetPublicTypeSymbol(); 2544ITypeSymbol inputType = boundDeclarationPattern.InputType.GetPublicSymbol(); 2545ITypeSymbol narrowedType = boundDeclarationPattern.NarrowedType.GetPublicSymbol(); 2547ITypeSymbol? matchedType = acceptsNull ? null : boundDeclarationPattern.DeclaredType.GetPublicTypeSymbol(); 2555ITypeSymbol matchedType = (boundRecursivePattern.DeclaredType?.Type ?? boundRecursivePattern.InputType.StrippedType()).GetPublicSymbol(); 2776ITypeSymbol? type = boundIsPatternExpression.GetPublicTypeSymbol(); 2791ITypeSymbol? type = boundQueryClause.GetPublicTypeSymbol(); 2852internal IPropertySubpatternOperation CreatePropertySubpattern(BoundPropertySubpattern subpattern, ITypeSymbol matchedType) 2870var inputType = getInputType(member, matchedType); 2877ITypeSymbol previousType = inputType; 2892IPropertySubpatternOperation createPropertySubpattern(Symbol? symbol, IPatternOperation pattern, ITypeSymbol receiverType, SyntaxNode nameSyntax, bool isSingle) 2927static ITypeSymbol getInputType(BoundPropertySubpatternMember member, ITypeSymbol matchedType) 2935ITypeSymbol? type = placeholder.GetPublicTypeSymbol();
Operations\CSharpOperationFactory_Methods.cs (2)
411ITypeSymbol type, 465ITypeSymbol? assignmentType = target.Type;
SymbolDisplay\SymbolDisplay.cs (9)
41ITypeSymbol symbol, 49ITypeSymbol symbol, 103ITypeSymbol symbol, 113ITypeSymbol symbol, 148ITypeSymbol symbol, 159ITypeSymbol symbol, 195ITypeSymbol symbol, 206ITypeSymbol symbol, 218ITypeSymbol symbol,
SymbolDisplay\SymbolDisplayVisitor.cs (2)
310ITypeSymbol? type = GetRangeVariableType(symbol); 364Debug.Assert((object)containingType != null || (symbol.ContainingSymbol is ITypeSymbol));
SymbolDisplay\SymbolDisplayVisitor.Members.cs (5)
303if ((object?)symbol.ContainingType != null || (symbol.ContainingSymbol is ITypeSymbol)) 375ITypeSymbol? containingType; 399containingType = (ITypeSymbol)symbol.ContainingSymbol; 871private static bool CanAddConstant(ITypeSymbol type, object? value) 918Debug.Assert(containingType != null || (symbol.ContainingSymbol is ITypeSymbol));
SymbolDisplay\SymbolDisplayVisitor.Types.cs (9)
48ITypeSymbol underlyingType = symbol; 70private void AddNullableAnnotations(ITypeSymbol type) 78private bool ShouldAddNullableAnnotation(ITypeSymbol type) 223var typeArg = symbol.TypeArguments[0]; 782ImmutableArray<ITypeSymbol> typeArguments; 800var typeArg = typeArguments[i]; 843private void AddTypeParameterConstraints(ImmutableArray<ITypeSymbol> typeArguments) 847foreach (var typeArg in typeArguments) 909ITypeSymbol baseType = typeParam.ConstraintTypes[i];
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (1)
12private void AddConstantValue(ITypeSymbol type, object? constantValue, bool preferNumericValueOrExpandedFlagsForEnum = false)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
238private ITypeSymbol? GetRangeVariableType(IRangeVariableSymbol symbol) 240ITypeSymbol? type = null;
Symbols\ArrayTypeSymbol.cs (1)
477protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\Compilation_WellKnownMembers.cs (1)
201internal override bool IsAttributeType(ITypeSymbol type)
Symbols\DynamicTypeSymbol.cs (1)
242protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\ErrorTypeSymbol.cs (1)
552protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (1)
124protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\FunctionTypeSymbol.cs (1)
146protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation) => throw ExceptionUtilities.Unreachable();
Symbols\NamedTypeSymbol.cs (1)
1699protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\NullableAnnotationExtensions.cs (2)
108internal static ITypeSymbol GetPublicSymbol(this TypeWithAnnotations type) 113internal static ImmutableArray<ITypeSymbol> GetPublicSymbols(this ImmutableArray<TypeWithAnnotations> types)
Symbols\PointerTypeSymbol.cs (1)
304protected override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ArrayTypeSymbol.cs (3)
15private ITypeSymbol? _lazyElementType; 24protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 43ITypeSymbol IArrayTypeSymbol.ElementType
Symbols\PublicModel\DiscardSymbol.cs (2)
13private ITypeSymbol? _lazyType; 23ITypeSymbol IDiscardSymbol.Type
Symbols\PublicModel\DynamicTypeSymbol.cs (1)
21protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ErrorTypeSymbol.cs (1)
22protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\EventSymbol.cs (2)
14private ITypeSymbol? _lazyType; 25ITypeSymbol IEventSymbol.Type
Symbols\PublicModel\FieldSymbol.cs (2)
16private ITypeSymbol _lazyType; 38ITypeSymbol IFieldSymbol.Type
Symbols\PublicModel\FunctionPointerTypeSymbol.cs (1)
40protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\LocalSymbol.cs (2)
15private ITypeSymbol _lazyType; 25ITypeSymbol ILocalSymbol.Type
Symbols\PublicModel\MethodSymbol.cs (10)
19private ITypeSymbol _lazyReturnType; 20private ImmutableArray<ITypeSymbol> _lazyTypeArguments; 22private ITypeSymbol _lazyReceiverType; 79ITypeSymbol IMethodSymbol.ReturnType 100ImmutableArray<ITypeSymbol> IMethodSymbol.TypeArguments 173ITypeSymbol IMethodSymbol.ReceiverType 196ITypeSymbol IMethodSymbol.GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 203IMethodSymbol IMethodSymbol.ReduceExtensionMethod(ITypeSymbol receiverType) 275IMethodSymbol IMethodSymbol.Construct(params ITypeSymbol[] typeArguments) 280IMethodSymbol IMethodSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\NamedTypeSymbol.cs (4)
15private ImmutableArray<ITypeSymbol> _lazyTypeArguments; 72ImmutableArray<ITypeSymbol> INamedTypeSymbol.TypeArguments 131INamedTypeSymbol INamedTypeSymbol.Construct(params ITypeSymbol[] typeArguments) 136INamedTypeSymbol INamedTypeSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\NonErrorNamedTypeSymbol.cs (1)
23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\PublicModel\ParameterSymbol.cs (2)
16private ITypeSymbol _lazyType; 26ITypeSymbol IParameterSymbol.Type
Symbols\PublicModel\PointerTypeSymbol.cs (3)
14private ITypeSymbol? _lazyPointedAtType; 23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 34ITypeSymbol IPointerTypeSymbol.PointedAtType
Symbols\PublicModel\PropertySymbol.cs (2)
16private ITypeSymbol _lazyType; 31ITypeSymbol IPropertySymbol.Type
Symbols\PublicModel\Symbol.cs (3)
19protected static ImmutableArray<TypeWithAnnotations> ConstructTypeArguments(ITypeSymbol[] typeArguments) 22foreach (var typeArg in typeArguments) 31protected static ImmutableArray<TypeWithAnnotations> ConstructTypeArguments(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Symbols\PublicModel\TypeParameterSymbol.cs (2)
23protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 62ImmutableArray<ITypeSymbol> ITypeParameterSymbol.ConstraintTypes
Symbols\PublicModel\TypeSymbol.cs (26)
21protected abstract ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation); 25CodeAnalysis.NullableAnnotation ITypeSymbol.NullableAnnotation => NullableAnnotation; 27ITypeSymbol ITypeSymbol.WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) 35return (ITypeSymbol)UnderlyingSymbol.ISymbol; 78ITypeSymbol ITypeSymbol.OriginalDefinition 86INamedTypeSymbol ITypeSymbol.BaseType 94ImmutableArray<INamedTypeSymbol> ITypeSymbol.Interfaces 102ImmutableArray<INamedTypeSymbol> ITypeSymbol.AllInterfaces 110ISymbol ITypeSymbol.FindImplementationForInterfaceMember(ISymbol interfaceMember) 117bool ITypeSymbol.IsUnmanagedType => !UnderlyingTypeSymbol.IsManagedTypeNoUseSiteDiagnostics; 119bool ITypeSymbol.IsReferenceType 127bool ITypeSymbol.IsValueType 135TypeKind ITypeSymbol.TypeKind 143bool ITypeSymbol.IsTupleType => UnderlyingTypeSymbol.IsTupleType; 145bool ITypeSymbol.IsNativeIntegerType => UnderlyingTypeSymbol.IsNativeIntegerType; 147string ITypeSymbol.ToDisplayString(CodeAnalysis.NullableFlowState topLevelNullability, SymbolDisplayFormat format) 152ImmutableArray<SymbolDisplayPart> ITypeSymbol.ToDisplayParts(CodeAnalysis.NullableFlowState topLevelNullability, SymbolDisplayFormat format) 157string ITypeSymbol.ToMinimalDisplayString(SemanticModel semanticModel, CodeAnalysis.NullableFlowState topLevelNullability, int position, SymbolDisplayFormat format) 162ImmutableArray<SymbolDisplayPart> ITypeSymbol.ToMinimalDisplayParts(SemanticModel semanticModel, CodeAnalysis.NullableFlowState topLevelNullability, int position, SymbolDisplayFormat format) 167bool ITypeSymbol.IsAnonymousType => UnderlyingTypeSymbol.IsAnonymousType; 169SpecialType ITypeSymbol.SpecialType => UnderlyingTypeSymbol.SpecialType; 171bool ITypeSymbol.IsRefLikeType => UnderlyingTypeSymbol.IsRefLikeType; 173bool ITypeSymbol.IsReadOnly => UnderlyingTypeSymbol.IsReadOnly; 175bool ITypeSymbol.IsRecord => UnderlyingTypeSymbol.IsRecord || UnderlyingTypeSymbol.IsRecordStruct;
Symbols\SymbolExtensions.cs (6)
420internal static TypeSymbol? EnsureCSharpSymbolOrNull(this ITypeSymbol? symbol, string paramName) 593internal static ITypeSymbol? GetPublicSymbol(this TypeSymbol? symbol) 595return symbol.GetPublicSymbol<ITypeSymbol>(); 714internal static ImmutableArray<ITypeSymbol> GetPublicSymbols(this ImmutableArray<TypeSymbol> symbols) 716return GetPublicSymbols<ITypeSymbol>(StaticCast<Symbol>.From(symbols)); 778internal static TypeSymbol? GetSymbol(this ITypeSymbol? symbol)
Symbols\TypeParameterSymbol.cs (1)
707protected sealed override ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation)
Symbols\TypeSymbol.cs (8)
665return SymbolDisplay.ToDisplayString((ITypeSymbol)ISymbol, topLevelNullability, format); 670return SymbolDisplay.ToDisplayParts((ITypeSymbol)ISymbol, topLevelNullability, format); 679return SymbolDisplay.ToMinimalDisplayString((ITypeSymbol)ISymbol, topLevelNullability, semanticModel, position, format); 688return SymbolDisplay.ToMinimalDisplayParts((ITypeSymbol)ISymbol, topLevelNullability, semanticModel, position, format); 2481internal ITypeSymbol GetITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation) 2485return (ITypeSymbol)this.ISymbol; 2493protected abstract ITypeSymbol CreateITypeSymbol(CodeAnalysis.NullableAnnotation nullableAnnotation); 2503ITypeSymbol ITypeSymbolInternal.GetITypeSymbol()
Microsoft.CodeAnalysis.CSharp.CodeStyle (103)
src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (1)
26protected override (CommonConversion conversion, ITypeSymbol? collectionElementType) GetForEachInfo(
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (3)
217var rewrittenConvertedType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).ConvertedType; 267private static bool IsIdentityOrImplicitConversion(Compilation compilation, ITypeSymbol type1, ITypeSymbol type2)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
97var convertedType = semanticModel.GetTypeInfo(expression.WalkUpParentheses(), cancellationToken).ConvertedType;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (6)
183var expressionType = semanticModel.GetTypeInfo(memberAccess.Expression, cancellationToken).Type; 250var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].Expression, cancellationToken).Type; 339var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 350var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 362static bool Implements(ITypeSymbol type, INamedTypeSymbol? interfaceType) 433var type = state.SemanticModel.GetTypeInfo(memberAccess.Expression, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
172var type = originalTypeInfo.Type; 173var convertedType = originalTypeInfo.ConvertedType; 271public static bool IsWellKnownCollectionInterface(ITypeSymbol type) 274public static bool IsWellKnownCollectionReadOnlyInterface(ITypeSymbol type) 282public static bool IsWellKnownCollectionReadWriteInterface(ITypeSymbol type) 289public static bool IsConstructibleCollectionType(Compilation compilation, ITypeSymbol? type) 977if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
167var type = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
145var leftType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type; 146var rightType = semanticModel.GetTypeInfo(objectCreation, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
18public static IPropertySymbol? TryGetLengthOrCountProperty(ITypeSymbol namedType) 26public static IPropertySymbol? TryGetNoArgInt32Property(ITypeSymbol type, string name) 127public static IPropertySymbol? GetIndexer(ITypeSymbol type, ITypeSymbol parameterType, ITypeSymbol returnType) 142public static IMethodSymbol? GetOverload(IMethodSymbol method, ITypeSymbol parameterType)
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
78var expressionType = semanticModel.GetTypeInfo(castExpression.Expression).Type;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
297var convertedType = semanticModel.GetTypeInfo(nodeToCheck, cancellationToken).ConvertedType;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
90var castType = semanticModel.GetTypeInfo(castExpression.Type).Type; 130var asType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
113var isType = semanticModel.GetTypeInfo(castExpression.Type).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (13)
18public static bool IsBuiltInType(ITypeSymbol type) 33ITypeSymbol? typeInDeclaration, 53var tupleElementType = tupleType.TupleElements[i].Type; 117ITypeSymbol? typeInDeclaration, 127var containingType = semanticModel.GetTypeInfo(containingTypeName, cancellationToken).Type; 142ITypeSymbol? typeInDeclaration, 143ITypeSymbol containingType) 159var returnType = methodSymbol.ReturnType; 174ITypeSymbol? typeInDeclaration, 175ITypeSymbol containingType) 177var returnType = UnwrapTupleType(methodSymbol.ReturnType); 191private static ITypeSymbol? UnwrapTupleType(ITypeSymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
52var entityType = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).Type; 53var defaultType = semanticModel.GetTypeInfo(defaultExpression.Type, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
15public static bool IsIntrinsicType(this ITypeSymbol typeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
313var potentialType = semanticModel.GetSpeculativeTypeInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (2)
22public static IEnumerable<ITypeSymbol> LookupTypeRegardlessOfArity( 32return results.OfType<ITypeSymbol>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (1)
38var type = semanticModel.GetTypeInfo(typeSyntax).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
366var type = semanticModel.GetTypeInfo(node, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (27)
121var castedType = semanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type; 156var castedType = semanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type; 160var parentCastType = semanticModel.GetTypeInfo(parentCast.Type, cancellationToken).Type; 307var originalConvertedType = originalSemanticModel.GetTypeInfo(castNode.WalkUpParentheses(), cancellationToken).ConvertedType; 486var castedExpressionType = originalSemanticModel.GetTypeInfo(castedExpressionNode, cancellationToken).Type; 487var isType = originalSemanticModel.GetTypeInfo(isExpression.Right, cancellationToken).Type; 570ITypeSymbol originalConvertedType, 574var castedType = originalSemanticModel.GetTypeInfo(castNode, cancellationToken).Type; 649var castType = semanticModel.GetTypeInfo(castNode, cancellationToken).Type; 769var originalConvertedType = originalConversionOperation.Type; 770var rewrittenBitwiseNotConversionType = rewrittenBitwiseNotConversionOperation.Type; 783private static bool IsSignedIntegralOrIntPtrType(ITypeSymbol? type) 840var castType = originalSemanticModel.GetTypeInfo(castExpression, cancellationToken).Type; 863private static bool IsNullOrErrorType([NotNullWhen(false)] ITypeSymbol? type) 986var castSideType = semanticModel.GetTypeInfo(castSide, cancellationToken).Type; 987var castedExpressionType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type; 991var otherSideType = semanticModel.GetTypeInfo(otherSide, cancellationToken).Type; 1009var castType = semanticModel.GetTypeInfo(castNode, cancellationToken).Type; 1010var castedExpressionType = semanticModel.GetTypeInfo(castedExpressionNode, cancellationToken).Type; 1067private static bool IsFloatingPointType(ITypeSymbol? type) 1237var rewrittenType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).Type; 1352private static bool IsIntrinsicOrEnum(ITypeSymbol rewrittenType) 1360ITypeSymbol rewrittenType, 1450private static (ITypeSymbol? rewrittenConvertedType, Conversion rewrittenConversion) GetRewrittenInfo( 1453Conversion originalConversion, ITypeSymbol originalConvertedType, 1464var convertedType = originalConversion.IsIdentity ? originalConvertedType : originalSemanticModel.Compilation.ObjectType; 1468var rewrittenConvertedType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).ConvertedType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (16)
386var originalExpressionType = originalExpressionTypeInfo.Type; 387var newExpressionType = newExpressionTypeInfo.Type; 435var originalCaseType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode, this.CancellationToken).Type; 436var newCaseType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode, this.CancellationToken).Type; 561var originalExpressionType = this.OriginalSemanticModel.GetTypeInfo(originalAnonymousObjectMemberDeclarator.Expression, this.CancellationToken).Type; 562var newExpressionType = this.SpeculativeSemanticModel.GetTypeInfo(replacedAnonymousObjectMemberDeclarator.Expression, this.CancellationToken).Type; 702var originalConvertedType = this.OriginalSemanticModel.GetTypeInfo(originalIsOrAsExpression.Right).Type; 703var newConvertedType = this.SpeculativeSemanticModel.GetTypeInfo(newIsOrAsExpression.Right).Type; 841protected override bool ConversionsAreCompatible(ExpressionSyntax originalExpression, ITypeSymbol originalTargetType, ExpressionSyntax newExpression, ITypeSymbol newTargetType) 889out ITypeSymbol elementType, 931protected override bool IsReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType) 934protected override Conversion ClassifyConversion(SemanticModel model, ExpressionSyntax expression, ITypeSymbol targetType) 937protected override Conversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (2)
79var declaredTypeSymbol = semanticModel.GetTypeInfo(variableDeclaration.Type.StripRefIfNeeded(), cancellationToken).Type; 104private static bool IsMadeOfSpecialTypes([NotNullWhen(true)] ITypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
149var declaredType = semanticModel.GetTypeInfo(typeName.StripRefIfNeeded(), cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (4)
195var declarationType = semanticModel.GetTypeInfo(declarationTypeNode, cancellationToken).Type; 205var newDeclarationType = newSemanticModel.GetTypeInfo(newDeclarationTypeNode, cancellationToken).Type; 293var declaredType = semanticModel.GetTypeInfo(typeName.StripRefIfNeeded(), cancellationToken).Type; 332var initializerType = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (137)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (1)
20protected override ArgumentSyntax GenerateNewArgument(ArgumentSyntax oldArgument, ITypeSymbol conversionType)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\AttributeArgumentFixer.cs (1)
20protected override AttributeArgumentSyntax GenerateNewArgument(AttributeArgumentSyntax oldArgument, ITypeSymbol conversionType)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (5)
47protected override ExpressionSyntax Cast(ExpressionSyntax expression, ITypeSymbol type) 56ArrayBuilder<(ExpressionSyntax node, ITypeSymbol type)> candidates, 90SemanticModel semanticModel, ExpressionSyntax targetNode, ITypeSymbol conversionType) 97var leftType = semanticModel.GetTypeInfo(assignmentExpression.Left).Type; 98var rightType = semanticModel.GetTypeInfo(assignmentExpression.Right).Type;
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
46protected override ITypeSymbol GetArgumentType(SyntaxNode argumentNode, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\AliasAmbiguousType\CSharpAliasAmbiguousTypeCodeFixProvider.cs (1)
28protected override string GetTextPreviewOfChange(string alias, ITypeSymbol typeSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
77ITypeSymbol? declaratorToRemoveType = null;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (4)
40ITypeSymbol? declaratorToRemoveType, 67ITypeSymbol? declaratorToRemoveType, 104private StatementSyntax GenerateVariableDeclaration(ExpressionSyntax switchExpression, ITypeSymbol? declaratorToRemoveType) 263var expressionConvertedType = _semanticModel.GetTypeInfo(node.Expression).ConvertedType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
991ITypeSymbol? testType = null;
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (5)
76var returnedType = semanticModel.GetTypeInfo(returnedValue, cancellationToken).Type; 91var previousReturnType = semanticModel.GetTypeInfo(declarationTypeToFix, cancellationToken).Type; 154private static ITypeSymbol? InferTupleType(TupleExpressionSyntax tuple, SemanticModel semanticModel, CancellationToken cancellationToken) 163var inferredTupleTypes = new ITypeSymbol[argCount]; 168var type = semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\ForEachCast\CSharpForEachCastCodeFixProvider.cs (2)
20protected override ITypeSymbol GetForEachElementType( 24var result = forEachInfo.ElementType;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (3)
179protected override ITypeSymbol GetArgumentType(SemanticModel semanticModel, Argument argument, CancellationToken cancellationToken) 182protected override bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType)
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
67ITypeSymbol type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (1)
60var targetType = semanticModel.GetTypeInfo(target, cancellationToken: cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
150protected override ITypeSymbol DetermineReturnTypeForSimpleNameOrMemberAccessExpression(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (8)
41protected override ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken) 58var type = argument.DetermineParameterType(semanticModel, cancellationToken); 131protected override ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken) 134private ITypeSymbol DetermineParameterType(ArgumentSyntax argument, CancellationToken cancellationToken) 143protected override bool IsImplicitReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType) 149protected override ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken) 155var result = new FixedSizeArrayBuilder<ITypeSymbol>(genericName.TypeArgumentList.Arguments.Count);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
255ITypeSymbol symbol, CSharpSimplifierOptions options) 268private static bool IsVarDesired(ITypeSymbol type, CSharpSimplifierOptions options)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (8)
88SemanticModel model, ExpressionSyntax? expression, [NotNullWhen(true)] out ITypeSymbol? returnExpressionType) 103[NotNullWhen(true)] out ITypeSymbol? methodReturnType) 116private static bool IsCorrectTypeForYieldReturn(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, ITypeSymbol methodReturnType, SemanticModel model) 150private static bool CanConvertTypes(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, SemanticModel model) 189private static bool IsCorrectTypeForYieldReturn(ITypeSymbol methodReturnType, SemanticModel model)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
45var type = methodSymbol.ReturnType;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
65protected override bool IsAsyncReturnType(ITypeSymbol type, KnownTaskTypes knownTypes) 127var returnType = methodSymbol.ReturnType; 154static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom)
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (1)
60var returnType = methodSymbol.ReturnType;
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
84var type = semanticModel.GetTypeInfo(defaultLiteral, cancellationToken).ConvertedType; 121private static bool IsFlagsEnum(ITypeSymbol type, Compilation compilation)
src\Analyzers\CSharp\CodeFixes\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (4)
22protected override ITypeSymbol? TryGetExplicitCast( 27var leftPartTypeSymbol = semanticModel.GetTypeInfo(expressionToCoalesce, cancellationToken).Type; 28var rightPartTypeSymbol = semanticModel.GetTypeInfo(rightAssignmentPart, cancellationToken).Type; 29var finalDestinationTypeSymbol = semanticModel.GetTypeInfo(leftAssignmentPart, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
97var type = semanticModel.GetTypeInfo(coalesce, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (2)
46var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).ConvertedType; 62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
91var returnType = lambdaType.DelegateInvokeMethod.ReturnType;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (7)
144private static ITypeSymbol AdjustNullabilityOfTypeSymbol( 145ITypeSymbol typeSymbol, 165private static ExpressionSyntax GenerateTupleDeclaration(ITypeSymbol typeSymbol, ParenthesizedVariableDesignationSyntax parensDesignation) 175var type = elements[i].Type; 207private static SyntaxNode GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol) 218private static ITypeSymbol GetConvertedType(SemanticModel semanticModel, SyntaxNode typeSyntax, CancellationToken cancellationToken) 220var typeSymbol = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).ConvertedType;
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
113var type = semanticModel.GetTypeInfo(expr).Type;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
144var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 145var asType = asExpressionTypeInfo.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
752public override TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (9)
35return typedConstant.Value is ITypeSymbol typeSymbol 56ITypeSymbol? type, 77internal static ExpressionSyntax GenerateNonEnumValueExpression(SyntaxGenerator generator, ITypeSymbol? type, object? value, bool canUseFieldReference) 120private static string DetermineSuffix(ITypeSymbol? type, object value) 174private static ExpressionSyntax GenerateDoubleLiteralExpression(ITypeSymbol? type, double value, bool canUseFieldReference) 203private static ExpressionSyntax GenerateSingleLiteralExpression(ITypeSymbol? type, float value, bool canUseFieldReference) 233ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants, 244ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants, 280private static ExpressionSyntax? GenerateFieldReference<T>(ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (1)
176return symbol is ITypeSymbol type
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
141var returnType = property.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
2504if (semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol is ITypeSymbol type && !type.CanSupportCollectionInitializer(containingSymbol)) 3049return target.IsType && ((ITypeSymbol)target).TypeKind == TypeKind.Enum;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (4)
88ITypeSymbol targetType) 103ITypeSymbol targetType, 120var type = semanticModel.GetSpeculativeTypeInfo( 170out ITypeSymbol? container)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (2)
16public static ITypeSymbol DetermineParameterType( 24public static ITypeSymbol DetermineParameterType(ExpressionSyntax expression, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (1)
64foreach (var type in constraintTypes)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (5)
27public static ExpressionSyntax GenerateExpressionSyntax(this ITypeSymbol typeSymbol, bool nameSyntax = false) 39var type = symbol as ITypeSymbol; 95public static bool ContainingTypesOrSelfHasUnsafeKeyword(this ITypeSymbol containingType) 113public static async Task<ISymbol?> FindApplicableAliasAsync(this ITypeSymbol type, int position, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (2)
62ITypeSymbol underlyingType = symbol; 239var innerType = symbol.TypeArguments.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
49: firstSymbol as ITypeSymbol; 57var returnType = method.ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (2)
117public CommonConversion ClassifyConversion(SemanticModel semanticModel, SyntaxNode expression, ITypeSymbol destination) 141var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
150public override SyntaxNode Type(ITypeSymbol typeSymbol, bool typeContext)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (31)
35protected override bool IsUnusableType(ITypeSymbol otherSideType) 600private static IMethodSymbol Instantiate(IMethodSymbol method, IList<ITypeSymbol> invocationTypes) 624IDictionary<ITypeParameterSymbol, ITypeSymbol> bestMap = null; 625foreach (var type in invocationTypes) 646private static Dictionary<ITypeParameterSymbol, ITypeSymbol> DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType) 648var result = new Dictionary<ITypeParameterSymbol, ITypeSymbol>(); 653private static void DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType, Dictionary<ITypeParameterSymbol, ITypeSymbol> result) 1118static ITypeSymbol MakeNullable(ITypeSymbol symbol, Compilation compilation) 1432var type = this.SemanticModel.GetTypeInfo(recursivePattern).ConvertedType; 1551var elementTypesBuilder = ArrayBuilder<ITypeSymbol>.GetInstance(subPatternCount); 1576private static ImmutableArray<NullableAnnotation> GetNullableAnnotations(ImmutableArray<ITypeSymbol> elementTypes) 1765private ITypeSymbol InferTypeForFirstParameterOfLambda( 1780private ITypeSymbol InferTypeForFirstParameterOfParenthesizedLambda( 1789private ITypeSymbol InferTypeForFirstParameterOfSimpleLambda( 1796private ITypeSymbol InferTypeForFirstParameterOfLambda( 1803private ITypeSymbol InferTypeForFirstParameterOfLambda( 1821var type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode()); 1986private ITypeSymbol UnwrapTaskLike(ITypeSymbol type, bool isAsync) 2255var tupleType = GetTupleType(tupleExpression); 2264private ITypeSymbol GetTupleType( 2278out ImmutableArray<ITypeSymbol> elementTypes, 2284using var _1 = ArrayBuilder<ITypeSymbol>.GetInstance(out var elementTypesBuilder); 2322ArrayBuilder<ITypeSymbol> elementTypesBuilder, 2344ArrayBuilder<ITypeSymbol> elementTypesBuilder, 2347var tupleType = GetTupleType(tuple);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableExtensions.cs (2)
9public static ITypeSymbol? GetConvertedTypeWithAnnotatedNullability(this TypeInfo typeInfo) 12public static ITypeSymbol? GetTypeWithAnnotatedNullability(this TypeInfo typeInfo)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (11)
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (8)
74var member01 = (typesym.GetMembers("myEvent").Single() as IEventSymbol).Type; 77var member02 = (typesym.GetMembers("Prop").Single() as IPropertySymbol).Type; 83var member04 = (typesym.GetMembers("M").Single() as IMethodSymbol).Parameters[0].Type; 86var member05 = (typesym.GetMembers(WellKnownMemberNames.Indexer).Single() as IPropertySymbol).Type; 244var mtsym20_1 = mem20_1.ReturnType; 248var mtsym20_2 = mem20_2.Parameters[0].Type; 251var mtsym20_3 = mem20_2.Parameters[1].Type; 264var localType = ((ILocalSymbol)local).Type;
SymbolKey\SymbolKeyTestBase.cs (1)
54internal static void ResolveAndVerifyTypeSymbol(ExpressionSyntax node, ITypeSymbol sourceSymbol, SemanticModel model, CSharpCompilation sourceComp)
SymbolKey\SymbolKeyTests.cs (1)
171var parameterType = callbackParamater.Type;
TypeInferrer\TypeInferrerTests.cs (1)
31ITypeSymbol inferredType;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (73)
CodeGen\CodeGenAsyncIteratorTests.cs (1)
1145Assert.Equal("C.<M>d__0", ((ITypeSymbol)argument.Value).ToTestDisplayString());
CodeGen\CodeGenDeconstructTests.cs (15)
1471var tuple1 = model.GetTypeInfo(xy).Type; 1475var tuple2 = model.GetTypeInfo(ab).Type; 1512var tupleType1 = model.GetTypeInfo(tuple1).Type; 1517var tupleType2 = model.GetTypeInfo(tuple1).Type; 1565var tupleType = model.GetTypeInfo(tuple).Type; 5404var xType = ((IFieldSymbol)xSymbol).Type; 5411var yType = ((IFieldSymbol)ySymbol).Type; 5437var xType = ((IFieldSymbol)xSymbol).Type; 5444var yType = ((IFieldSymbol)ySymbol).Type; 5569var xType = ((IFieldSymbol)xSymbol).Type; 5617var yType = ((IFieldSymbol)ySymbol).Type; 5648var x1Type = ((IFieldSymbol)x1Symbol).Type; 5657var x2Type = ((IFieldSymbol)x2Symbol).Type; 5692var x1Type = ((IFieldSymbol)x1Symbol).Type; 5701var x2Type = ((IFieldSymbol)x2Symbol).Type;
CodeGen\CodeGenReadonlyStructTests.cs (4)
897INamedTypeSymbol iNamedType = comp.CreateAnonymousTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol()), ImmutableArray.Create("qq")); 905iNamedType = comp.CreateTupleTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol(), comp.ObjectType.GetPublicSymbol())); 1061INamedTypeSymbol iNamedType = comp.CreateAnonymousTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol()), ImmutableArray.Create("qq")); 1069iNamedType = comp.CreateTupleTypeSymbol(ImmutableArray.Create<ITypeSymbol>(comp.ObjectType.GetPublicSymbol(), comp.ObjectType.GetPublicSymbol()));
CodeGen\CodeGenTupleEqualityTests.cs (1)
1717static void verifyType(string expectedType, ITypeSymbol type, bool inferDelegate)
CodeGen\CodeGenTupleTest.cs (52)
6210ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 6328var vbType = (ITypeSymbol)vbComp.GlobalNamespace.GetMembers("C").Single(); 6341Assert.Throws<ArgumentNullException>(() => comp.CreateTupleTypeSymbol(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<string>))); 6344Assert.Throws<ArgumentException>(() => comp.CreateTupleTypeSymbol(ImmutableArray<ITypeSymbol>.Empty, default(ImmutableArray<string>))); 6581ITypeSymbol vbType = (ITypeSymbol)vbComp.GlobalNamespace.GetMembers("C").Single(); 6610var tuple3 = comp.CreateTupleTypeSymbol(ImmutableArray.Create<ITypeSymbol>(intType, intType, intType, intType, intType, intType, intType, stringType, stringType), 6927private static bool TypeEquals(ITypeSymbol a, ITypeSymbol b, TypeCompareKind compareKind) => 13977Assert.True(((ITypeSymbol)nameofArgSymbolInfo.Symbol).IsTupleType); 14333var m5Tuple = ((IMethodSymbol)symbolInfo.Symbol).TypeParameters[0].ConstraintTypes.Single(); 14343var m6Tuple = m6Method.ReturnType; 14456var v1Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 14466var v2Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 18861ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18862ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18881ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18882ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18921ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18922ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18923ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 18947ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18948ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18949ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 18972ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18973ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18974ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 18997ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 18998ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 18999ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 19023ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 19024ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 19025ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 19065ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 19066ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 19067ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 19104ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 19105ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 19106ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 19143ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 19144ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 19145ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 19182ITypeSymbol intType = comp.GetSpecialType(SpecialType.System_Int32); 19183ITypeSymbol stringType = comp.GetSpecialType(SpecialType.System_String); 19184ITypeSymbol objectType = comp.GetSpecialType(SpecialType.System_Object); 22858var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 24397var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24470var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24543var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24617var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 25026var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type;
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
10690var returnType = model.GetDeclaredSymbol(method).ReturnType;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (13)
Semantics\CollectionExpressionTests.cs (2)
27151ITypeSymbol ISpreadOperation.ElementType => throw null; 27161ITypeSymbol IOperation.Type => throw null;
Semantics\OutVarTests.cs (5)
1007ITypeSymbol expectedType = null 1041ITypeSymbol expected = expectedSymbol?.GetTypeOrReturnType(); 1071private static void AssertTypeFromOperation(SemanticModel model, ITypeSymbol expectedType, DeclarationExpressionSyntax decl) 21418Assert.True(((ITypeSymbol)model.GetTypeInfo(zRef).Type).IsErrorType()); 22673Assert.True(((ITypeSymbol)model.GetTypeInfo(reference).Type).IsErrorType());
Semantics\PatternMatchingTestBase.cs (4)
108var type = local.Type; 131private static void AssertTypeInfo(SemanticModel model, TypeSyntax typeSyntax, ITypeSymbol expectedType) 150var type = ((ILocalSymbol)symbol).Type; 274var type = local.Type;
Semantics\PatternMatchingTests.cs (2)
3482Assert.True(((ITypeSymbol)compilation.GetSemanticModel(tree).GetTypeInfo(x1Ref).Type).IsErrorType()); 3488Assert.True(((ITypeSymbol)compilation.GetSemanticModel(tree).GetTypeInfo(x2Ref).Type).IsErrorType());
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
616var type = model.GetTypeInfo(literal).Type;
Microsoft.CodeAnalysis.CSharp.Features (220)
AddImport\CSharpAddImportFeatureService.cs (3)
235protected override ITypeSymbol GetDeconstructInfo( 241protected override ITypeSymbol GetQueryClauseInfo( 619var leftExpressionType = semanticInfo.Type;
ChangeSignature\CSharpChangeSignatureService.cs (1)
166if (typeSymbol != null && typeSymbol.IsKind(SymbolKind.NamedType) && ((ITypeSymbol)typeSymbol).TypeKind == TypeKind.Delegate)
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (2)
59protected override SyntaxNode GenerateTypeSyntax(ITypeSymbol symbol, bool allowVar) 62protected override ExpressionSyntax GenerateLiteralExpression(ITypeSymbol typeSymbol, object? value)
Completion\CompletionProviders\AwaitCompletionProvider.cs (2)
104protected override ITypeSymbol? GetTypeSymbolOfExpression(SemanticModel semanticModel, SyntaxNode potentialAwaitableExpression, CancellationToken cancellationToken) 113return symbol is ITypeSymbol ? null : semanticModel.GetTypeInfo(memberAccessExpression, cancellationToken).Type;
Completion\CompletionProviders\CrefCompletionProvider.cs (3)
213var leftType = semanticModel.GetTypeInfo(parent.Container, cancellationToken).Type; 264var typeSymbol = symbol as ITypeSymbol;
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (2)
190private static ITypeSymbol? GetDelegateType(TypeInferenceInfo typeInferenceInfo, Compilation compilation) 192var typeSymbol = typeInferenceInfo.InferredType;
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (4)
23ITypeSymbol? type = null, 38public readonly ITypeSymbol? Type = type; 187return symbol is ITypeSymbol; 371if (symbolInfo.GetAnySymbol() is ITypeSymbol type)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (5)
80private static bool IsValidType([NotNullWhen(true)] ITypeSymbol? type) 100private (ITypeSymbol, bool plural) UnwrapType(ITypeSymbol type, Compilation compilation, bool wasPlural, HashSet<ITypeSymbol> seenTypes) 292var methodParameterType = semanticModel.GetTypeInfo(parameterType, cancellationToken).Type;
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (2)
22internal static ImmutableArray<Words> GetBaseNames(ITypeSymbol type, bool pluralize) 100private static string TryRemoveKnownPrefixes(ITypeSymbol type)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (6)
108CompletionContext context, SemanticModel semanticModel, SyntaxToken token, ITypeSymbol type, bool isParams, CancellationToken cancellationToken) 223ITypeSymbol symbolType; 272private static ITypeSymbol? TryGetEnumTypeInEnumInitializer( 274ITypeSymbol type, CancellationToken cancellationToken) 319private static INamedTypeSymbol? TryGetCompletionListType(ITypeSymbol type, INamedTypeSymbol? within, Compilation compilation) 345private static INamedTypeSymbol? TryGetTypeWithStaticMembers(ITypeSymbol type)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.CompletionSymbolDisplay.cs (1)
119private static void AddType(ITypeSymbol symbol, StringBuilder builder)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (2)
72var symbol = semanticModel.GetSymbolInfo(name, cancellationToken).Symbol as ITypeSymbol;
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
190var expressionType = semanticModel.GetTypeInfo(elementAccessExpression.Expression, cancellationToken).Type;
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (3)
85var initializedType = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 107protected override Tuple<ITypeSymbol, Location>? GetInitializedType( 145private static ITypeSymbol? GetInitializedType(SyntaxToken token, Document document, SemanticModel semanticModel, CancellationToken cancellationToken)
Completion\CompletionProviders\ObjectCreationCompletionProvider.cs (3)
70var type = (ITypeSymbol)result.Single().Symbol; 92if (symbol is ITypeSymbol typeSymbol)
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (2)
148if (symbols is [INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType])
Completion\CompletionProviders\OverrideCompletionProvider.cs (2)
55public override bool TryDetermineReturnType(SyntaxToken startToken, SemanticModel semanticModel, CancellationToken cancellationToken, out ITypeSymbol? returnType, out SyntaxToken nextToken) 197public override ImmutableArray<ISymbol> FilterOverrides(ImmutableArray<ISymbol> members, ITypeSymbol? returnType)
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (7)
59var propertyPatternType = semanticModel.GetTypeInfo((PatternSyntax)propertyPatternClause.Parent!, cancellationToken).ConvertedType; 63var type = GetMemberAccessType(propertyPatternType, memberAccess, document, semanticModel, position); 99static ITypeSymbol? GetMemberAccessType(ITypeSymbol? type, ExpressionSyntax? expression, Document document, SemanticModel semanticModel, int position) 118static ITypeSymbol? GetMemberType(ITypeSymbol? type, string name, Document document, SemanticModel semanticModel, int position) 135static ImmutableArray<ISymbol> GetCandidatePropertiesAndFields(Document document, SemanticModel semanticModel, int position, ITypeSymbol? type)
Completion\CompletionProviders\SymbolCompletionProvider.cs (1)
140=> s is ITypeSymbol ts && ts.IsIntrinsicType();
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (1)
117ITypeSymbol iterationVariableType)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
34public override bool CanImplicitlyConvert(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol targetType)
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
353internal static bool TypeSymbolIsList(ITypeSymbol typeSymbol, SemanticModel semanticModel)
ConvertLinq\ConvertForEachToLinqQuery\ToToListConverter.cs (1)
31ForEachInfo.SemanticModel.GetSymbolInfo(objectCreationExpression.Type, cancellationToken).Symbol is ITypeSymbol typeSymbol &&
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (6)
368private bool IsInt(ITypeSymbol typeSymbol) 371private bool IsList(ITypeSymbol typeSymbol) 377Func<ITypeSymbol, bool> typeCheckMethod, 412Func<ITypeSymbol, bool> typeCheckMethod, 553ITypeSymbol returnedType; 665var forEachStatementTypeSymbolType = _semanticModel.GetTypeInfo(forEachStatement.Type, _cancellationToken).Type;
Debugging\DataTipInfoGetter.cs (2)
47var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 80var type = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).Type;
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (3)
32ITypeSymbol type, 39protected override ITypeSymbol GetRangeVariableType(SemanticModel model, IRangeVariableSymbol symbol) 61protected override ITypeSymbol GetSymbolType(SemanticModel semanticModel, ISymbol symbol)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
777var newType = methodSymbol.ReturnType.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (5)
94var map = new Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>>(); 116Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>> map) 120var type = _semanticModel.GetSpeculativeTypeInfo(_contextPosition, statement.Declaration.Type, SpeculativeBindingOption.BindAsTypeOrNamespace).Type; 127Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>> map) 185var semanticInfo = _semanticModel.GetSpeculativeTypeInfo(_contextPosition, declarationStatement.Declaration.Type, SpeculativeBindingOption.BindAsTypeOrNamespace).Type;
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (4)
45public override (ITypeSymbol? returnType, bool returnsByRef) GetReturnType() 80private static (ITypeSymbol? typeSymbol, bool returnsByRef) GetRegularExpressionType(SemanticModel semanticModel, ExpressionSyntax node) 91var typeSymbol = GetRegularExpressionTypeWorker(); 94ITypeSymbol? GetRegularExpressionTypeWorker()
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
63public override (ITypeSymbol returnType, bool returnsByRef) GetReturnType()
ExtractMethod\Extensions.cs (1)
257public static bool IsObjectType(this ITypeSymbol? type)
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
198protected override bool TryConvertToLocalDeclaration(ITypeSymbol type, SyntaxToken identifierToken, SemanticModel semanticModel, CancellationToken cancellationToken, out SyntaxNode newRoot)
GenerateType\CSharpGenerateTypeService.cs (7)
459var expressionType = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 561protected override ITypeSymbol DetermineArgumentType(SemanticModel semanticModel, ArgumentSyntax argument, CancellationToken cancellationToken) 564protected override bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType) 783private static ITypeSymbol GetPropertyType( 805SimpleNameSyntax propertyName, ITypeSymbol propertyType) 833var propertyType = GetPropertyType(propertyName, semanticModel, typeInference, cancellationToken);
InitializeParameter\CSharpAddParameterCheckCodeRefactoringProvider.cs (2)
45protected override bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination)
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (2)
44protected override bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination)
InitializeParameter\InitializeParameterHelpers.cs (2)
49public static bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination)
InlineHints\CSharpInlineTypeHintsService.cs (8)
42var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; 52var type = semanticModel.GetTypeInfo(declarationExpression.Type, cancellationToken).Type; 59var type = local?.Type; 70var type = info.ElementType; 96var type = semanticModel.GetTypeInfo(implicitNew, cancellationToken).Type; 109var type = semanticModel.GetTypeInfo(collectionExpression, cancellationToken).ConvertedType; 122ITypeSymbol type, 152private static bool IsValidType([NotNullWhen(true)] ITypeSymbol? type)
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
145var delegateReturnType = delegateType.DelegateInvokeMethod.ReturnType;
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
177var type = namedParameter is IFieldSymbol ? ((IFieldSymbol)namedParameter).Type : ((IPropertySymbol)namedParameter).Type;
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (3)
83if (!TryGetIndexers(position, semanticModel, expression, cancellationToken, out var indexers, out var expressionType) && 183out ImmutableArray<IPropertySymbol> indexers, out ITypeSymbol? expressionType) 201out ImmutableArray<IPropertySymbol> indexers, out ITypeSymbol? expressionType)
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
263foreach (var baseType in typeParam.ConstraintTypes)
SignatureHelp\GenericNameSignatureHelpProvider_Method.cs (3)
48var containingType = GetContainingType(method); 61private static ITypeSymbol? GetContainingType(IMethodSymbol method) 63var result = method.ReceiverType;
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (2)
82var invokedType = semanticModel.GetTypeInfo(invocationExpression.Expression, cancellationToken).Type; 129var invokedType = semanticModel.GetTypeInfo(invocationExpression.Expression, cancellationToken).Type;
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
42ITypeSymbol? throughType = null;
SignatureHelp\LightweightOverloadResolution.cs (1)
123var type = parameter.Type;
Snippets\CSharpSnippetFunctionService.cs (2)
30protected override async Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken) 42var typeSymbol = model.GetTypeInfo(expressionNode, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (1)
26protected override (CommonConversion conversion, ITypeSymbol? collectionElementType) GetForEachInfo(
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (3)
217var rewrittenConvertedType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).ConvertedType; 267private static bool IsIdentityOrImplicitConversion(Compilation compilation, ITypeSymbol type1, ITypeSymbol type2)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
97var convertedType = semanticModel.GetTypeInfo(expression.WalkUpParentheses(), cancellationToken).ConvertedType;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (6)
183var expressionType = semanticModel.GetTypeInfo(memberAccess.Expression, cancellationToken).Type; 250var argumentType = semanticModel.GetTypeInfo(objectCreation.ArgumentList.Arguments[0].Expression, cancellationToken).Type; 339var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 350var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 362static bool Implements(ITypeSymbol type, INamedTypeSymbol? interfaceType) 433var type = state.SemanticModel.GetTypeInfo(memberAccess.Expression, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (7)
172var type = originalTypeInfo.Type; 173var convertedType = originalTypeInfo.ConvertedType; 271public static bool IsWellKnownCollectionInterface(ITypeSymbol type) 274public static bool IsWellKnownCollectionReadOnlyInterface(ITypeSymbol type) 282public static bool IsWellKnownCollectionReadWriteInterface(ITypeSymbol type) 289public static bool IsConstructibleCollectionType(Compilation compilation, ITypeSymbol? type) 977if (collectionBuilderAttributeData?.ConstructorArguments is not [{ Value: ITypeSymbol collectionBuilderType }, { Value: CreateName }])
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
167var type = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (2)
145var leftType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type; 146var rightType = semanticModel.GetTypeInfo(objectCreation, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
18public static IPropertySymbol? TryGetLengthOrCountProperty(ITypeSymbol namedType) 26public static IPropertySymbol? TryGetNoArgInt32Property(ITypeSymbol type, string name) 127public static IPropertySymbol? GetIndexer(ITypeSymbol type, ITypeSymbol parameterType, ITypeSymbol returnType) 142public static IMethodSymbol? GetOverload(IMethodSymbol method, ITypeSymbol parameterType)
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
78var expressionType = semanticModel.GetTypeInfo(castExpression.Expression).Type;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
297var convertedType = semanticModel.GetTypeInfo(nodeToCheck, cancellationToken).ConvertedType;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (2)
90var castType = semanticModel.GetTypeInfo(castExpression.Type).Type; 130var asType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
113var isType = semanticModel.GetTypeInfo(castExpression.Type).Type;
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\ArgumentFixer.cs (1)
20protected override ArgumentSyntax GenerateNewArgument(ArgumentSyntax oldArgument, ITypeSymbol conversionType)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\AttributeArgumentFixer.cs (1)
20protected override AttributeArgumentSyntax GenerateNewArgument(AttributeArgumentSyntax oldArgument, ITypeSymbol conversionType)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (5)
47protected override ExpressionSyntax Cast(ExpressionSyntax expression, ITypeSymbol type) 56ArrayBuilder<(ExpressionSyntax node, ITypeSymbol type)> candidates, 90SemanticModel semanticModel, ExpressionSyntax targetNode, ITypeSymbol conversionType) 97var leftType = semanticModel.GetTypeInfo(assignmentExpression.Left).Type; 98var rightType = semanticModel.GetTypeInfo(assignmentExpression.Right).Type;
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
46protected override ITypeSymbol GetArgumentType(SyntaxNode argumentNode, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\AliasAmbiguousType\CSharpAliasAmbiguousTypeCodeFixProvider.cs (1)
28protected override string GetTextPreviewOfChange(string alias, ITypeSymbol typeSymbol)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
77ITypeSymbol? declaratorToRemoveType = null;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (4)
40ITypeSymbol? declaratorToRemoveType, 67ITypeSymbol? declaratorToRemoveType, 104private StatementSyntax GenerateVariableDeclaration(ExpressionSyntax switchExpression, ITypeSymbol? declaratorToRemoveType) 263var expressionConvertedType = _semanticModel.GetTypeInfo(node.Expression).ConvertedType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
991ITypeSymbol? testType = null;
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (5)
76var returnedType = semanticModel.GetTypeInfo(returnedValue, cancellationToken).Type; 91var previousReturnType = semanticModel.GetTypeInfo(declarationTypeToFix, cancellationToken).Type; 154private static ITypeSymbol? InferTupleType(TupleExpressionSyntax tuple, SemanticModel semanticModel, CancellationToken cancellationToken) 163var inferredTupleTypes = new ITypeSymbol[argCount]; 168var type = semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\ForEachCast\CSharpForEachCastCodeFixProvider.cs (2)
20protected override ITypeSymbol GetForEachElementType( 24var result = forEachInfo.ElementType;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (3)
179protected override ITypeSymbol GetArgumentType(SemanticModel semanticModel, Argument argument, CancellationToken cancellationToken) 182protected override bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType)
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
67ITypeSymbol type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (1)
60var targetType = semanticModel.GetTypeInfo(target, cancellationToken: cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
150protected override ITypeSymbol DetermineReturnTypeForSimpleNameOrMemberAccessExpression(
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (7)
41protected override ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken) 131protected override ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken) 134private ITypeSymbol DetermineParameterType(ArgumentSyntax argument, CancellationToken cancellationToken) 143protected override bool IsImplicitReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType) 149protected override ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken) 155var result = new FixedSizeArrayBuilder<ITypeSymbol>(genericName.TypeArgumentList.Arguments.Count);
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
255ITypeSymbol symbol, CSharpSimplifierOptions options) 268private static bool IsVarDesired(ITypeSymbol type, CSharpSimplifierOptions options)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (8)
88SemanticModel model, ExpressionSyntax? expression, [NotNullWhen(true)] out ITypeSymbol? returnExpressionType) 103[NotNullWhen(true)] out ITypeSymbol? methodReturnType) 116private static bool IsCorrectTypeForYieldReturn(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, ITypeSymbol methodReturnType, SemanticModel model) 150private static bool CanConvertTypes(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, SemanticModel model) 189private static bool IsCorrectTypeForYieldReturn(ITypeSymbol methodReturnType, SemanticModel model)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
45var type = methodSymbol.ReturnType;
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (3)
65protected override bool IsAsyncReturnType(ITypeSymbol type, KnownTaskTypes knownTypes) 127var returnType = methodSymbol.ReturnType; 154static TypeSyntax MakeGenericType(string type, ITypeSymbol typeArgumentFrom)
src\Analyzers\CSharp\CodeFixes\MakeMethodSynchronous\CSharpMakeMethodSynchronousCodeFixProvider.cs (1)
60var returnType = methodSymbol.ReturnType;
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
84var type = semanticModel.GetTypeInfo(defaultLiteral, cancellationToken).ConvertedType; 121private static bool IsFlagsEnum(ITypeSymbol type, Compilation compilation)
src\Analyzers\CSharp\CodeFixes\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (4)
22protected override ITypeSymbol? TryGetExplicitCast( 27var leftPartTypeSymbol = semanticModel.GetTypeInfo(expressionToCoalesce, cancellationToken).Type; 28var rightPartTypeSymbol = semanticModel.GetTypeInfo(rightAssignmentPart, cancellationToken).Type; 29var finalDestinationTypeSymbol = semanticModel.GetTypeInfo(leftAssignmentPart, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
97var type = semanticModel.GetTypeInfo(coalesce, cancellationToken).Type;
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (2)
46var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).ConvertedType; 62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
91var returnType = lambdaType.DelegateInvokeMethod.ReturnType;
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (7)
144private static ITypeSymbol AdjustNullabilityOfTypeSymbol( 145ITypeSymbol typeSymbol, 165private static ExpressionSyntax GenerateTupleDeclaration(ITypeSymbol typeSymbol, ParenthesizedVariableDesignationSyntax parensDesignation) 175var type = elements[i].Type; 207private static SyntaxNode GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol) 218private static ITypeSymbol GetConvertedType(SemanticModel semanticModel, SyntaxNode typeSyntax, CancellationToken cancellationToken) 220var typeSymbol = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).ConvertedType;
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
113var type = semanticModel.GetTypeInfo(expr).Type;
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (2)
144var localType = local.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated); 145var asType = asExpressionTypeInfo.Type.WithNullableAnnotation(NullableAnnotation.NotAnnotated);
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (1)
45var argType = semanticModel.GetTypeInfo(GetArgumentExpression(argument)).Type;
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
125var typeSymbol = semanticModel.GetTypeInfo(type, cancellationToken).Type;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (66)
Semantics\AccessCheckTests.cs (11)
751ITypeSymbol karrayType = (classA.GetMembers("karray").Single() as IFieldSymbol).Type; 752ITypeSymbol aarrayType = (classA.GetMembers("aarray").Single() as IFieldSymbol).Type; 753ITypeSymbol kptrType = (classA.GetMembers("kptr").Single() as IFieldSymbol).Type; 754ITypeSymbol aptrType = (classA.GetMembers("aptr").Single() as IFieldSymbol).Type; 755ITypeSymbol kinreturnfuncptrType = (classA.GetMembers("kinreturnfuncptr").Single() as IFieldSymbol).Type; 756ITypeSymbol kinparamfuncptr1Type = (classA.GetMembers("kinparamfuncptr1").Single() as IFieldSymbol).Type; 757ITypeSymbol kinparamfuncptr2Type = (classA.GetMembers("kinparamfuncptr2").Single() as IFieldSymbol).Type; 758ITypeSymbol afuncptrType = (classA.GetMembers("afuncptr").Single() as IFieldSymbol).Type; 759ITypeSymbol kenumType = (classA.GetMembers("kenum").Single() as IFieldSymbol).Type; 760ITypeSymbol aenumType = (classA.GetMembers("aenum").Single() as IFieldSymbol).Type; 764ITypeSymbol unknownType = (classA.GetMembers("unknowntype").Single() as IFieldSymbol).Type;
Semantics\DelegateTypeTests.cs (4)
12122var type = model!.GetTypeInfo(expr).Type; 14754static ITypeSymbol getFunctionType(NamedTypeSymbol delegateType) 14759static void verifyConversions(SemanticModel model, ExpressionSyntax expr, ITypeSymbol destination, ConversionKind expectedImplicitKind, ConversionKind expectedExplicitKind) 14783protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation) => this;
Semantics\ForEachTests.cs (1)
2889var localSymbolType = localSymbol.Type;
Semantics\InteractiveUsingTests.cs (1)
590private static ITypeSymbol GetSpeculativeType(Compilation comp, string name)
Semantics\LambdaTests.cs (2)
1040Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("String")); 1094Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("SomeProperty"));
Semantics\LocalFunctionTests.cs (2)
457var argType0 = model.GetTypeInfo(attrArg0).Type; 463var argType1 = model.GetTypeInfo(attrArg1).Type;
Semantics\MethodTypeInferenceTests.cs (4)
1120var bookType = model.GetTypeInfo(book).Type; 1161var authorType = model.GetTypeInfo(author).Type; 1202var bookResultType = model.GetTypeInfo(bookResult).Type; 1206var authorResultType = model.GetTypeInfo(authorResult).Type;
Semantics\MultiDimensionalArrayTests.cs (2)
1691Assert.True(((ITypeSymbol)p.GetMember<MethodSymbol>("Test3").GetAttributes().Single().ConstructorArguments.Single().Value).IsErrorType()); 1692Assert.True(((ITypeSymbol)p.GetMember<MethodSymbol>("Test4").GetAttributes().Single().ConstructorArguments.Single().Value).IsErrorType());
Semantics\NativeIntegerTests.cs (6)
290var underlyingTypeArgument = underlyingInterface.TypeArguments[i]; 291var nativeIntegerTypeArgument = nativeIntegerInterface.TypeArguments[i]; 4077var type = model.GetSpeculativeTypeInfo(spanStart, typeSyntax, SpeculativeBindingOption.BindAsTypeOrNamespace).Type; 4122var type = model.GetTypeInfo(node).Type; 15446var symbol = (ITypeSymbol)model.GetSymbolInfo(cref).Symbol;
Semantics\NullCoalesceAssignmentTests.cs (1)
161var coalesceType = semanticModel.GetTypeInfo(coalesceAssignment).Type;
Semantics\OperatorTests.cs (9)
2987var type1 = model.GetTypeInfo(negOne).Type; 2993var type2 = model.GetTypeInfo(boolPlusPlus).Type; 2999var type3 = model.GetTypeInfo(errorPlusPlus).Type; 8643Assert.True(((ITypeSymbol)symbol1.ContainingSymbol).IsDynamic()); 8654Assert.True(((ITypeSymbol)symbol2.ContainingSymbol).IsDynamic()); 8693Assert.True(((ITypeSymbol)symbol1.ContainingSymbol).IsDynamic()); 8704Assert.True(((ITypeSymbol)symbol2.ContainingSymbol).IsDynamic()); 11340var type = (ITypeSymbol)compilation.GetSemanticModel(tree).GetTypeInfo(negNode).Type;
Semantics\RecordStructTests.cs (3)
535var type = model.GetTypeInfo(creation).Type!; 555var type = model.GetDeclaredSymbol(method)!.ReturnType; 575var type = model.GetDeclaredSymbol(method)!.ReturnType;
Semantics\RefEscapingTests.cs (1)
67ITypeSymbol getLocalType(string name)
Semantics\SemanticErrorTests.cs (2)
3343var typeArgSymbol = constructedMethodSymbol.TypeArguments.Single(); 3347var paramTypeSymbol = constructedMethodSymbol.Parameters.Single().Type;
Semantics\TargetTypedConditionalOperatorTests.cs (1)
346var actualType = model.GetTypeInfo(conditionalExpr).Type;
Semantics\UnsafeTests.cs (16)
6327ITypeSymbol getLocalType(string name) 6386ITypeSymbol getLocalType(string name) 7266var type = typeInfo.Type; 7333var type = typeInfo.Type; 7371var type = typeInfo.Type; 7413var type = typeInfo.Type; 7544var type = typeInfo.Type; 8386var type = typeInfo.Type; 8390var convertedType = typeInfo.ConvertedType; 10185ITypeSymbol type = symbol.Type; 10631var type = typeSummary.Symbol as ITypeSymbol; 10693var type = typeSummary.Symbol as ITypeSymbol; 10753var type = typeSummary.Symbol as ITypeSymbol;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (200)
Compilation\CompilationAPITests.cs (28)
2510ImmutableArray.Create((ITypeSymbol)null), 2520ImmutableArray.Create((ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32), 2521(ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32)), 2532ImmutableArray.Create((ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32), 2533(ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32)), 2544ImmutableArray.Create((ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32), 2545(ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32)), 2556ImmutableArray.Create((ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32), 2557(ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32)), 2568default(ImmutableArray<ITypeSymbol>), 2578ImmutableArray.Create((ITypeSymbol)null), 2588ImmutableArray.Create((ITypeSymbol)null), 2598ImmutableArray.Create((ITypeSymbol)compilation.GetSpecialType(SpecialType.System_Int32)), 2607ImmutableArray.Create<ITypeSymbol>(compilation.GetSpecialType(SpecialType.System_Int32)), 2626ImmutableArray.Create<ITypeSymbol>(compilation.GetSpecialType(SpecialType.System_Int32), 2643ImmutableArray.Create<ITypeSymbol>(compilation.GetSpecialType(SpecialType.System_Int32), compilation.GetSpecialType(SpecialType.System_Boolean)), 2658var memberTypes = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)); 2688var type = comp.CreateAnonymousTypeSymbol(ImmutableArray<ITypeSymbol>.Empty, ImmutableArray<string>.Empty, memberNullableAnnotations: ImmutableArray<CodeAnalysis.NullableAnnotation>.Empty); 2698var memberTypes = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)); 2712private static ImmutableArray<CodeAnalysis.NullableAnnotation> GetAnonymousTypeNullableAnnotations(ITypeSymbol type) 3032var typeArguments = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)); 3034Assert.Throws<ArgumentException>(() => genericType.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>))); 3043Assert.Throws<ArgumentException>(() => genericType.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default)); 3052typeArguments = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)); 3067var typeArguments = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)); 3069Assert.Throws<ArgumentException>(() => genericMethod.Construct(default(ImmutableArray<ITypeSymbol>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>))); 3078Assert.Throws<ArgumentException>(() => genericMethod.Construct(ImmutableArray.Create<ITypeSymbol>(null, null), default)); 3087typeArguments = ImmutableArray.Create<ITypeSymbol>(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String));
Compilation\ForEachStatementInfoTests.cs (4)
37var e1 = (ITypeSymbol)c.GlobalNamespace.GetMembers("E1").Single(); 44var e2 = (ITypeSymbol)c.GlobalNamespace.GetMembers("E2").Single();
Compilation\GetSemanticInfoTests.cs (10)
869private void ConversionTestHelper(SemanticModel semanticModel, ExpressionSyntax expr, ITypeSymbol expsym, ConversionKind expkind) 1027ITypeSymbol returnType = methodSymbol.ReturnType; 2800var returnType = method.ReturnType; 4116Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info0.Symbol.OriginalDefinition).SpecialType); 4120Assert.Equal(SpecialType.System_Int32, ((ITypeSymbol)info1.Symbol).SpecialType); 4124Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info2.Symbol.OriginalDefinition).SpecialType); 4171Assert.Equal(SpecialType.System_Int32, ((ITypeSymbol)info1.Symbol).SpecialType); 4175Assert.Equal(SpecialType.System_Collections_Generic_IEnumerable_T, ((ITypeSymbol)info2.Symbol.OriginalDefinition).SpecialType); 5420Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg 5428Assert.Throws<ArgumentException>(() => type.Construct(new ITypeSymbol[] { null })); // null type arg
Compilation\SemanticModelAPITests.cs (4)
731var lookup = symbolInfo.Symbol as ITypeSymbol; 2718var typeSymbol = speculativeModel.GetTypeInfo(speculatedTypeSyntax).Type; 4762var type = model.GetTypeInfo(exprSyn).Type;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (18)
1633var symbols = model.LookupSymbols(position).Where(s => !s.IsStatic && !((s is ITypeSymbol))); 1636var symbols2 = model.LookupSymbols(position, container: symbolC).Where(s => !s.IsStatic && !((s is ITypeSymbol))); 1877var typeA = ((IParameterSymbol)symbols[0]).Type; 1881var typeB = ((IParameterSymbol)symbols[0]).Type; 2014var type = ((IParameterSymbol)symbols[0]).Type; 4003ITypeSymbol boundType; 4007boundType = symbolInfo.Symbol as ITypeSymbol; 4013boundType = symbolInfo.Symbol as ITypeSymbol; 4019boundType = symbolInfo.Symbol as ITypeSymbol; 4025boundType = symbolInfo.Symbol as ITypeSymbol; 4031boundType = symbolInfo.Symbol as ITypeSymbol; 4037boundType = symbolInfo.Symbol as ITypeSymbol; 4043boundType = symbolInfo.Symbol as ITypeSymbol; 4049boundType = symbolInfo.Symbol as ITypeSymbol; 4054boundType = symbolInfo.Symbol as ITypeSymbol; 4060boundType = symbolInfo.Symbol as ITypeSymbol; 4659var declaringType = compilation.GlobalNamespace.GetMember<ITypeSymbol>("Enclosing").GetMember<ITypeSymbol>("Declaring");
Compilation\SemanticModelGetSemanticInfoTests.cs (6)
6255Assert.Equal(SpecialType.System_String, ((ITypeSymbol)symbol).SpecialType); 9159var type = semanticInfo.Type; 9183var type = semanticInfo.Type; 9211var type = semanticInfo.Type; 9235var type = semanticInfo.Type; 14578Assert.True(((ITypeSymbol)semanticInfo.Type).IsErrorType());
DocumentationComments\CrefTests.cs (2)
5563var crefTypeParam = referencedType.TypeArguments.Single(); 6053var members = model.LookupSymbols(typeParameterSyntax.SpanStart, (ITypeSymbol)typeParameterSymbol);
SymbolDisplay\SymbolDisplayTests.cs (6)
4674var a = (ITypeSymbol)comp.GlobalNamespace.GetMembers("A").Single(); 5214Assert.True(((ITypeSymbol)firstPart.Symbol).IsTupleType); 8228var type = semanticModel.GetTypeInfo(declaration.Declaration.Type).Type; 8279var type = semanticModel.GetTypeInfo(declaration.Declaration.Type).Type; 8313var type = ((ILocalSymbol)model.GetDeclaredSymbol(name.Names[0])).Type;
Symbols\AnonymousTypesSemanticsTests.cs (7)
720var type = info0.Type; 739var type = info0.Type; 1072private static void CheckAnonymousType(ITypeSymbol type, string name, string metadataName) 1974ITypeSymbol[] args = new ITypeSymbol[namedType.Arity]; 1986var type = info.Type; 2005private void CheckFieldNameAndLocation(TestData data, ITypeSymbol type, SyntaxNode identifier)
Symbols\AnonymousTypesSymbolTests.cs (3)
1691var typeA3 = localA3.Type; 1692var typeA4 = localA4.Type; 1925ImmutableArray.Create<ITypeSymbol>(compilation.GetSpecialType(SpecialType.System_Int32).GetPublicSymbol(), compilation.GetSpecialType(SpecialType.System_Boolean).GetPublicSymbol()),
Symbols\CheckedUserDefinedOperatorsTests.cs (3)
7216var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType; 7288var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType; 7359var int64 = ((IMethodSymbol)model.GetSymbolInfo(xNode.Parent).Symbol).ReturnType;
Symbols\ConversionTests.cs (1)
396ITypeSymbol targetType = ((ILocalSymbol)model.GetDeclaredSymbol(variableDeclarator)).Type;
Symbols\CustomModifiersTests.cs (1)
154var i = type.TypeArguments.First();
Symbols\ExtensionMethodTests.cs (5)
3781var type = model.GetTypeInfo(member.Expression).Type; 3868var baseClass = model.GetTypeInfo(instance).Type; 3915var baseClass = model.GetTypeInfo(instance).Type; 3960var baseClass = model.GetTypeInfo(instance).Type; 4010var baseClass = model.GetTypeInfo(instance).Type;
Symbols\FunctionPointerTypeSymbolTests.cs (23)
1532Assert.Throws<ArgumentNullException>("returnType", () => comp.CreateFunctionPointerTypeSymbol(returnType: null!, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1534Assert.Throws<ArgumentNullException>("parameterTypes[0]", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray.Create((ITypeSymbol?)null)!, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1535Assert.Throws<ArgumentNullException>("parameterRefKinds", () => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: default)); 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!))); 1537Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray.Create(RefKind.None))); 1538Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.Out, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty)); 1539Assert.Throws<ArgumentOutOfRangeException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: (SignatureCallingConvention)10)); 1540Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Default, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1541Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.StdCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1542Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.FastCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1543Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.CDecl, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1544Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.ThisCall, callingConventionTypes: ImmutableArray.Create(cdeclType)!)); 1545Assert.Throws<ArgumentException>(() => comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.Unmanaged, callingConventionTypes: ImmutableArray.Create(@string)!)); 1553var ptr = comp.CreateFunctionPointerTypeSymbol(returnType: @string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, callingConvention: SignatureCallingConvention.VarArgs); 1585ImmutableArray.Create((ITypeSymbol)@string), 1602ImmutableArray.Create((ITypeSymbol)@string), 1620ImmutableArray.Create((ITypeSymbol)@string), 1638var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1640ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, convention); 1653var ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1655ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.RefReadOnly, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType, stdcallType)!); 1658ptr = comp.CreateFunctionPointerTypeSymbol(@string, returnRefKind: RefKind.None, parameterTypes: ImmutableArray<ITypeSymbol>.Empty, parameterRefKinds: ImmutableArray<RefKind>.Empty, SignatureCallingConvention.Unmanaged, ImmutableArray.Create(cdeclType)!); 1968parameterTypes: ImmutableArray<ITypeSymbol>.Empty,
Symbols\Metadata\PE\LoadingAttributes.cs (2)
1211Assert.Equal("System.Linq.Expressions.Expression.BinaryExpressionProxy", ((ITypeSymbol)attr1.CommonConstructorArguments[0].Value).ToDisplayString(SymbolDisplayFormat.TestFormat)); 1216Assert.Equal("System.Linq.Expressions.Expression.TypeBinaryExpressionProxy", ((ITypeSymbol)attr1.CommonConstructorArguments[0].Value).ToDisplayString(SymbolDisplayFormat.TestFormat));
Symbols\Source\BaseClassTests.cs (1)
277Assert.False(((ITypeSymbol)members[0]).IsErrorType());
Symbols\Source\DeclaringSyntaxNodeTests.cs (3)
265var localA1Type = localA1.Type; 329var localType = local.Type; 553var constructedC1 = fieldT.Type;
Symbols\Source\NullablePublicAPITests.cs (11)
4372Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4400Assert.Equal(PublicNullableAnnotation.None, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4430Assert.Equal(PublicNullableAnnotation.None, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4460Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4490Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4522Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4555Assert.Equal(PublicNullableAnnotation.None, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4583Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4613Assert.Equal(PublicNullableAnnotation.None, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4644Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation); 4677Assert.Equal(PublicNullableAnnotation.None, ((ITypeSymbol)symbol2.Symbol).NullableAnnotation);
Symbols\Source\UsingAliasTests.cs (15)
105var usingAliasType = model.GetTypeInfo(usingAlias.NamespaceOrType).Type; 220var usingAliasType = model.GetTypeInfo(usingAlias.NamespaceOrType).Type; 275var usingAliasType = model.GetTypeInfo(usingAlias.NamespaceOrType).Type; 313var info2 = symbolInfo.Symbol as ITypeSymbol; 319var info3 = symbolInfo.Symbol as ITypeSymbol; 325var info4 = symbolInfo.Symbol as ITypeSymbol; 359var info2 = symbolInfo.Symbol as ITypeSymbol; 365var info3 = symbolInfo.Symbol as ITypeSymbol; 371var info4 = symbolInfo.Symbol as ITypeSymbol;
Symbols\SymbolEqualityTests.cs (40)
225var type1 = ((IFieldSymbol)comp.GetMember("A.field1")).Type; 226var type2 = ((IFieldSymbol)comp.GetMember("A.field2")).Type; 249var type1 = ((IFieldSymbol)comp.GetMember("A.field1")).Type; 250var type2 = ((IFieldSymbol)comp.GetMember("A.field2")).Type; 285var type1 = ((IFieldSymbol)comp.GetMember("A.field1")).Type; 286var type2 = ((IFieldSymbol)comp.GetMember("A.field2")).Type; 309var type1 = ((IFieldSymbol)comp.GetMember("A.field1")).Type; 310var type2 = ((IFieldSymbol)comp.GetMember("A.field2")).Type; 344var type1comp1 = ((IFieldSymbol)comp1.GetMember("A.field1")).Type; 345var type1comp2 = ((IFieldSymbol)comp2.GetMember("A.field1")).Type; 346var type2 = ((IFieldSymbol)comp2.GetMember("B.field2")).Type; 376var symbol1 = ((IFieldSymbol)comp.GetMember("A.field1")).Type; 454var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 455var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 485var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 486var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 528var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 529var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 559var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 560var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 630var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 631var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 644var prop1Type = property1.Type; 645var prop2Type = property2.Type; 679var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 680var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 693var prop1Type = field1.Type; 694var prop2Type = field2.Type; 731var type1 = ((IFieldSymbol)model.GetDeclaredSymbol(member1Syntax.Declaration.Variables[0])).Type; 732var type2 = ((IFieldSymbol)model.GetDeclaredSymbol(member2Syntax.Declaration.Variables[0])).Type; 745var prop1Type = event1.Type; 746var prop2Type = event2.Type; 788var field1Type = field1.Type; // A<T!> 789var field2Type = field2.Type; // A<T!> 839var method1ReturnType = method1.ReturnType; // A<T!> 840var method2ReturnType = method2.ReturnType; // A<T!> 846var method1ParamType = method1.Parameters.First().Type; // A<T!> 847var method2ParamType = method2.Parameters.First().Type; // A<T!> 900var event1Type = event1.Type; // System.EventHandler<T!> 901var event2Type = event2.Type; // System.EventHandler<T!>
Symbols\TypeTests.cs (7)
1685var anonymousType = (locals[3] as ILocalSymbol).Type; 1721var compType = (model.GetDeclaredSymbol(mnode) as IMethodSymbol).Parameters[0].Type; 1768var memType = sym.Type; 1776Assert.Equal(TypeKind.Interface, ((ITypeSymbol)tinfo.Type).TypeKind); 1780Assert.True(((ITypeSymbol)tinfo.Type).IsNullableType()); 1784Assert.True(((ITypeSymbol)tinfo.ConvertedType).IsNullableType()); 1785Assert.Same(comp.GetSpecialType(SpecialType.System_Decimal), ((ITypeSymbol)tinfo.ConvertedType).GetNullableUnderlyingType());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (22)
CompilationTestUtils.cs (2)
210public ITypeSymbol Type; 212public ITypeSymbol ConvertedType;
Extensions.cs (17)
699public static ITypeSymbol GetParameterType(this IMethodSymbol method, int index) => method.Parameters[index].Type; 701public static bool IsNullableType(this ITypeSymbol typeOpt) 706public static ITypeSymbol GetNullableUnderlyingType(this ITypeSymbol type) 711public static bool IsDynamic(this ITypeSymbol type) 716public static bool IsDelegateType(this ITypeSymbol type) 721public static bool IsErrorType(this ITypeSymbol type) 726public static ITypeSymbol StrippedType(this ITypeSymbol type) 766public static bool IsUnboundGenericType(this ITypeSymbol type) 805public static bool Equals(this ITypeSymbol first, ITypeSymbol second, TypeCompareKind typeCompareKind) 810public static ITypeSymbol GetTypeOrReturnType(this ISymbol symbol) 827return (ITypeSymbol)symbol; 833public static ITypeSymbol EnumUnderlyingTypeOrSelf(this ITypeSymbol type) 838public static INamedTypeSymbol GetEnumUnderlyingType(this ITypeSymbol type)
FunctionPointerUtilities.cs (3)
147ITypeSymbol? exprType; 244ITypeSymbol signatureParamType = signature.Parameters[i].Type; 252static void assertEqualSemanticInformation(SemanticModel model, TypeSyntax typeSyntax, ITypeSymbol signatureType)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (1)
CodeGen\WinRTCollectionTests.cs (1)
7430var jsonObjType = model.GetTypeInfo(jsonObj).Type;
Microsoft.CodeAnalysis.CSharp.Workspaces (188)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (2)
167if (symbol is ITypeSymbol type && type.IsNativeIntegerType) 184case ITypeSymbol typeSymbol:
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (1)
24private static readonly Func<ITypeSymbol, bool> s_shouldInclude = t => t.TypeKind != TypeKind.Error && t.GetArity() > 0;
Classification\SyntaxClassification\UsingDirectiveSyntaxClassifier.cs (1)
47if (symbolInfo.Symbol is ITypeSymbol typeSymbol)
CodeGeneration\CSharpSyntaxGenerator.cs (3)
3245public override SyntaxNode DefaultExpression(ITypeSymbol type) 3379private protected override SyntaxNode GenerateExpression(ITypeSymbol? type, object? value, bool canUseFieldReference) 3433private protected override SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind)
ExternalAccess\Pythia\Api\PythiaSymbolExtensions.cs (3)
14public static ITypeSymbol? GetMemberType(this ISymbol symbol) 17public static ITypeSymbol? GetSymbolType(this ISymbol? symbol) 26public static bool IsAccessibleWithin(this ISymbol symbol, ISymbol within, ITypeSymbol? throughType = null)
Recommendations\CSharpRecommendationServiceRunner.cs (14)
57public override bool TryGetExplicitTypeOfLambdaParameter(SyntaxNode lambdaSyntax, int ordinalInLambda, [NotNullWhen(true)] out ITypeSymbol? explicitLambdaParameterType) 485if (name.ShouldNameExpressionBeTreatedAsExpressionInsteadOfType(_context.SemanticModel, out var nameBinding, out var container)) 543var container = _context.SemanticModel.GetTypeInfo(identifier, _cancellationToken).Type; 593var container = _context.SemanticModel.GetTypeInfo(expression, _cancellationToken).Type; 603var container = _context.SemanticModel.GetTypeInfo(expression, _cancellationToken).Type; 618var container = _context.SemanticModel.GetTypeInfo(expression, _cancellationToken).Type; 634ITypeSymbol? containerType, 699private RecommendedSymbols GetSymbolsOffOfBoundExpressionWorker(SymbolInfo leftHandBinding, ExpressionSyntax originalExpression, ExpressionSyntax expression, ITypeSymbol? containerType, bool unwrapNullable, bool isForDereference) 807ITypeSymbol? containerType, 815if (symbol.IsStatic || symbol is ITypeSymbol) 844var container = GetContainerForUnnamedSymbols(semanticModel, originalExpression); 863private ITypeSymbol? GetContainerForUnnamedSymbols(SemanticModel semanticModel, ExpressionSyntax originalExpression) 865return originalExpression.ShouldNameExpressionBeTreatedAsExpressionInsteadOfType(_context.SemanticModel, out _, out var container) 870private void AddIndexers(ITypeSymbol container, ArrayBuilder<ISymbol> symbols)
Recommendations\CSharpRecommendationServiceRunner_Conversions.cs (12)
135private void AddConversions(ITypeSymbol container, ArrayBuilder<ISymbol> symbols) 145private static ITypeSymbol TryMakeNullable(Compilation compilation, ITypeSymbol container) 153ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols) 201ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols) 210public static ImmutableArray<SpecialType>? GetPredefinedNumericConversions(ITypeSymbol container) 229ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols, ImmutableArray<SpecialType> specialTypes) 245static string CreateConversionDocumentationCommentXml(ITypeSymbol fromType, ITypeSymbol toType) 258private static IMethodSymbol CreateConversion(INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType, string? documentationCommentXml) 266ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols)
Recommendations\CSharpRecommendationServiceRunner_Operators.cs (2)
19private static void AddOperators(ITypeSymbol container, ArrayBuilder<ISymbol> symbols) 54private static bool ExcludeOperatorType(ITypeSymbol container)
Simplification\CSharpSimplificationService.Expander.cs (7)
76private bool IsPassedToDelegateCreationExpression(ArgumentSyntax argument, ITypeSymbol type) 82var objectCreationType = _semanticModel.GetTypeInfo(objectCreationExpression).Type; 95private bool TryCastTo(ITypeSymbol targetType, ExpressionSyntax expression, ExpressionSyntax newExpression, out ExpressionSyntax newExpressionWithCast) 120var returnType = (_semanticModel.GetSymbolInfo(lambdaExpression).Symbol as IMethodSymbol)?.ReturnType; 142var returnType = (_semanticModel.GetSymbolInfo(parentLambda).Symbol as IMethodSymbol)?.ReturnType; 271var argumentType = _semanticModel.GetTypeInfo(node.Expression).ConvertedType; 846foreach (var typeArgument in namedTypedSymbol.TypeArguments)
Simplification\Reducers\CSharpNullableAnnotationReducer.cs (1)
52var type = semanticModel.GetTypeInfo(node, cancellationToken).Type;
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
155var type = semanticModel.GetTypeInfo(node, cancellationToken).Type; 169var type = semanticModel.GetTypeInfo(node, cancellationToken).Type;
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
375var type = semanticModel.GetTypeInfo(memberAccess.GetRequiredParent(), cancellationToken).Type;
Simplification\Simplifiers\NameSimplifier.cs (2)
250var type = semanticModel.GetTypeInfo(name, cancellationToken).Type; 442var argument = type.TypeArguments.SingleOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (13)
18public static bool IsBuiltInType(ITypeSymbol type) 33ITypeSymbol? typeInDeclaration, 53var tupleElementType = tupleType.TupleElements[i].Type; 117ITypeSymbol? typeInDeclaration, 127var containingType = semanticModel.GetTypeInfo(containingTypeName, cancellationToken).Type; 142ITypeSymbol? typeInDeclaration, 143ITypeSymbol containingType) 159var returnType = methodSymbol.ReturnType; 174ITypeSymbol? typeInDeclaration, 175ITypeSymbol containingType) 177var returnType = UnwrapTupleType(methodSymbol.ReturnType); 191private static ITypeSymbol? UnwrapTupleType(ITypeSymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
52var entityType = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).Type; 53var defaultType = semanticModel.GetTypeInfo(defaultExpression.Type, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
15public static bool IsIntrinsicType(this ITypeSymbol typeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
313var potentialType = semanticModel.GetSpeculativeTypeInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (2)
22public static IEnumerable<ITypeSymbol> LookupTypeRegardlessOfArity( 32return results.OfType<ITypeSymbol>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (1)
38var type = semanticModel.GetTypeInfo(typeSyntax).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
366var type = semanticModel.GetTypeInfo(node, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (27)
121var castedType = semanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type; 156var castedType = semanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type; 160var parentCastType = semanticModel.GetTypeInfo(parentCast.Type, cancellationToken).Type; 307var originalConvertedType = originalSemanticModel.GetTypeInfo(castNode.WalkUpParentheses(), cancellationToken).ConvertedType; 486var castedExpressionType = originalSemanticModel.GetTypeInfo(castedExpressionNode, cancellationToken).Type; 487var isType = originalSemanticModel.GetTypeInfo(isExpression.Right, cancellationToken).Type; 570ITypeSymbol originalConvertedType, 574var castedType = originalSemanticModel.GetTypeInfo(castNode, cancellationToken).Type; 649var castType = semanticModel.GetTypeInfo(castNode, cancellationToken).Type; 769var originalConvertedType = originalConversionOperation.Type; 770var rewrittenBitwiseNotConversionType = rewrittenBitwiseNotConversionOperation.Type; 783private static bool IsSignedIntegralOrIntPtrType(ITypeSymbol? type) 840var castType = originalSemanticModel.GetTypeInfo(castExpression, cancellationToken).Type; 863private static bool IsNullOrErrorType([NotNullWhen(false)] ITypeSymbol? type) 986var castSideType = semanticModel.GetTypeInfo(castSide, cancellationToken).Type; 987var castedExpressionType = semanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type; 991var otherSideType = semanticModel.GetTypeInfo(otherSide, cancellationToken).Type; 1009var castType = semanticModel.GetTypeInfo(castNode, cancellationToken).Type; 1010var castedExpressionType = semanticModel.GetTypeInfo(castedExpressionNode, cancellationToken).Type; 1067private static bool IsFloatingPointType(ITypeSymbol? type) 1237var rewrittenType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).Type; 1352private static bool IsIntrinsicOrEnum(ITypeSymbol rewrittenType) 1360ITypeSymbol rewrittenType, 1450private static (ITypeSymbol? rewrittenConvertedType, Conversion rewrittenConversion) GetRewrittenInfo( 1453Conversion originalConversion, ITypeSymbol originalConvertedType, 1464var convertedType = originalConversion.IsIdentity ? originalConvertedType : originalSemanticModel.Compilation.ObjectType; 1468var rewrittenConvertedType = rewrittenSemanticModel.GetTypeInfo(rewrittenExpression, cancellationToken).ConvertedType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (16)
386var originalExpressionType = originalExpressionTypeInfo.Type; 387var newExpressionType = newExpressionTypeInfo.Type; 435var originalCaseType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode, this.CancellationToken).Type; 436var newCaseType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode, this.CancellationToken).Type; 561var originalExpressionType = this.OriginalSemanticModel.GetTypeInfo(originalAnonymousObjectMemberDeclarator.Expression, this.CancellationToken).Type; 562var newExpressionType = this.SpeculativeSemanticModel.GetTypeInfo(replacedAnonymousObjectMemberDeclarator.Expression, this.CancellationToken).Type; 702var originalConvertedType = this.OriginalSemanticModel.GetTypeInfo(originalIsOrAsExpression.Right).Type; 703var newConvertedType = this.SpeculativeSemanticModel.GetTypeInfo(newIsOrAsExpression.Right).Type; 841protected override bool ConversionsAreCompatible(ExpressionSyntax originalExpression, ITypeSymbol originalTargetType, ExpressionSyntax newExpression, ITypeSymbol newTargetType) 889out ITypeSymbol elementType, 931protected override bool IsReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType) 934protected override Conversion ClassifyConversion(SemanticModel model, ExpressionSyntax expression, ITypeSymbol targetType) 937protected override Conversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (2)
79var declaredTypeSymbol = semanticModel.GetTypeInfo(variableDeclaration.Type.StripRefIfNeeded(), cancellationToken).Type; 104private static bool IsMadeOfSpecialTypes([NotNullWhen(true)] ITypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
149var declaredType = semanticModel.GetTypeInfo(typeName.StripRefIfNeeded(), cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (4)
195var declarationType = semanticModel.GetTypeInfo(declarationTypeNode, cancellationToken).Type; 205var newDeclarationType = newSemanticModel.GetTypeInfo(newDeclarationTypeNode, cancellationToken).Type; 293var declaredType = semanticModel.GetTypeInfo(typeName.StripRefIfNeeded(), cancellationToken).Type; 332var initializerType = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
752public override TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (9)
35return typedConstant.Value is ITypeSymbol typeSymbol 56ITypeSymbol? type, 77internal static ExpressionSyntax GenerateNonEnumValueExpression(SyntaxGenerator generator, ITypeSymbol? type, object? value, bool canUseFieldReference) 120private static string DetermineSuffix(ITypeSymbol? type, object value) 174private static ExpressionSyntax GenerateDoubleLiteralExpression(ITypeSymbol? type, double value, bool canUseFieldReference) 203private static ExpressionSyntax GenerateSingleLiteralExpression(ITypeSymbol? type, float value, bool canUseFieldReference) 233ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants, 244ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants, 280private static ExpressionSyntax? GenerateFieldReference<T>(ITypeSymbol? type, T value, IEnumerable<KeyValuePair<T, string>> constants)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (1)
176return symbol is ITypeSymbol type
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
141var returnType = property.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
2504if (semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol is ITypeSymbol type && !type.CanSupportCollectionInitializer(containingSymbol)) 3049return target.IsType && ((ITypeSymbol)target).TypeKind == TypeKind.Enum;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (4)
88ITypeSymbol targetType) 103ITypeSymbol targetType, 120var type = semanticModel.GetSpeculativeTypeInfo( 170out ITypeSymbol? container)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (2)
16public static ITypeSymbol DetermineParameterType( 24public static ITypeSymbol DetermineParameterType(ExpressionSyntax expression, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (1)
64foreach (var type in constraintTypes)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (5)
27public static ExpressionSyntax GenerateExpressionSyntax(this ITypeSymbol typeSymbol, bool nameSyntax = false) 39var type = symbol as ITypeSymbol; 95public static bool ContainingTypesOrSelfHasUnsafeKeyword(this ITypeSymbol containingType) 113public static async Task<ISymbol?> FindApplicableAliasAsync(this ITypeSymbol type, int position, SemanticModel semanticModel, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (2)
62ITypeSymbol underlyingType = symbol; 239var innerType = symbol.TypeArguments.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
49: firstSymbol as ITypeSymbol; 57var returnType = method.ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (2)
117public CommonConversion ClassifyConversion(SemanticModel semanticModel, SyntaxNode expression, ITypeSymbol destination) 141var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
150public override SyntaxNode Type(ITypeSymbol typeSymbol, bool typeContext)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (31)
35protected override bool IsUnusableType(ITypeSymbol otherSideType) 600private static IMethodSymbol Instantiate(IMethodSymbol method, IList<ITypeSymbol> invocationTypes) 624IDictionary<ITypeParameterSymbol, ITypeSymbol> bestMap = null; 625foreach (var type in invocationTypes) 646private static Dictionary<ITypeParameterSymbol, ITypeSymbol> DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType) 648var result = new Dictionary<ITypeParameterSymbol, ITypeSymbol>(); 653private static void DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType, Dictionary<ITypeParameterSymbol, ITypeSymbol> result) 1118static ITypeSymbol MakeNullable(ITypeSymbol symbol, Compilation compilation) 1432var type = this.SemanticModel.GetTypeInfo(recursivePattern).ConvertedType; 1551var elementTypesBuilder = ArrayBuilder<ITypeSymbol>.GetInstance(subPatternCount); 1576private static ImmutableArray<NullableAnnotation> GetNullableAnnotations(ImmutableArray<ITypeSymbol> elementTypes) 1765private ITypeSymbol InferTypeForFirstParameterOfLambda( 1780private ITypeSymbol InferTypeForFirstParameterOfParenthesizedLambda( 1789private ITypeSymbol InferTypeForFirstParameterOfSimpleLambda( 1796private ITypeSymbol InferTypeForFirstParameterOfLambda( 1803private ITypeSymbol InferTypeForFirstParameterOfLambda( 1821var type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode()); 1986private ITypeSymbol UnwrapTaskLike(ITypeSymbol type, bool isAsync) 2255var tupleType = GetTupleType(tupleExpression); 2264private ITypeSymbol GetTupleType( 2278out ImmutableArray<ITypeSymbol> elementTypes, 2284using var _1 = ArrayBuilder<ITypeSymbol>.GetInstance(out var elementTypesBuilder); 2322ArrayBuilder<ITypeSymbol> elementTypesBuilder, 2344ArrayBuilder<ITypeSymbol> elementTypesBuilder, 2347var tupleType = GetTupleType(tuple);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NullableHelpers\NullableExtensions.cs (2)
9public static ITypeSymbol? GetConvertedTypeWithAnnotatedNullability(this TypeInfo typeInfo) 12public static ITypeSymbol? GetTypeWithAnnotatedNullability(this TypeInfo typeInfo)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
CodeGeneration\SyntaxGeneratorTests.cs (2)
4975var type = (ITypeSymbol)attribute.ConstructorArguments[0].Values[2].Value;
Microsoft.CodeAnalysis.EditorFeatures (3)
Navigation\AbstractDefinitionLocationService.cs (3)
270if (semanticModel.GetDeclaredSymbol(containingTypeDeclaration, cancellationToken) is ITypeSymbol containingTypeSymbol && 271(symbolToNavigateTo is ITypeSymbol || symbolToNavigateTo.IsConstructor())) 273var candidateTypeSymbol = symbolToNavigateTo is ITypeSymbol
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
ChangeSignature\AddedParameterOrExistingIndex.cs (1)
66var type = document.Project.Language switch
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (57)
CodeGeneration\AbstractCodeGenerationTests.cs (1)
122protected static ITypeSymbol CreateClass(string name)
CodeGeneration\CodeGenerationTests.cs (6)
59Func<SemanticModel, ITypeSymbol> type = null, 69var typeSymbol = type != null ? type(testContext.SemanticModel) : null; 570Func<SemanticModel, ITypeSymbol> getType = null, 669private static ITypeSymbol GetTypeSymbol(Compilation compilation, Type type) 672private static ITypeSymbol GetTypeSymbol(Compilation compilation, string typeFullName, int arrayRank = 0) 684internal static Func<SemanticModel, ITypeSymbol> CreateArrayType(Type type, int rank = 1)
Utilities\SymbolEquivalenceComparerTests.cs (50)
52var type = (ITypeSymbol)(await workspace.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 124var csharpType = (ITypeSymbol)(await csharpWorkspace.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetTypeMembers("C").Single(); 1346var a1 = ((IFieldSymbol)t1.GetMembers("A").Single()).Type; 1347var b1 = ((IFieldSymbol)t1.GetMembers("B").Single()).Type; 1348var c1 = ((IFieldSymbol)t1.GetMembers("C").Single()).Type; 1349var d1 = ((IFieldSymbol)t1.GetMembers("D").Single()).Type; 1350var a2 = ((IFieldSymbol)t2.GetMembers("A").Single()).Type; 1351var b2 = ((IFieldSymbol)t2.GetMembers("B").Single()).Type; 1352var c2 = ((IFieldSymbol)t2.GetMembers("C").Single()).Type; 1353var d2 = ((IFieldSymbol)t2.GetMembers("D").Single()).Type; 1410var a1 = ((IFieldSymbol)t1.GetMembers("A").Single()).Type; 1411var b1 = ((IFieldSymbol)t1.GetMembers("B").Single()).Type; 1412var c1 = ((IFieldSymbol)t1.GetMembers("C").Single()).Type; 1413var d1 = ((IFieldSymbol)t1.GetMembers("D").Single()).Type; 1414var a2 = ((IFieldSymbol)t2.GetMembers("A").Single()).Type; 1415var b2 = ((IFieldSymbol)t2.GetMembers("B").Single()).Type; 1416var c2 = ((IFieldSymbol)t2.GetMembers("C").Single()).Type; 1417var d2 = ((IFieldSymbol)t2.GetMembers("D").Single()).Type; 1473var a1 = ((IFieldSymbol)t1.GetMembers("A").Single()).Type; 1474var b1 = ((IFieldSymbol)t1.GetMembers("B").Single()).Type; 1475var c1 = ((IFieldSymbol)t1.GetMembers("C").Single()).Type; 1476var d1 = ((IFieldSymbol)t1.GetMembers("D").Single()).Type; 1477var a2 = ((IFieldSymbol)t2.GetMembers("A").Single()).Type; 1478var b2 = ((IFieldSymbol)t2.GetMembers("B").Single()).Type; 1479var c2 = ((IFieldSymbol)t2.GetMembers("C").Single()).Type; 1480var d2 = ((IFieldSymbol)t2.GetMembers("D").Single()).Type; 1536var a1 = ((IFieldSymbol)t1.GetMembers("A").Single()).Type; 1537var b1 = ((IFieldSymbol)t1.GetMembers("B").Single()).Type; 1538var c1 = ((IFieldSymbol)t1.GetMembers("C").Single()).Type; 1539var d1 = ((IFieldSymbol)t1.GetMembers("D").Single()).Type; 1540var a2 = ((IFieldSymbol)t2.GetMembers("A").Single()).Type; 1541var b2 = ((IFieldSymbol)t2.GetMembers("B").Single()).Type; 1542var c2 = ((IFieldSymbol)t2.GetMembers("C").Single()).Type; 1543var d2 = ((IFieldSymbol)t2.GetMembers("D").Single()).Type; 1746var ta1 = (ITypeSymbol)a1.GlobalNamespace.GetMembers("T").Single(); 1747var ta2 = (ITypeSymbol)a2.GlobalNamespace.GetMembers("T").Single(); 1748var tb1 = (ITypeSymbol)b1.GlobalNamespace.GetMembers("T").Single(); 1749var tb2 = (ITypeSymbol)b2.GlobalNamespace.GetMembers("T").Single(); 1750var tb3 = (ITypeSymbol)b3.GlobalNamespace.GetMembers("T").Single(); 1835var type1 = (ITypeSymbol)c1.GlobalNamespace.GetMembers("C").Single(); 1836var type2 = (ITypeSymbol)c2.GlobalNamespace.GetMembers("C").Single();
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (3)
AbstractTypeParameterChecker.cs (3)
38foreach (var constraintType in symbol.ConstraintTypes) 94foreach (var typeArgument in symbol.TypeArguments) 123foreach (var typeArgument in symbol.TypeArguments)
Microsoft.CodeAnalysis.Features (401)
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (2)
105private static bool IsClassOrStruct(ITypeSymbol typeSymbol) 108private static bool HasDebuggerDisplayAttribute(ITypeSymbol typeSymbol, Compilation compilation)
AddImport\AbstractAddImportFeatureService.cs (5)
51protected abstract ITypeSymbol GetDeconstructInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); 52protected abstract ITypeSymbol GetQueryClauseInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); 473protected static bool IsViableExtensionMethod(IMethodSymbol method, ITypeSymbol receiver) 623private static ITypeSymbol? GetAwaitInfo(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node) 635private static ITypeSymbol? GetCollectionExpressionType(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node)
AddImport\SymbolReferenceFinder.cs (9)
196var typeSymbols = OfType<ITypeSymbol>(symbols); 223ITypeSymbol symbol, 380ImmutableArray<SymbolResult<IMethodSymbol>> methodSymbols, ITypeSymbol typeSymbol) 437var type = _owner.GetQueryClauseInfo(_semanticModel, _node, cancellationToken); 461var type = GetAwaitInfo(_semanticModel, _syntaxFacts, _node); 486var type = GetCollectionExpressionType(_semanticModel, _syntaxFacts, _node); 511var type = GetCollectionExpressionType(_semanticModel, _syntaxFacts, _node); 536var type = _owner.GetDeconstructInfo(_semanticModel, _node, cancellationToken); 552SearchScope searchScope, string name, ITypeSymbol type, Func<IMethodSymbol, bool> predicate, CancellationToken cancellationToken)
ChangeSignature\AbstractChangeSignatureService.cs (1)
1062var toType = methodSymbol.Parameters.Last().Type;
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (2)
101if (symbol is ITypeSymbol) 104var type = model.GetTypeInfo(node, cancellationToken).Type;
Completion\Providers\AbstractAwaitCompletionProvider.cs (3)
65protected abstract ITypeSymbol? GetTypeSymbolOfExpression(SemanticModel semanticModel, SyntaxNode potentialAwaitableExpression, CancellationToken cancellationToken); 72private static bool IsConfigureAwaitable(Compilation compilation, ITypeSymbol symbol) 74var originalDefinition = symbol.OriginalDefinition;
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
123var type = typeInfo.Type;
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
20protected abstract Tuple<ITypeSymbol, Location>? GetInitializedType(Document document, SemanticModel semanticModel, int position, CancellationToken cancellationToken);
Completion\Providers\AbstractOverrideCompletionProvider.cs (3)
19public abstract ImmutableArray<ISymbol> FilterOverrides(ImmutableArray<ISymbol> members, ITypeSymbol? returnType); 64out ITypeSymbol? returnType, 70protected static ITypeSymbol GetReturnType(ISymbol symbol)
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (2)
129private static ITypeSymbol? GetSymbolType(ISymbol symbol) 209var typeConvertibilityCache = new Dictionary<ITypeSymbol, bool>(SymbolEqualityComparer.Default);
Completion\Providers\AbstractSymbolCompletionProvider.cs (4)
54ImmutableArray<ITypeSymbol> inferredTypes, 57Dictionary<ITypeSymbol, bool> typeConvertibilityCache) 130var typeConvertibilityCache = new Dictionary<ITypeSymbol, bool>(SymbolEqualityComparer.Default); 187Dictionary<ITypeSymbol, bool> typeConvertibilityCache,
Completion\Providers\CompletionUtilities.cs (3)
15public static bool IsTypeImplicitlyConvertible(Compilation compilation, ITypeSymbol sourceType, ImmutableArray<ITypeSymbol> targetTypes) 17foreach (var targetType in targetTypes)
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (6)
44if (TryGetReceiverTypeSymbol(syntaxContext, syntaxFacts, cancellationToken, out var receiverTypeSymbol)) 73[NotNullWhen(true)] out ITypeSymbol? receiverTypeSymbol) 85if (syntaxContext.SemanticModel.GetSymbolInfo(expressionNode, cancellationToken).GetAnySymbol() is not ITypeSymbol) 103private static ITypeSymbol? GetSymbolType(ISymbol symbol) 110IAliasSymbol aliasSymbol => aliasSymbol.Target as ITypeSymbol, 111_ => symbol as ITypeSymbol,
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionProvider.cs (1)
76Target: ITypeSymbol
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (8)
50ITypeSymbol receiverTypeSymbol, 52ImmutableArray<ITypeSymbol> targetTypesSymbols, 105ITypeSymbol receiverTypeSymbol, 107ImmutableArray<ITypeSymbol> targetTypes, 143Compilation compilation, ImmutableArray<IMethodSymbol> extentsionMethodSymbols, ImmutableArray<ITypeSymbol> targetTypeSymbols, CancellationToken cancellationToken) 145Dictionary<ITypeSymbol, bool> typeConvertibilityCache = []; 212Compilation compilation, IMethodSymbol methodSymbol, ImmutableArray<ITypeSymbol> targetTypeSymbols, 213Dictionary<ITypeSymbol, bool> typeConvertibilityCache)
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (14)
32private readonly ITypeSymbol _receiverTypeSymbol; 40private readonly ConcurrentDictionary<ITypeSymbol, bool> _checkedReceiverTypes = []; 45ITypeSymbol receiverTypeSymbol, 242MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols, 309MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols, 345private MultiDictionary<ITypeSymbol, IMethodSymbol> GetPotentialMatchingSymbolsFromAssembly( 351var builder = new MultiDictionary<ITypeSymbol, IMethodSymbol>(); 386if (MatchExtensionMethod(methodSymbol, receiverTypeName, internalsVisible, out var receiverType)) 397static bool MatchExtensionMethod(IMethodSymbol method, string filterReceiverTypeName, bool internalsVisible, out ITypeSymbol? receiverType) 478private static ImmutableArray<string> GetReceiverTypeNames(ITypeSymbol receiverTypeSymbol) 484static void AddNamesForTypeWorker(ITypeSymbol receiverTypeSymbol, PooledHashSet<string> builder) 488foreach (var constraintType in typeParameter.ConstraintTypes) 522private static string GetReceiverTypeName(ITypeSymbol typeSymbol) 530var elementType = arrayType.ElementType;
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
191if (SymbolKey.ResolveString(receiverTypeKey, compilation).GetAnySymbol() is ITypeSymbol receiverTypeSymbol)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
201var childType = semanticModel.GetTypeInfo(childCreation, cancellationToken).Type;
ConvertCast\AbstractConvertCastCodeRefactoringProvider.cs (1)
49var type = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (14)
133ITypeSymbol castType, SyntaxNode collectionVariable, SyntaxToken indexVariable) 180out var explicitCastInterface, out var collectionNameSuggestion, out var countName); 194out ITypeSymbol? explicitCastInterface, out string? collectionNameSuggestion, out string? countName) 201var foreachType = foreachVariable.Type; 207var collectionType = foreachCollection.Type; 292ITypeSymbol? explicitInterface = null; 340ITypeSymbol type1, ITypeSymbol type2, Compilation compilation) 346private static bool IsNullOrErrorType([NotNullWhen(false)] ITypeSymbol? type) 349private static IMethodSymbol? GetInterfaceMember(ITypeSymbol interfaceType, string memberName) 430ITypeSymbol? explicitCastInterface, ITypeSymbol forEachElementType, 437public ITypeSymbol? ExplicitCastInterface { get; } = explicitCastInterface; 438public ITypeSymbol ForEachElementType { get; } = forEachElementType;
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (13)
51TExpressionSyntax collectionExpression, ITypeSymbol iterationVariableType); 119out var iterationType)) 232INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol 239INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol 245INamedTypeSymbol containingType, ITypeSymbol collectionType, 247[NotNullWhen(true)] out ITypeSymbol? iterationType) 282INamedTypeSymbol ienumeratorType, [NotNullWhen(true)] out ITypeSymbol? iterationType) 284var getEnumeratorReturnType = getEnumeratorMethod.ReturnType; 315ITypeSymbol collectionType, 316ITypeSymbol iterationType, 345var indexerType = GetIndexerType(containingType, collectionType, semanticModel.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)); 499private static ITypeSymbol? GetIndexerType( 501ITypeSymbol collectionType,
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (2)
51public abstract bool CanImplicitlyConvert(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol targetType); 63private ITypeSymbol? _switchTargetType = null!;
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (1)
47var symbol = semanticModel.GetTypeInfo(numericLiteralNode, cancellationToken).Type;
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (3)
83var lastArgumentType = semanticModel.GetTypeInfo(syntaxFacts.GetExpressionOfArgument(lastArgument), cancellationToken).Type; 92var type = semanticModel.GetTypeInfo(syntaxFacts.GetExpressionOfArgument(argument)).Type; 294var convertedType = semanticModel.GetTypeInfo(argumentExpression, cancellationToken).ConvertedType;
DesignerAttribute\DesignerAttributeDiscoveryService.cs (2)
307foreach (var type in GetBaseTypesAndThis(semanticModel.Compilation, firstClassType)) 327static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(Compilation compilation, INamedTypeSymbol firstType)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (8)
1785protected void AddRudeTypeUpdateAroundActiveStatement(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode newNode, ITypeSymbol oldType, ITypeSymbol newType) 1968var oldType = oldModel.GetTypeInfo(oldTypedNodes[t], cancellationToken).Type; 1969var newType = newModel.GetTypeInfo(newTypedNodes[t], cancellationToken).Type; 2399protected static bool TypesEquivalent(ITypeSymbol? oldType, ITypeSymbol? newType, bool exact) 2400=> (exact ? s_exactSymbolEqualityComparer : (IEqualityComparer<ITypeSymbol?>)s_runtimeSymbolEqualityComparer.SignatureTypeEquivalenceComparer).Equals(oldType, newType); 2402protected static bool TypesEquivalent<T>(ImmutableArray<T> oldTypes, ImmutableArray<T> newTypes, bool exact) where T : ITypeSymbol
EmbeddedLanguages\AbstractLanguageDetector.cs (1)
37protected abstract bool TryGetOptions(SemanticModel semanticModel, ITypeSymbol exprType, SyntaxNode expr, CancellationToken cancellationToken, out TOptions options);
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (3)
44protected override bool TryGetOptions(SemanticModel semanticModel, ITypeSymbol exprType, SyntaxNode expr, CancellationToken cancellationToken, out DateAndTimeOptions options) 67var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; 160private bool IsDateTimeType(ITypeSymbol? type)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
171var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
EmbeddedLanguages\Json\LanguageServices\JsonLanguageDetector.cs (1)
160SemanticModel semanticModel, ITypeSymbol exprType, SyntaxNode expr, CancellationToken cancellationToken, out JsonOptions options)
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexLanguageDetector.cs (1)
184SemanticModel semanticModel, ITypeSymbol exprType, SyntaxNode expr, CancellationToken cancellationToken, out RegexOptions options)
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
364protected static Accessibility ComputeAccessibility(Accessibility accessibility, ITypeSymbol type)
ExtractMethod\Extensions.cs (2)
13public static ITypeSymbol? GetLambdaOrAnonymousMethodReturnType(this SemanticModel binding, SyntaxNode node) 39public static T ResolveType<T>(this SemanticModel semanticModel, T symbol) where T : class, ITypeSymbol
ExtractMethod\MethodExtractor.Analyzer.cs (20)
66protected abstract VariableInfo CreateFromSymbol(Compilation compilation, ISymbol symbol, ITypeSymbol type, VariableStyle variableStyle, bool variableDeclared); 124protected abstract ITypeSymbol GetRangeVariableType(SemanticModel model, IRangeVariableSymbol symbol); 210private (ITypeSymbol typeSymbol, bool hasAnonymousType, bool awaitTaskReturn) AdjustReturnType(SemanticModel model, ITypeSymbol returnType) 231private void UnwrapTaskIfNeeded(SemanticModel model, ref ITypeSymbol returnType) 240var originalDefinition = returnType.OriginalDefinition; 261private void WrapReturnTypeInTask(SemanticModel model, ref ITypeSymbol returnType, out bool awaitTaskReturn) 291private (ImmutableArray<VariableInfo> parameters, ITypeSymbol returnType, bool returnsByRef, VariableInfo? variableToUseAsReturnValue, bool unsafeAddressTakenUsed) 527var type = GetSymbolType(model, symbol); 562ITypeSymbol type, 632private bool SelectionContainsOnlyIdentifierWithSameType(ITypeSymbol type) 650protected virtual ITypeSymbol GetSymbolType(SemanticModel model, ISymbol symbol) 756var type = GetRangeVariableType(model, rangeVariable); 779foreach (var type in constraintTypes) 826var visited = new HashSet<ITypeSymbol>(); 838foreach (var type in constraintTypes) 852ITypeSymbol type, HashSet<ITypeSymbol> visited) 902private static IEnumerable<ITypeParameterSymbol> GetMethodTypeParametersInDeclaration(ITypeSymbol returnType, SortedDictionary<int, ITypeParameterSymbol> sortedMap) 941ITypeSymbol type,
ExtractMethod\MethodExtractor.AnalyzerResult.cs (2)
24ITypeSymbol returnType, 56public ITypeSymbol ReturnType { get; } = returnType;
ExtractMethod\MethodExtractor.cs (2)
263SemanticModel semanticModel, SyntaxNode contextNode, ITypeSymbol type) 278var currentType = semanticModel.GetSpeculativeTypeInfo(contextNode.SpanStart, typeName, SpeculativeBindingOption.BindAsTypeOrNamespace).Type;
ExtractMethod\MethodExtractor.TypeParameterCollector.cs (1)
19public static IEnumerable<ITypeParameterSymbol> Collect(ITypeSymbol typeSymbol)
ExtractMethod\MethodExtractor.VariableInfo.cs (2)
115public ITypeSymbol OriginalType => _variableSymbol.OriginalType; 117public ITypeSymbol GetVariableType()
ExtractMethod\MethodExtractor.VariableSymbol.cs (7)
24protected VariableSymbol(Compilation compilation, ITypeSymbol type) 51public ITypeSymbol OriginalType { get; } 76private static bool IsCancellationToken(ITypeSymbol originalType) 94protected abstract class NotMovableVariableSymbol(Compilation compilation, ITypeSymbol type) : VariableSymbol(compilation, type) 118public ParameterVariableSymbol(Compilation compilation, IParameterSymbol parameterSymbol, ITypeSymbol type) 197public LocalVariableSymbol(Compilation compilation, ILocalSymbol localSymbol, ITypeSymbol type, HashSet<int> nonNoisySet) 311public QueryVariableSymbol(Compilation compilation, IRangeVariableSymbol symbol, ITypeSymbol type)
ExtractMethod\SelectionResult.cs (2)
56public abstract (ITypeSymbol returnType, bool returnsByRef) GetReturnType(); 58public ITypeSymbol GetContainingScopeType()
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (5)
77var comparedType = iface.TypeArguments[0]; 122private static IMethodSymbol? TryGetCompareMethodImpl(INamedTypeSymbol containingType, ITypeSymbol comparableType) 184var comparedType = comparableType.TypeArguments[0]; 229private static bool HasAllComparisonOperators(INamedTypeSymbol containingType, ITypeSymbol comparedType) 240private static bool HasComparisonOperator(INamedTypeSymbol containingType, ITypeSymbol comparedType, CodeGenerationOperatorKind kind)
GenerateType\AbstractGenerateTypeService.cs (2)
50protected abstract ITypeSymbol DetermineArgumentType(SemanticModel semanticModel, TArgumentSyntax argument, CancellationToken cancellationToken); 202var type = argument == null ? null : semanticModel.GetTypeInfo(argument, cancellationToken).Type;
GenerateType\AbstractGenerateTypeService.Editor.cs (7)
29protected abstract bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType); 563private ImmutableArray<ITypeSymbol> GetArgumentTypes(IList<TArgumentSyntax> argumentList) 575private ITypeSymbol FixType( 576ITypeSymbol typeSymbol) 584ITypeSymbol parameterType, 616ITypeSymbol parameterType,
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (2)
68private ITypeSymbol DetermineReturnType() 204var parameterType = parameterTypes[i];
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (2)
34protected abstract bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination);
InlineHints\TypeHint.cs (3)
10internal readonly struct TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 14public ITypeSymbol Type { get; } = type; 23public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (2)
59protected abstract SyntaxNode GenerateTypeSyntax(ITypeSymbol symbol, bool allowVar); 60protected abstract TExpressionSyntax GenerateLiteralExpression(ITypeSymbol typeSymbol, object? value);
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
70var expressionType = semanticModel.GetTypeInfo(expression, cancellationToken).Type;
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (5)
266var parameterType = await GetTypeOfExpressionAsync(cancellationToken).ConfigureAwait(false); 344private async Task<ITypeSymbol> GetTypeOfExpressionAsync(CancellationToken cancellationToken) 392var typeSymbol = await GetTypeOfExpressionAsync(cancellationToken).ConfigureAwait(false); 442string? newMethodIdentifier, ITypeSymbol? typeSymbol, bool isTrampoline, CancellationToken cancellationToken) 527var parameterType = await GetTypeOfExpressionAsync(cancellationToken).ConfigureAwait(false);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (3)
84var localType = declarator.Symbol.Type; 104private static bool IsLegalUsingStatementType(Compilation compilation, ITypeSymbol disposableType, ITypeSymbol type)
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
44var type = semanticModel.GetTypeInfo(expression).Type; 82ITypeSymbol type,
IntroduceVariable\AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs (1)
108protected ITypeSymbol GetExpressionType(
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
403protected static ITypeSymbol GetTypeSymbol(
IntroduceVariable\AbstractIntroduceVariableService.State.cs (1)
79var expressionType = Document.SemanticModel.GetTypeInfo(Expression, cancellationToken).Type;
IntroduceVariable\AbstractIntroduceVariableService.State_Block.cs (1)
32var type = GetTypeSymbol(Document, Expression, cancellationToken, objectAsDefault: false);
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (2)
54foreach (var typeArgument in symbol.TypeArguments) 132foreach (var constraint in symbol.ConstraintTypes)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
729List<ITypeSymbol> typeArguments)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedEventSymbol.cs (1)
33public ITypeSymbol Type => _symbol.Type;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedFieldSymbol.cs (1)
46public ITypeSymbol Type => _symbol.Type;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (7)
70public ITypeSymbol ReceiverType => _symbol.ReceiverType; 78public ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 92public ITypeSymbol ReturnType => _symbol.ReturnType; 103public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments; 109public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 112public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 118public IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (8)
79public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments; 91public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 94public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 132ITypeSymbol ITypeSymbol.OriginalDefinition => _symbol.OriginalDefinition; 151NullableAnnotation ITypeSymbol.NullableAnnotation => throw new NotImplementedException(); 153ITypeSymbol ITypeSymbol.WithNullableAnnotation(NullableAnnotation nullableAnnotation)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
52public ITypeSymbol Type => _symbol.Type;
PreferFrameworkType\PreferFrameworkTypeCodeFixProvider.cs (1)
58if (semanticModel.GetSymbolInfo(node, cancellationToken).Symbol is ITypeSymbol typeSymbol)
PreferFrameworkType\PreferFrameworkTypeDiagnosticAnalyzerBase.cs (1)
88if (semanticModel.GetSymbolInfo(typeNode, cancellationToken).Symbol is not ITypeSymbol typeSymbol ||
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
61foreach (var typeParameter in symbol.TypeArguments.Concat(symbol.TypeParameters))
RelatedDocuments\AbstractRelatedDocumentsService.cs (1)
132if (symbol is not ITypeSymbol)
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (2)
285var conditionalType = semanticModel.GetTypeInfo(conditionalExpression, cancellationToken).Type; 305SyntaxNode TryConvert(SyntaxNode expression, ITypeSymbol? conditionalType)
RQName\RQNodeBuilder.cs (2)
258private static RQType? BuildType(ITypeSymbol symbol) 324foreach (var typeArgument in entry.TypeArguments)
Shared\Extensions\ISymbolExtensions_Sorting.cs (1)
42private static INamedTypeSymbol GetNamedType(ITypeSymbol type)
Shared\Utilities\ExtractTypeHelpers.cs (4)
146foreach (var constraint in typeParameter.ConstraintTypes) 198private static bool DoesMemberReferenceTypeParameter(ISymbol member, ITypeParameterSymbol typeParameter, HashSet<ITypeSymbol> checkedTypes) 223private static bool DoesTypeReferenceTypeParameter(ITypeSymbol type, ITypeParameterSymbol typeParameter, HashSet<ITypeSymbol> checkedTypes)
SignatureHelp\CommonSignatureHelpUtilities.cs (1)
161var parentType = parentOperation?.Type;
Snippets\SnippetFunctionService.cs (2)
58var typeSymbol = await GetEnumSymbolAsync(document, switchExpressionLocation, cancellationToken).ConfigureAwait(false); 120protected abstract Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken);
Snippets\SnippetProviders\AbstractConditionalBlockSnippetProvider.cs (1)
20protected sealed override bool IsValidAccessingType(ITypeSymbol type, Compilation compilation)
Snippets\SnippetProviders\AbstractForEachLoopSnippetProvider.cs (1)
13protected sealed override bool IsValidAccessingType(ITypeSymbol type, Compilation compilation)
Snippets\SnippetProviders\AbstractForLoopSnippetProvider.cs (5)
13protected sealed override bool IsValidAccessingType(ITypeSymbol type, Compilation compilation) 27protected static bool IsSuitableIntegerType(ITypeSymbol type) 30protected static IPropertySymbol? FindLengthProperty(ITypeSymbol type, Compilation compilation) 33protected static IPropertySymbol? FindCountProperty(ITypeSymbol type, Compilation compilation) 36private static IPropertySymbol? FindAccessibleIntegerProperty(ITypeSymbol type, Compilation compilation, string propertyName)
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (3)
28protected abstract bool IsValidAccessingType(ITypeSymbol type, Compilation compilation); 117if (symbolInfo.Symbol is ITypeSymbol) 150if (symbolInfo.Symbol is ITypeSymbol)
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (5)
41protected abstract (CommonConversion conversion, ITypeSymbol? collectionElementType) GetForEachInfo(SemanticModel semanticModel, TForEachStatementSyntax node); 68variableDeclarator.Symbol.Type is not ITypeSymbol iterationType) 74var collectionType = semanticModel.GetTypeInfo(syntaxFacts.GetExpressionOfForeachStatement(node), cancellationToken).Type; 157private static bool IsStronglyTyped(ITypeSymbol collectionType, ITypeSymbol collectionElementType)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
182if (symbol is ITypeSymbol typeSymbol && typeSymbol.DeclaringSyntaxReferences.Length > 1)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (4)
60var type = value.Type; 82private (bool missingCases, bool missingDefaultCase) AnalyzeSwitch(TSwitchOperation switchOperation, ITypeSymbol type) 100private (bool missingCases, bool missingDefaultCase) AnalyzeBooleanSwitch(TSwitchOperation operation, ITypeSymbol type) 117private (bool missingCases, bool missingDefaultCase) AnalyzeEnumSwitch(TSwitchOperation operation, ITypeSymbol type)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (2)
19var switchExpressionType = switchExpression?.Type; 108var type = operation.Value.Type;
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (3)
58var switchExpressionType = switchExpression?.Type; 152ITypeSymbol enumType, 185var type = operation.Value.Type;
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
85var leftType = leftOperand.Type; 86var rightType = rightOperand.Type;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
292ITypeSymbol containingType,
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
166var exprType = semanticModel.GetTypeInfo(initializer, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
104var conditionType = semanticModel.GetTypeInfo(
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
187var type = this.SemanticModel.GetTypeInfo(_objectCreationExpression, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
252var convertedType = this.SemanticModel.GetTypeInfo(SyntaxFacts.GetExpressionOfArgument(arguments[0]), cancellationToken).ConvertedType;
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (2)
81static bool AreEqualOrHaveImplicitConversion(ITypeSymbol? firstType, ITypeSymbol? secondType, Compilation compilation)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
154var parameterType = semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (3)
147var whenPartType = semanticModel.GetTypeInfo(whenPartMatch, cancellationToken).Type; 151var type = semanticModel.GetTypeInfo(conditionalExpression, cancellationToken).Type; 359var typeSymbol = semanticModel.GetTypeInfo(type, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
85var whenPartType = semanticModel.GetTypeInfo(whenPartMatch, cancellationToken).Type;
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (2)
122var type = this.SemanticModel.GetTypeInfo(_objectCreationExpression, cancellationToken).Type; 175ITypeSymbol classOrStructType,
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
186var argsArgumentType = TryGetArgsArgumentType(semanticModel, arguments, parameters, syntaxFacts); 190private ITypeSymbol? TryGetArgsArgumentType(
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (11)
30protected abstract TExpressionSyntax Cast(TExpressionSyntax expression, ITypeSymbol type); 48protected ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> GetPotentialTargetTypes( 52using var _ = ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)>.GetInstance(out var candidates); 63ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> candidates, 120ITypeSymbol conversionType, 143var castType = semanticModel.GetTypeInfo(castTypeNode, cancellationToken).Type; 161protected virtual (SyntaxNode finalTarget, SyntaxNode finalReplacement) Cast(SemanticModel semanticModel, TExpressionSyntax targetNode, ITypeSymbol conversionType) 164private static string GetSubItemName(SemanticModel semanticModel, int position, ITypeSymbol conversionType) 171private static ImmutableArray<(TExpressionSyntax, ITypeSymbol)> FilterValidPotentialConversionTypes( 174ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> candidates) 179using var _ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(candidates.Count, out var validPotentialConversionTypes);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (7)
24protected abstract TArgumentSyntax GenerateNewArgument(TArgumentSyntax oldArgument, ITypeSymbol conversionType); 38public ImmutableArray<(TExpressionSyntax, ITypeSymbol)> GetPotentialConversionTypes( 60using var __ = ArrayBuilder<(TExpressionSyntax, ITypeSymbol)>.GetInstance(out var mutablePotentialConversionTypes); 65targetArgument, cancellationToken, out var targetArgumentConversionType) 116[NotNullWhen(true)] out ITypeSymbol? targetArgumentConversionType) 153var parameterType = parameters[parameterIndex].Type; 169&& semanticModel.GetTypeInfo(argumentExpression, cancellationToken).Type is ITypeSymbol argumentType
src\Analyzers\Core\CodeFixes\AddExplicitCast\InheritanceDistanceComparer.cs (8)
34: IComparer<(TExpressionSyntax syntax, ITypeSymbol symbol)> 39public int Compare((TExpressionSyntax syntax, ITypeSymbol symbol) x, 40(TExpressionSyntax syntax, ITypeSymbol symbol) y) 49var baseType = _semanticModel.GetTypeInfo(x.syntax).Type; 59private static int GetInheritanceDistanceRecursive(ITypeSymbol baseType, ITypeSymbol? derivedType) 83private int GetInheritanceDistance(ITypeSymbol? baseType, ITypeSymbol castType)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (4)
38protected abstract ITypeSymbol GetArgumentType(SyntaxNode argumentNode, SemanticModel semanticModel, CancellationToken cancellationToken); 393private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken) 397var argumentType = GetArgumentType(argument, semanticModel, cancellationToken); 535Compilation compilation, TypeInfo argumentTypeInfo, ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (2)
76ITypeSymbol newParameterType, 161ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (7)
26protected abstract string GetTextPreviewOfChange(string aliasName, ITypeSymbol typeSymbol); 54foreach (var symbol in Sort(symbolInfo.CandidateSymbols.Cast<ITypeSymbol>(), placementOption.PlaceSystemNamespaceFirst)) 78private static IEnumerable<ITypeSymbol> Sort(IEnumerable<ITypeSymbol> types, bool sortSystemFirst) 82var typeToNameSegments = new Dictionary<ITypeSymbol, ImmutableArray<string>>(); 108ImmutableArray<string> GetNameSegments(ITypeSymbol symbol)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
25protected abstract ITypeSymbol GetForEachElementType(SemanticModel semanticModel, TForEachStatementSyntax forEachStatement); 73var elementType = GetForEachElementType(semanticModel, forEachStatement); 88ITypeSymbol iterationVariableType,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (3)
38protected abstract ITypeSymbol GetArgumentType(SemanticModel semanticModel, Argument argument, CancellationToken cancellationToken); 41protected abstract bool IsConversionImplicit(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (9)
49public ImmutableArray<ITypeSymbol> ParameterTypes; 280internal ImmutableArray<ITypeSymbol> GetParameterTypes(CancellationToken cancellationToken) 289private static ITypeSymbol FixType(ITypeSymbol typeSymbol, SemanticModel semanticModel, IEnumerable<ITypeParameterSymbol> allTypeParameters) 363private static bool IsValidAttributeParameterType(ITypeSymbol type) 410ImmutableArray<ITypeSymbol> parameterTypes, 423var parameterType = parameterTypes[i]; 448ITypeSymbol parameterType, 537ITypeSymbol parameterType,
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
28protected abstract ITypeSymbol DetermineReturnTypeForSimpleNameOrMemberAccessExpression(ITypeInferenceService typeInferenceService, SemanticModel semanticModel, TExpressionSyntax expression, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.State.cs (2)
181var expressionType = service.DetermineReturnTypeForSimpleNameOrMemberAccessExpression(typeInference, semanticModel, SimpleNameOrMemberAccessExpression, cancellationToken); 248ITypeSymbol expressionType)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (6)
83private List<ITypeSymbol> MergeClassTypes(List<ITypeSymbol> classTypes) 89var type1 = classTypes[i]; 96var type2 = classTypes[j]; 113protected abstract bool IsImplicitReferenceConversion(Compilation compilation, ITypeSymbol sourceType, ITypeSymbol targetType);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (3)
24protected override ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken) 39protected override ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken) 47protected override ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (12)
40private IDictionary<ITypeSymbol, ITypeParameterSymbol> _typeArgumentToTypeParameterMap; 52public ValueTask<ITypeSymbol> DetermineReturnTypeAsync(CancellationToken cancellationToken) 54var type = DetermineReturnTypeWorker(cancellationToken); 63protected abstract ImmutableArray<ITypeSymbol> DetermineTypeArguments(CancellationToken cancellationToken); 64protected abstract ITypeSymbol DetermineReturnTypeWorker(CancellationToken cancellationToken); 66protected abstract ImmutableArray<ITypeSymbol> DetermineParameterTypes(CancellationToken cancellationToken); 102var returnType = await DetermineReturnTypeAsync(cancellationToken).ConfigureAwait(false); 144private async ValueTask<ITypeSymbol> FixTypeAsync( 145ITypeSymbol typeSymbol, 167private IDictionary<ITypeSymbol, ITypeParameterSymbol> GetTypeArgumentToTypeParameterMap( 173private IDictionary<ITypeSymbol, ITypeParameterSymbol> CreateTypeArgumentToTypeParameterMap( 183var result = new Dictionary<ITypeSymbol, ITypeParameterSymbol>(SymbolEqualityComparer.Default);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (8)
21private static async ValueTask<ITypeSymbol> ReplaceTypeParametersBasedOnTypeConstraintsAsync( 23ITypeSymbol type, 38public readonly Dictionary<ITypeSymbol, ITypeSymbol> Substitutions = []; 52foreach (var typeArg in symbol.TypeArguments) 80var commonDerivedType = await DetermineCommonDerivedTypeAsync(symbol).ConfigureAwait(false); 85private async ValueTask<ITypeSymbol> DetermineCommonDerivedTypeAsync(ITypeParameterSymbol symbol) 114var substitutedType = await ReplaceTypeParametersBasedOnTypeConstraintsAsync(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
37protected abstract bool TryConvertToLocalDeclaration(ITypeSymbol type, SyntaxToken identifierToken, SemanticModel semanticModel, CancellationToken cancellationToken, out SyntaxNode newRoot);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
44public ITypeSymbol TypeMemberType { get; private set; } 45public ITypeSymbol LocalType { get; private set; }
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (5)
302private static bool InheritsFromOrEquals(ITypeSymbol type, ITypeSymbol baseType) 305private static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(ITypeSymbol? type) 307var current = type;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (6)
21Func<ITypeSymbol, bool> includeMemberType, 157foreach (var typeArg in methodSymbol.TypeArguments) 173private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, HashSet<ITypeSymbol> alreadyCheckingTypes) 182foreach (var constraint in typeParameter.ConstraintTypes) 203foreach (var genericParam in namedType.TypeArguments)
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
26protected abstract bool IsAsyncReturnType(ITypeSymbol type, KnownTaskTypes knownTypes);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (2)
39protected abstract ITypeSymbol GetSwitchType(TSwitchOperation switchStatement); 164var enumType = GetSwitchType(switchOperation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchExpressionCodeFixProvider.cs (1)
43protected sealed override ITypeSymbol GetSwitchType(ISwitchExpressionOperation switchExpression)
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchStatementCodeFixProvider.cs (1)
59protected sealed override ITypeSymbol GetSwitchType(ISwitchOperation switchOperation)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (6)
108private static bool ShouldOfferFix(ITypeSymbol returnType, KnownTaskTypes knownTypes) 113private static bool IsTaskType(ITypeSymbol returnType, KnownTaskTypes knownTypes) 122ITypeSymbol returnType, 185ITypeSymbol returnType, 214private static SyntaxNode GetReturnTaskCompletedTaskStatement(SyntaxGenerator generator, ITypeSymbol returnType, KnownTaskTypes knownTypes) 231private static SyntaxNode WrapExpressionWithTaskFromResult(SyntaxGenerator generator, SyntaxNode expression, ITypeSymbol returnType, KnownTaskTypes knownTypes)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
602var type = semanticModel.GetTypeInfo(node, cancellationToken).Type; 687TLocalDeclarationStatementSyntax CreateLocalDeclarationStatement(ITypeSymbol type, string name)
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (1)
29protected virtual ITypeSymbol? TryGetExplicitCast(
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
407var typeSymbol = result.Value.Type; 696private ITypeSymbol ParseArrayType(ITypeSymbol typeSymbol) 764var boundReturnType = BindParameterOrReturnType(methodSymbol, returnType.Value); 801var parameterType = BindParameterOrReturnType(symbol.ContainingSymbol, parameterInfo.Type); 806private ITypeSymbol BindParameterOrReturnType(ISymbol bindingContext, TypeInfo type) 868public readonly ITypeSymbol Type; 876private TypeInfo(ITypeSymbol type, int startIndex) 882public static TypeInfo Create(ITypeSymbol type)
StackTraceExplorer\AbstractStackTraceSymbolResolver.cs (3)
23protected static bool MatchTypeArguments(ImmutableArray<ITypeSymbol> typeArguments, StackFrameTypeArgumentList? stackFrameTypeArgumentList) 39protected static bool MatchType(ITypeSymbol type, StackFrameTypeNode stackFrameType) 48ITypeSymbol currentType = arrayType;
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\SemanticEditDescription.cs (2)
16Func<Compilation, ITypeSymbol>? partialType, 24public readonly Func<Compilation, ITypeSymbol>? PartialType = partialType;
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\Definitions\AbstractGoToDefinitionHandler.cs (1)
81if (!typeOnly || symbol is ITypeSymbol)
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Services\ExtensionMethodImportCompletion\RemoteExtensionMethodImportCompletionService.cs (2)
51if (symbol is ITypeSymbol receiverTypeSymbol) 56.Select(symbolKey => SymbolKey.ResolveString(symbolKey, compilation, cancellationToken: cancellationToken).GetAnySymbol() as ITypeSymbol)
Microsoft.CodeAnalysis.Test.Utilities (24)
Compilation\OperationTreeVerifier.cs (2)
274private void LogType(ITypeSymbol type, string header = "Type") 1227private void LogHasOperatorMethodExpressionCommon(IMethodSymbol operatorMethodOpt, ITypeSymbol constrainedToTypeOpt)
Compilation\TestOperationVisitor.cs (8)
47var type = operation.Type; 442var exceptionType = operation.ExceptionType; 770var constrainedToType = operation.ConstrainedToType; 874private static void AssertConstrainedToType(ISymbol member, ITypeSymbol constrainedToType) 1220foreach (var typeArg in operation.TypeArguments) 1225var containingType = operation.ContainingType; 1277var naturalType = operation.NaturalType; 1491case ITypeSymbol type:
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (9)
67ITypeSymbol type = increment.Type; 162private static bool HasMoreSpecificSourceType<SymbolType>(SymbolType symbol, ITypeSymbol symbolType, Dictionary<SymbolType, HashSet<INamedTypeSymbol>> symbolsSourceTypes, out INamedTypeSymbol commonSourceType) 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) 279private static ITypeSymbol OriginalType(IOperation value) 293private void Report(OperationBlockAnalysisContext context, ILocalSymbol local, ITypeSymbol moreSpecificType, DiagnosticDescriptor descriptor) 298private void Report(CompilationAnalysisContext context, IFieldSymbol field, ITypeSymbol moreSpecificType, DiagnosticDescriptor descriptor)
Diagnostics\EmptyArrayAnalyzer.cs (1)
73var elementType = (arrayCreation as IArrayTypeSymbol)?.ElementType;
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (2)
49ITypeSymbol staticConstructorType = containingMethod.MethodKind == MethodKind.StaticConstructor ? containingMethod.ContainingType : null; 111private static void AssignTo(IOperation target, bool inConstructor, ITypeSymbol staticConstructorType, HashSet<IFieldSymbol> assignedToFields, HashSet<IFieldSymbol> mightBecomeReadOnlyFields)
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
88var localType = local.Type;
Mocks\TestMessageProvider.cs (1)
273protected override void ReportInvalidNamedArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName)
Microsoft.CodeAnalysis.UnitTests (2)
MetadataReferences\MetadataReferenceTests.cs (2)
575var c = (ITypeSymbol)comp.GlobalNamespace.GetMembers("C").Single();
Microsoft.CodeAnalysis.VisualBasic (151)
Binding\MemberSemanticModel.vb (1)
107Public Overrides Function ClassifyConversion(expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion
Compilation\ForEachStatementInfo.vb (2)
38Public ReadOnly Property ElementType As ITypeSymbol 67elementType As ITypeSymbol,
Compilation\SemanticModel.vb (2)
2335Public MustOverride Shadows Function ClassifyConversion(expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion 2350Public Shadows Function ClassifyConversion(position As Integer, expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion
Compilation\SpeculativeSemanticModelWithMemberModel.vb (1)
129Public Overrides Function ClassifyConversion(expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion
Compilation\SyntaxTreeSemanticModel.vb (1)
1388Public Overrides Function ClassifyConversion(expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion
Compilation\VisualBasicCompilation.vb (21)
865Protected Overrides ReadOnly Property CommonScriptGlobalsType As ITypeSymbol 1875Public Shadows Function ClassifyConversion(source As ITypeSymbol, destination As ITypeSymbol) As Conversion 1894Public Overrides Function ClassifyCommonConversion(source As ITypeSymbol, destination As ITypeSymbol) As CommonConversion 1898Friend Overrides Function ClassifyConvertibleConversion(source As IOperation, destination As ITypeSymbol, ByRef constantValue As ConstantValue) As IConvertibleConversion 1905Dim sourceType As ITypeSymbol = source.Type 2018Private Protected Overrides Function IsSymbolAccessibleWithinCore(symbol As ISymbol, within As ISymbol, throughType As ITypeSymbol) As Boolean 2028Friend Shadows Function IsSymbolAccessibleWithin(symbol As ISymbol, within As ISymbol, Optional throughType As ITypeSymbol = Nothing) As Boolean 2847Protected Overrides Function CommonCreateArrayTypeSymbol(elementType As ITypeSymbol, rank As Integer, elementNullableAnnotation As NullableAnnotation) As IArrayTypeSymbol 2851Protected Overrides Function CommonCreateTupleTypeSymbol(elementTypes As ImmutableArray(Of ITypeSymbol), 2892Protected Overrides Function CommonCreatePointerTypeSymbol(elementType As ITypeSymbol) As IPointerTypeSymbol 2897returnType As ITypeSymbol, 2899parameterTypes As ImmutableArray(Of ITypeSymbol), 2911memberTypes As ImmutableArray(Of ITypeSymbol), 2941returnType As ITypeSymbol, 2942leftType As ITypeSymbol, 2943rightType As ITypeSymbol) As IMethodSymbol 3025returnType As ITypeSymbol, 3026operandType As ITypeSymbol) As IMethodSymbol 3075Protected Overrides ReadOnly Property CommonDynamicType As ITypeSymbol
Errors\MessageProvider.vb (1)
487Protected Overrides Sub ReportInvalidNamedArgument(diagnostics As DiagnosticBag, attributeSyntax As SyntaxNode, namedArgumentIndex As Integer, attributeClass As ITypeSymbol, parameterName As String)
Operations\VisualBasicOperationFactory.vb (63)
375Dim type As ITypeSymbol = boundAssignmentOperator.Type 384Dim type As ITypeSymbol = boundMeReference.Type 392Dim type As ITypeSymbol = boundMyBaseReference.Type 400Dim type As ITypeSymbol = boundMyClassReference.Type 407Dim type As ITypeSymbol = boundLiteral.Type 416Dim type As ITypeSymbol = boundAwaitOperator.Type 424Dim type As ITypeSymbol = boundNameOfOperator.Type 452Dim type As ITypeSymbol = boundCall.Type 459Dim type As ITypeSymbol = boundOmittedArgument.Type 467Dim type As ITypeSymbol = boundParenthesized.Type 477Dim type As ITypeSymbol = boundArrayAccess.Type 503Dim type As ITypeSymbol = boundUnaryOperator.Type 516Dim type As ITypeSymbol = boundUserDefinedUnaryOperator.Type 569Dim type As ITypeSymbol = currentBinary.Type 588Dim type As ITypeSymbol = boundUserDefinedBinaryOperator.Type 600Dim type As ITypeSymbol = boundBinaryConditionalExpression.Type 629Dim type As ITypeSymbol = boundUserDefinedShortCircuitingOperator.Type 651Dim type As ITypeSymbol = If(syntax.IsMissing, Nothing, boundBadExpression.Type) 668Dim type As ITypeSymbol = Nothing 721Dim type As ITypeSymbol = boundConversionOrCast.Type 751Dim type As ITypeSymbol = boundDelegateCreationExpression.Type 772Dim type As ITypeSymbol = Nothing 782Dim type As ITypeSymbol = boundTernaryConditionalExpression.Type 791Dim typeOperand As ITypeSymbol = boundTypeOf.TargetType 794Dim type As ITypeSymbol = boundTypeOf.Type 800Dim typeOperand As ITypeSymbol = boundGetType.SourceType.Type 802Dim type As ITypeSymbol = boundGetType.Type 813Dim type As ITypeSymbol = boundLateInvocation.Type 825Dim type As ITypeSymbol = boundObjectCreationExpression.Type 834Dim type As ITypeSymbol = boundObjectInitializerExpression.Type 842Dim type As ITypeSymbol = boundCollectionInitializerExpression.Type 850Dim type As ITypeSymbol = boundNewT.Type 858Dim type As ITypeSymbol = creation.Type 867Dim type As ITypeSymbol = boundArrayCreation.Type 887Dim type As ITypeSymbol = boundPropertyAccess.Type 895Dim type As ITypeSymbol = boundWithLValueExpressionPlaceholder.Type 903Dim type As ITypeSymbol = boundWithRValueExpressionPlaceholder.Type 913Dim type As ITypeSymbol = boundEventAccess.Type 924Dim type As ITypeSymbol = boundFieldAccess.Type 935Dim type As ITypeSymbol = boundConditionalAccess.Type 942Dim type As ITypeSymbol = boundConditionalAccessReceiverPlaceholder.Type 950Dim type As ITypeSymbol = boundParameter.Type 959Dim type As ITypeSymbol = boundLocal.Type 970Dim typeArguments As ImmutableArray(Of ITypeSymbol) = ImmutableArray(Of ITypeSymbol).Empty 972typeArguments = ImmutableArray(Of ITypeSymbol).CastUp(boundLateMemberAccess.TypeArgumentsOpt.Arguments) 974Dim containingType As ITypeSymbol = Nothing 985Dim type As ITypeSymbol = boundLateMemberAccess.Type 1023Dim type As ITypeSymbol = boundRValuePlaceholder.Type 1065Dim type As ITypeSymbol = Nothing 1287Dim exceptionType As ITypeSymbol = If(boundCatchBlock.ExceptionSourceOpt?.Type, DirectCast(_semanticModel.Compilation, VisualBasicCompilation).GetWellKnownType(WellKnownType.System_Exception)) 1338Dim expressionType As ITypeSymbol = Nothing 1429Dim type As ITypeSymbol = Nothing 1485Dim eventReferenceType As ITypeSymbol = boundRaiseEventStatement.EventSymbol.Type 1538Dim type As ITypeSymbol = Nothing 1552Private Function CreateTupleOperation(boundTupleExpression As BoundTupleExpression, naturalType As ITypeSymbol) As ITupleOperation 1555Dim type As ITypeSymbol = boundTupleExpression.Type 1563Dim type As ITypeSymbol = boundInterpolatedString.Type 1600Dim type As ITypeSymbol = boundAnonymousTypeCreationExpression.Type 1614Dim type As ITypeSymbol = boundAnonymousTypePropertyAccess.Type 1633Dim type As ITypeSymbol = boundQueryExpression.Type 1650Dim type As ITypeSymbol = boundAggregateClause.Type 1657Dim type As ITypeSymbol = boundNullableIsTrueOperator.Type
Operations\VisualBasicOperationFactory_Methods.vb (2)
91Dim type As ITypeSymbol = boundAssignment.Type 349Dim type As ITypeSymbol = target.Type
SymbolDisplay\SymbolDisplayVisitor.Members.vb (1)
294Dim containingType As ITypeSymbol
SymbolDisplay\SymbolDisplayVisitor.Types.vb (2)
29Dim underlyingNonArrayType As ITypeSymbol = symbol.ElementType 481Private Sub AddTypeArguments(typeArguments As ImmutableArray(Of ITypeSymbol),
SymbolDisplay\SymbolDisplayVisitor.vb (1)
313DirectCast(vbRangeVariable.Type, ITypeSymbol).Accept(Me)
SymbolDisplay\SymbolDisplayVisitor_Constants.vb (1)
39Private Sub AddConstantValue(type As ITypeSymbol, constantValue As Object, Optional preferNumericValueOrExpandedFlagsForEnum As Boolean = False)
Symbols\ArrayTypeSymbol.vb (1)
400Private ReadOnly Property IArrayTypeSymbol_ElementType As ITypeSymbol Implements IArrayTypeSymbol.ElementType
Symbols\EventSymbol.vb (1)
278Private ReadOnly Property IEventSymbol_Type As ITypeSymbol Implements IEventSymbol.Type
Symbols\FieldSymbol.vb (1)
470Private ReadOnly Property IFieldSymbol_Type As ITypeSymbol Implements IFieldSymbol.Type
Symbols\MethodSymbol.vb (8)
941Private ReadOnly Property IMethodSymbol_ReceiverType As ITypeSymbol Implements IMethodSymbol.ReceiverType 953Private Function IMethodSymbol_GetTypeInferredDuringReduction(reducedFromTypeParameter As ITypeParameterSymbol) As ITypeSymbol Implements IMethodSymbol.GetTypeInferredDuringReduction 963Private Function IMethodSymbol_ReduceExtensionMethod(receiverType As ITypeSymbol) As IMethodSymbol Implements IMethodSymbol.ReduceExtensionMethod 1056Private ReadOnly Property IMethodSymbol_ReturnType As ITypeSymbol Implements IMethodSymbol.ReturnType 1080Private ReadOnly Property IMethodSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements IMethodSymbol.TypeArguments 1082Return StaticCast(Of ITypeSymbol).From(Me.TypeArguments) 1138Private Function IMethodSymbol_Construct(ParamArray typeArguments() As ITypeSymbol) As IMethodSymbol Implements IMethodSymbol.Construct 1146Private Function IMethodSymbol_Construct(typeArguments As ImmutableArray(Of ITypeSymbol), typeArgumentNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As IMethodSymbol Implements IMethodSymbol.Construct
Symbols\NamedTypeSymbol.vb (4)
1375Private ReadOnly Property INamedTypeSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TypeArguments 1377Return StaticCast(Of ITypeSymbol).From(Me.TypeArgumentsNoUseSiteDiagnostics) 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
Symbols\ParameterSymbol.vb (1)
318Private ReadOnly Property IParameterSymbol_Type As ITypeSymbol Implements IParameterSymbol.Type
Symbols\PropertySymbol.vb (1)
598Private ReadOnly Property IPropertySymbol_Type As ITypeSymbol Implements IPropertySymbol.Type
Symbols\Source\LocalSymbol.vb (1)
395Private ReadOnly Property ILocalSymbol_Type As ITypeSymbol Implements ILocalSymbol.Type
Symbols\Symbol.vb (2)
1352Protected Shared Function ConstructTypeArguments(ParamArray typeArguments() As ITypeSymbol) As ImmutableArray(Of TypeSymbol) 1360Protected Shared Function ConstructTypeArguments(typeArguments As ImmutableArray(Of ITypeSymbol), typeArgumentNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As ImmutableArray(Of TypeSymbol)
Symbols\TypeParameterSymbol.vb (2)
393Private ReadOnly Property ITypeParameterSymbol_ConstraintTypes As ImmutableArray(Of ITypeSymbol) Implements ITypeParameterSymbol.ConstraintTypes 395Return StaticCast(Of ITypeSymbol).From(Me.ConstraintTypesNoUseSiteDiagnostics)
Symbols\TypeSymbol.vb (25)
239Public MustOverride ReadOnly Property IsReferenceType As Boolean Implements ITypeSymbol.IsReferenceType, ITypeSymbolInternal.IsReferenceType 246Public MustOverride ReadOnly Property IsValueType As Boolean Implements ITypeSymbol.IsValueType, ITypeSymbolInternal.IsValueType 251Public Overridable ReadOnly Property IsAnonymousType As Boolean Implements ITypeSymbol.IsAnonymousType 287Public ReadOnly Property SpecialType As SpecialType Implements ITypeSymbol.SpecialType, ITypeSymbolInternal.SpecialType 539Private Function ITypeSymbol_FindImplementationForInterfaceMember(interfaceMember As ISymbol) As ISymbol Implements ITypeSymbol.FindImplementationForInterfaceMember 545Private ReadOnly Property ITypeSymbol_AllInterfaces As ImmutableArray(Of INamedTypeSymbol) Implements ITypeSymbol.AllInterfaces 551Private ReadOnly Property ITypeSymbol_BaseType As INamedTypeSymbol Implements ITypeSymbol.BaseType 557Private ReadOnly Property ITypeSymbol_Interfaces As ImmutableArray(Of INamedTypeSymbol) Implements ITypeSymbol.Interfaces 563Private ReadOnly Property ITypeSymbol_OriginalDefinition As ITypeSymbol Implements ITypeSymbol.OriginalDefinition 569Private ReadOnly Property ITypeSymbol_IsTupleSymbol As Boolean Implements ITypeSymbol.IsTupleType 575Private ReadOnly Property ITypeSymbol_IsNativeIntegerType As Boolean Implements ITypeSymbol.IsNativeIntegerType 581Private ReadOnly Property ITypeSymbol_TypeKind As TypeKind Implements ITypeSymbol.TypeKind, ITypeSymbolInternal.TypeKind 587Private ReadOnly Property ITypeSymbol_IsRefLikeType As Boolean Implements ITypeSymbol.IsRefLikeType 594Private ReadOnly Property ITypeSymbol_IsUnmanagedType As Boolean Implements ITypeSymbol.IsUnmanagedType 600Private ReadOnly Property ITypeSymbol_IsReadOnly As Boolean Implements ITypeSymbol.IsReadOnly 607Private ReadOnly Property ITypeSymbol_IsRecord As Boolean Implements ITypeSymbol.IsRecord 614Private Function ITypeSymbol_ToDisplayString(topLevelNullability As NullableFlowState, Optional format As SymbolDisplayFormat = Nothing) As String Implements ITypeSymbol.ToDisplayString 618Private Function ITypeSymbol_ToDisplayParts(topLevelNullability As NullableFlowState, Optional format As SymbolDisplayFormat = Nothing) As ImmutableArray(Of SymbolDisplayPart) Implements ITypeSymbol.ToDisplayParts 622Private Function ITypeSymbol_ToMinimalDisplayString(semanticModel As SemanticModel, topLevelNullability As NullableFlowState, position As Integer, Optional format As SymbolDisplayFormat = Nothing) As String Implements ITypeSymbol.ToMinimalDisplayString 626Private Function ITypeSymbol_ToMinimalDisplayParts(semanticModel As SemanticModel, topLevelNullability As NullableFlowState, position As Integer, Optional format As SymbolDisplayFormat = Nothing) As ImmutableArray(Of SymbolDisplayPart) Implements ITypeSymbol.ToMinimalDisplayParts 772Private ReadOnly Property ITypeSymbol_NullableAnnotation As NullableAnnotation Implements ITypeSymbol.NullableAnnotation 778Private Function ITypeSymbol_WithNullability(nullableAnnotation As NullableAnnotation) As ITypeSymbol Implements ITypeSymbol.WithNullableAnnotation 782Private Function ITypeSymbolInternal_GetITypeSymbol() As ITypeSymbol Implements ITypeSymbolInternal.GetITypeSymbol
Symbols\WellKnownMembers.vb (1)
354Friend Overrides Function IsAttributeType(type As ITypeSymbol) As Boolean
VisualBasicExtensions.vb (4)
772Public Function ClassifyConversion(compilation As Compilation, source As ITypeSymbol, destination As ITypeSymbol) As Conversion 807Public Function ClassifyConversion(semanticModel As SemanticModel, expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion 825Public Function ClassifyConversion(semanticModel As SemanticModel, position As Integer, expression As ExpressionSyntax, destination As ITypeSymbol) As Conversion
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (30)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ArgumentSyntaxExtensions.vb (1)
16cancellationToken As CancellationToken) As ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (4)
105cancellationToken As CancellationToken) As ITypeSymbol 115Dim returnType As ITypeSymbol = Nothing 144<Out> ByRef returnType As ITypeSymbol) As Boolean 174cancellationToken As CancellationToken) As ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (4)
17cancellationToken As CancellationToken) As IList(Of ITypeSymbol) 22Return results.OfType(Of ITypeSymbol)().ToList() 26Return SpecializedCollections.EmptyList(Of ITypeSymbol)() 203Dim returnType As ITypeSymbol = Nothing
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (2)
29Public Function Type(variableDeclarator As VariableDeclaratorSyntax, semanticModel As SemanticModel) As ITypeSymbol 33Return TryCast(semanticModel.GetSymbolInfo(asNewType).Symbol, ITypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\CastAnalyzer.vb (11)
33Private Function CastPassedToParamArrayDefinitelyCantBeRemoved(castType As ITypeSymbol) As Boolean 57Private Shared Function GetOuterCastType(expression As ExpressionSyntax, expressionTypeInfo As TypeInfo, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ITypeSymbol 122Private Shared Function GetSpeculatedExpressionToOuterTypeConversion(speculationAnalyzer As SpeculationAnalyzer, speculatedExpression As ExpressionSyntax, outerSpeculatedExpression As ExpressionSyntax, cancellationToken As CancellationToken, <Out> ByRef speculatedExpressionOuterType As ITypeSymbol) As Conversion 142Private Shared Function AsTypeInVariableDeclarator(node As SyntaxNode, semanticModel As SemanticModel) As ITypeSymbol 206Dim castExpressionType As ITypeSymbol 253Dim speculatedExpressionOuterType As ITypeSymbol = Nothing 319DirectCast(castExpressionType.OriginalDefinition, ITypeSymbol).SpecialType = SpecialType.System_Nullable_T 374Private Shared Function IsRequiredWideningNumericConversion(sourceType As ITypeSymbol, destinationType As ITypeSymbol) As Boolean 394Private Shared Function CastRemovalChangesDefaultValue(castType As ITypeSymbol, outerType As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (8)
547Protected Overrides Function ConversionsAreCompatible(originalExpression As ExpressionSyntax, originalTargetType As ITypeSymbol, newExpression As ExpressionSyntax, newTargetType As ITypeSymbol) As Boolean 600ByRef elementType As ITypeSymbol, 608Protected Overrides Function IsReferenceConversion(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean 612Protected Overrides Function ClassifyConversion(model As SemanticModel, expression As ExpressionSyntax, targetType As ITypeSymbol) As Conversion 616Protected Overrides Function ClassifyConversion(model As SemanticModel, originalType As ITypeSymbol, targetType As ITypeSymbol) As Conversion
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (53)
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\ArgumentFixer.vb (1)
17Protected Overrides Function GenerateNewArgument(oldArgument As ArgumentSyntax, conversionType As ITypeSymbol) As ArgumentSyntax
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\VisualBasicAddExplicitCastCodeFixProvider.vb (5)
52Protected Overrides Function Cast(expression As ExpressionSyntax, type As ITypeSymbol) As ExpressionSyntax 62candidates As ArrayBuilder(Of (node As ExpressionSyntax, type As ITypeSymbol)), 171cancellationToken As CancellationToken) As ImmutableArray(Of (ExpressionSyntax, ITypeSymbol)) 177Dim mutablePotentialConversionTypes = ArrayBuilder(Of (ExpressionSyntax, ITypeSymbol)).GetInstance() 185Dim conversionType As ITypeSymbol = Nothing
src\Analyzers\VisualBasic\CodeFixes\AddParameter\VisualBasicAddParameterCodeFixProvider.vb (1)
52Protected Overrides Function GetArgumentType(argumentNode As SyntaxNode, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ITypeSymbol
src\Analyzers\VisualBasic\CodeFixes\AliasAmbiguousType\VisualBasicAliasAmbiguousTypeCodeFixProvider.vb (1)
27Protected Overrides Function GetTextPreviewOfChange(aliasName As String, typeSymbol As ITypeSymbol) As String
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (3)
47cancellationToken As CancellationToken) As ITypeSymbol 165Protected Overrides Function IsConversionImplicit(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (1)
162Protected Overrides Function DetermineReturnTypeForSimpleNameOrMemberAccessExpression(typeInferenceService As ITypeInferenceService, semanticModel As SemanticModel, expression As ExpressionSyntax, cancellationToken As CancellationToken) As ITypeSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateParameterizedMemberService.vb (8)
41Protected Overrides Function DetermineReturnTypeWorker(cancellationToken As CancellationToken) As ITypeSymbol 137Protected Overrides Function DetermineParameterTypes(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeSymbol) 140ImmutableArray(Of ITypeSymbol).Empty) 154cancellationToken As CancellationToken) As ITypeSymbol 162Protected Overrides Function IsImplicitReferenceConversion(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean 167Protected Overrides Function DetermineTypeArguments(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeSymbol) 168Dim Result = ArrayBuilder(Of ITypeSymbol).GetInstance()
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
56Protected Overrides Function IsAsyncReturnType(type As ITypeSymbol, knownTypes As KnownTaskTypes) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (12)
31If Not TypeOf typedConstant.Value Is ITypeSymbol Then 35Return SyntaxFactory.GetTypeExpression(DirectCast(typedConstant.Value, ITypeSymbol).GenerateTypeSyntax()) 42Friend Function GenerateExpression(generator As SyntaxGenerator, type As ITypeSymbol, value As Object, canUseFieldReference As Boolean) As ExpressionSyntax 58Friend Function GenerateNonEnumValueExpression(type As ITypeSymbol, value As Object, canUseFieldReference As Boolean) As ExpressionSyntax 109Private Function GenerateStringLiteralExpression(type As ITypeSymbol, value As String) As ExpressionSyntax 162type As ITypeSymbol, 178type As ITypeSymbol, 225Private Sub DetermineSuffix(type As ITypeSymbol, 275Private Function GenerateDoubleLiteralExpression(type As ITypeSymbol, 300type As ITypeSymbol, 325type As ITypeSymbol, 373Private Function GenerateDecimalLiteralExpression(type As ITypeSymbol, value As Decimal, canUseFieldReference As Boolean) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamespaceGenerator.vb (2)
128If TypeOf symbol Is ITypeSymbol Then 129Return TryCast(DirectCast(symbol, ITypeSymbol).GenerateTypeSyntax(), NameSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
663Private Shared Function UpdateSimpleAsClause(asClause As SimpleAsClauseSyntax, newType As ITypeSymbol) As SimpleAsClauseSyntax 671Private Shared Function UpdateAsClause(asClause As AsClauseSyntax, newType As ITypeSymbol) As AsClauseSyntax 696Public Overrides Function UpdateDeclarationType(Of TDeclarationNode As SyntaxNode)(declaration As TDeclarationNode, newType As ITypeSymbol, options As VisualBasicCodeGenerationContextInfo, cancellationToken As CancellationToken) As TDeclarationNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (2)
326Dim objectCreationType = TryCast(symbolInfo.Symbol, ITypeSymbol) 803Return target.IsType AndAlso DirectCast(target, ITypeSymbol).TypeKind = TypeKind.Enum
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContextExtensions.vb (1)
123Dim objectCreationType = TryCast(symbolInfo.Symbol, ITypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (2)
89targetType As ITypeSymbol, 128targetType As ITypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ITypeSymbolExtensions.vb (3)
14Public Function GenerateExpressionSyntax(typeSymbol As ITypeSymbol) As ExpressionSyntax 59Public Function GetTypeFromPredefinedCastKeyword(compilation As Compilation, castKeyword As SyntaxKind) As ITypeSymbol 102Public Function IsIntrinsicType(this As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\StringExtensions.vb (2)
47Dim typeSymbol = TryCast(symbol, ITypeSymbol) 95Private Function IsPredefinedType(type As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
134Public Function ClassifyConversion(semanticModel As SemanticModel, expression As SyntaxNode, destination As ITypeSymbol) As CommonConversion Implements ISemanticFactsService.ClassifyConversion
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (1)
151Public Overrides Function Type(typeSymbol As ITypeSymbol, typeContext As Boolean) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (3)
22Protected Overrides Function IsUnusableType(otherSideType As ITypeSymbol) As Boolean 959lambda As LambdaExpressionSyntax) As ITypeSymbol 982parameterName As String, node As SyntaxNode) As ITypeSymbol
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (25)
CodeGen\CodeGenTuples.vb (25)
7218Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7223Assert.Throws(Of ArgumentException)(Sub() comp.CreateTupleTypeSymbol(elementTypes:=ImmutableArray(Of ITypeSymbol).Empty, elementNames:=Nothing)) 7244Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7245Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7267Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7268Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7290Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7291Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7308Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7309Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7326Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7342Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7343Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7363Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7364Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7384Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7385Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7405Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7406Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7432Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7449Dim intType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_Int32) 7481Dim stringType As ITypeSymbol = comp.GetSpecialType(SpecialType.System_String) 7510Dim tuple3 = DirectCast(comp.CreateTupleTypeSymbol(ImmutableArray.Create(Of ITypeSymbol)(intType, intType, intType, intType, intType, intType, intType, stringType, stringType), 7727Private Shared Function TypeEquals(a As ITypeSymbol, b As ITypeSymbol, compareKind As TypeCompareKind) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Features (72)
AddImport\VisualBasicAddImportFeatureService.vb (4)
221Protected Overrides Function GetDeconstructInfo(semanticModel As SemanticModel, node As SyntaxNode, cancellationToken As CancellationToken) As ITypeSymbol 228cancellationToken As CancellationToken) As ITypeSymbol 258Dim type As ITypeSymbol 331Dim leftExpressionType As ITypeSymbol
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
132If typeSymbol IsNot Nothing AndAlso typeSymbol.IsKind(SymbolKind.NamedType) AndAlso DirectCast(typeSymbol, ITypeSymbol).TypeKind = TypeKind.Delegate Then
CodeRefactorings\InlineMethod\VisualBasicInlineMethodRefactoringProvider.vb (2)
49Protected Overrides Function GenerateTypeSyntax(symbol As ITypeSymbol, allowVar As Boolean) As SyntaxNode 53Protected Overrides Function GenerateLiteralExpression(typeSymbol As ITypeSymbol, value As Object) As ExpressionSyntax
Completion\CompletionProviders\AwaitCompletionProvider.vb (2)
53Protected Overrides Function GetTypeSymbolOfExpression(semanticModel As SemanticModel, potentialAwaitableExpression As SyntaxNode, cancellationToken As CancellationToken) As ITypeSymbol 60Return If(TypeOf symbol Is ITypeSymbol, Nothing, semanticModel.GetTypeInfo(memberAccessExpression, cancellationToken).Type)
Completion\CompletionProviders\CompletionListTagCompletionProvider.vb (2)
71Private Shared Function GetCompletionListType(inferredType As ITypeSymbol, within As INamedTypeSymbol, compilation As Compilation, cancellationToken As CancellationToken) As ITypeSymbol
Completion\CompletionProviders\EnumCompletionProvider.vb (1)
90Private Shared Function GetTypeFromSymbol(symbol As ISymbol) As ITypeSymbol
Completion\CompletionProviders\HandlesClauseCompletionProvider.vb (2)
82Dim containingType = TryCast(containingSymbol, ITypeSymbol) 106Dim containingType = TryCast(containingSymbol, ITypeSymbol)
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (1)
186Private Function interfaceMemberGetter([interface] As ITypeSymbol, within As ISymbol) As ImmutableArray(Of ISymbol)
Completion\CompletionProviders\ObjectInitializerCompletionProvider.vb (2)
58cancellationToken As CancellationToken) As Tuple(Of ITypeSymbol, Location) 95Dim symbol = TryCast(symbolInfo.Symbol, ITypeSymbol)
Completion\CompletionProviders\OverrideCompletionProvider.vb (2)
149ByRef returnType As ITypeSymbol, ByRef nextToken As SyntaxToken) As Boolean 157returnType As ITypeSymbol) As ImmutableArray(Of ISymbol)
Completion\CompletionProviders\SymbolCompletionProvider.vb (1)
122Return If(TryCast(s, ITypeSymbol)?.IsIntrinsicType(), False)
Completion\KeywordRecommenders\Expressions\FromKeywordRecommender.vb (1)
32Dim type = TryCast(context.SemanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol, ITypeSymbol)
ConvertForToForEach\VisualBasicConvertForToForEachCodeRefactoringProvider.vb (1)
81foreachIdentifier As SyntaxToken, collectionExpression As ExpressionSyntax, iterationVariableType As ITypeSymbol) As SyntaxNode
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.Analyzer.vb (1)
34Public Overrides Function CanImplicitlyConvert(semanticModel As SemanticModel, syntax As SyntaxNode, targetType As ITypeSymbol) As Boolean
ExtractMethod\Extensions.vb (2)
468Public Function IsErrorType(type As ITypeSymbol) As Boolean 473Public Function IsObjectType(type As ITypeSymbol) As Boolean
ExtractMethod\VisualBasicMethodExtractor.Analyzer.vb (2)
31type As ITypeSymbol, style As VariableStyle, requiresDeclarationExpressionRewrite As Boolean) As VariableInfo 40Protected Overrides Function GetRangeVariableType(semanticModel As SemanticModel, symbol As IRangeVariableSymbol) As ITypeSymbol
ExtractMethod\VisualBasicMethodExtractor.PostProcessor.vb (5)
34Dim map = New Dictionary(Of ITypeSymbol, List(Of LocalDeclarationStatementSyntax))() 58Private Sub AppendDeclarationStatementToMap(statement As LocalDeclarationStatementSyntax, map As Dictionary(Of ITypeSymbol, List(Of LocalDeclarationStatementSyntax))) 64Dim type = TryCast(symbolInfo.Symbol, ITypeSymbol) 70Private Shared Function GetMergedDeclarationStatements(map As Dictionary(Of ITypeSymbol, List(Of LocalDeclarationStatementSyntax))) As IEnumerable(Of LocalDeclarationStatementSyntax) 135Dim type = TryCast(symbolInfo.Symbol, ITypeSymbol)
ExtractMethod\VisualBasicSelectionResult.vb (2)
152Public Overrides Function GetReturnType() As (returnType As ITypeSymbol, returnsByRef As Boolean) 158Private Function GetReturnTypeWorker() As ITypeSymbol
GenerateMember\GenerateVariable\VisualBasicGenerateVariableService.vb (1)
120Protected Overrides Function TryConvertToLocalDeclaration(type As ITypeSymbol, identifierToken As SyntaxToken, semanticModel As SemanticModel, cancellationToken As CancellationToken, ByRef newRoot As SyntaxNode) As Boolean
GenerateType\VisualBasicGenerateTypeService.vb (5)
418Protected Overrides Function DetermineArgumentType(semanticModel As SemanticModel, argument As ArgumentSyntax, cancellationToken As CancellationToken) As ITypeSymbol 422Protected Overrides Function IsConversionImplicit(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean 680cancellationToken As CancellationToken) As ITypeSymbol 690Private Shared Function GenerateProperty(propertyName As SimpleNameSyntax, typeSymbol As ITypeSymbol) As IPropertySymbol
InitializeParameter\InitializeParameterHelpers.vb (2)
39Public Shared Function IsImplicitConversion(compilation As Compilation, source As ITypeSymbol, destination As ITypeSymbol) As Boolean
InitializeParameter\VisualBasicAddParameterCheckCodeRefactoringProvider.vb (2)
44Protected Overrides Function IsImplicitConversion(compilation As Compilation, source As ITypeSymbol, destination As ITypeSymbol) As Boolean
InitializeParameter\VisualBasicInitializeMemberFromParameterCodeRefactoringProvider.vb (2)
40Protected Overrides Function IsImplicitConversion(compilation As Compilation, source As ITypeSymbol, destination As ITypeSymbol) As Boolean
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
313eventType As ITypeSymbol,
SignatureHelp\GenericNameSignatureHelpProvider.Method.vb (1)
28Private Shared Function GetContainingType(method As IMethodSymbol) As ITypeSymbol
SignatureHelp\InvocationExpressionSignatureHelpProvider.ElementAccess.vb (1)
22Dim throughType As ITypeSymbol = Nothing
SignatureHelp\InvocationExpressionSignatureHelpProvider.MemberGroup.vb (1)
19Dim throughType As ITypeSymbol = Nothing
Snippets\VisualBasicSnippetFunctionService.vb (1)
29Protected Overrides Async Function GetEnumSymbolAsync(document As Document, switchExpressionSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ITypeSymbol)
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\ArgumentFixer.vb (1)
17Protected Overrides Function GenerateNewArgument(oldArgument As ArgumentSyntax, conversionType As ITypeSymbol) As ArgumentSyntax
src\Analyzers\VisualBasic\CodeFixes\AddExplicitCast\VisualBasicAddExplicitCastCodeFixProvider.vb (5)
52Protected Overrides Function Cast(expression As ExpressionSyntax, type As ITypeSymbol) As ExpressionSyntax 62candidates As ArrayBuilder(Of (node As ExpressionSyntax, type As ITypeSymbol)), 171cancellationToken As CancellationToken) As ImmutableArray(Of (ExpressionSyntax, ITypeSymbol)) 177Dim mutablePotentialConversionTypes = ArrayBuilder(Of (ExpressionSyntax, ITypeSymbol)).GetInstance() 185Dim conversionType As ITypeSymbol = Nothing
src\Analyzers\VisualBasic\CodeFixes\AddParameter\VisualBasicAddParameterCodeFixProvider.vb (1)
52Protected Overrides Function GetArgumentType(argumentNode As SyntaxNode, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ITypeSymbol
src\Analyzers\VisualBasic\CodeFixes\AliasAmbiguousType\VisualBasicAliasAmbiguousTypeCodeFixProvider.vb (1)
27Protected Overrides Function GetTextPreviewOfChange(aliasName As String, typeSymbol As ITypeSymbol) As String
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (3)
47cancellationToken As CancellationToken) As ITypeSymbol 165Protected Overrides Function IsConversionImplicit(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (1)
162Protected Overrides Function DetermineReturnTypeForSimpleNameOrMemberAccessExpression(typeInferenceService As ITypeInferenceService, semanticModel As SemanticModel, expression As ExpressionSyntax, cancellationToken As CancellationToken) As ITypeSymbol
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateParameterizedMemberService.vb (8)
41Protected Overrides Function DetermineReturnTypeWorker(cancellationToken As CancellationToken) As ITypeSymbol 137Protected Overrides Function DetermineParameterTypes(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeSymbol) 140ImmutableArray(Of ITypeSymbol).Empty) 154cancellationToken As CancellationToken) As ITypeSymbol 162Protected Overrides Function IsImplicitReferenceConversion(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean 167Protected Overrides Function DetermineTypeArguments(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeSymbol) 168Dim Result = ArrayBuilder(Of ITypeSymbol).GetInstance()
src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
56Protected Overrides Function IsAsyncReturnType(type As ITypeSymbol, knownTypes As KnownTaskTypes) As Boolean
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (2)
EditAndContinue\Helpers\EditingTestBase.vb (2)
166If(partialType Is Nothing, Nothing, Function(c As Compilation) CType(c.GetMember(partialType), ITypeSymbol)), 181If(partialType Is Nothing, Nothing, Function(c As Compilation) CType(c.GetMember(partialType), ITypeSymbol)),
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (27)
Compilation\CompilationAPITests.vb (25)
1551ImmutableArray.Create(DirectCast(Nothing, ITypeSymbol)), 1562ImmutableArray.Create(DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol), 1563DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol)), 1575ImmutableArray.Create(DirectCast(Compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol), 1576DirectCast(Compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol)), 1586ImmutableArray.Create(DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol), 1587DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol)), 1607ImmutableArray.Create(DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol), 1608DirectCast(compilation.GetSpecialType(SpecialType.System_Int32), ITypeSymbol)), 1625ImmutableArray.Create(DirectCast(Nothing, ITypeSymbol)), 1634ImmutableArray.Create(Of ITypeSymbol)(compilation.GetSpecialType(SpecialType.System_Int32)), 1648ImmutableArray.Create(Of ITypeSymbol)(compilation.GetSpecialType(SpecialType.System_Int32)), 1663ImmutableArray.Create(Of ITypeSymbol)(compilation.GetSpecialType(SpecialType.System_Int32), compilation.GetSpecialType(SpecialType.System_Boolean)), 1677Dim memberTypes = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)) 1706Dim type = comp.CreateAnonymousTypeSymbol(ImmutableArray(Of ITypeSymbol).Empty, ImmutableArray(Of String).Empty, memberNullableAnnotations:=ImmutableArray(Of CodeAnalysis.NullableAnnotation).Empty) 1715Dim memberTypes = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)) 1729Private Shared Function GetAnonymousTypeNullableAnnotations(type As ITypeSymbol) As ImmutableArray(Of CodeAnalysis.NullableAnnotation) 1942Dim typeArguments = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)) 1944Assert.Throws(Of ArgumentException)(Function() genericType.Construct(New ImmutableArray(Of ITypeSymbol), New ImmutableArray(Of CodeAnalysis.NullableAnnotation))) 1952Assert.Throws(Of ArgumentException)(Function() genericType.Construct(ImmutableArray.Create(Of ITypeSymbol)(Nothing, Nothing), Nothing)) 1960typeArguments = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)) 1974Dim typeArguments = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String)) 1976Assert.Throws(Of ArgumentException)(Function() genericMethod.Construct(New ImmutableArray(Of ITypeSymbol), New ImmutableArray(Of CodeAnalysis.NullableAnnotation))) 1984Assert.Throws(Of ArgumentException)(Function() genericMethod.Construct(ImmutableArray.Create(Of ITypeSymbol)(Nothing, Nothing), Nothing)) 1992typeArguments = ImmutableArray.Create(Of ITypeSymbol)(comp.GetSpecialType(SpecialType.System_Object), comp.GetSpecialType(SpecialType.System_String))
Compilation\SemanticModelAPITests.vb (2)
2944Dim getLocalType = Function(name As String) As ITypeSymbol 2985Dim getLocalType = Function(name As String) As ITypeSymbol
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (6)
SymbolDisplay\SymbolDisplayTests.vb (2)
4748Dim a = DirectCast(comp.GlobalNamespace.GetMembers("A").Single(), ITypeSymbol) 4993Assert.True(DirectCast(description(4).Symbol, ITypeSymbol).IsTupleType)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (2)
1924Private Sub CheckFieldNameAndLocation(model As SemanticModel, type As ITypeSymbol, tree As SyntaxTree, identifierIndex As Integer, fieldName As String, Optional isKey As Boolean = False) 2079Public Function TheOnlyConstructor(type As ITypeSymbol) As MethodSymbol
SymbolsTests\UnmanagedTypeConstraintTests.vb (2)
1057Assert.False(DirectCast(s5T, ITypeSymbol).IsUnmanagedType) 1063Assert.True(DirectCast(mT, ITypeSymbol).IsUnmanagedType)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
CompilationTestUtils.vb (2)
528Public [Type] As ITypeSymbol = Nothing 529Public ConvertedType As ITypeSymbol = Nothing
Microsoft.CodeAnalysis.VisualBasic.Workspaces (81)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (2)
148If TypeOf symbol Is ITypeSymbol AndAlso DirectCast(symbol, ITypeSymbol).TypeKind = TypeKind.Error Then
Classification\SyntaxClassification\NameSyntaxClassifier.vb (1)
138Dim type = TryCast(symbol, ITypeSymbol)
CodeCleanup\AsyncOrIteratorFunctionReturnTypeFixer.vb (1)
150Private Sub GenerateFunctionAsClause(type As ITypeSymbol,
CodeGeneration\VisualBasicSyntaxGenerator.vb (3)
158Private Protected Overrides Function GenerateExpression(type As ITypeSymbol, value As Object, canUseFieldReference As Boolean) As SyntaxNode 166Public Overrides Function DefaultExpression(type As ITypeSymbol) As SyntaxNode 386Private Protected Overrides Function TypeExpression(typeSymbol As ITypeSymbol, refKind As RefKind) As SyntaxNode
Recommendations\VisualBasicRecommendationServiceRunner.vb (5)
69Public Overrides Function TryGetExplicitTypeOfLambdaParameter(lambdaSyntax As SyntaxNode, ordinalInLambda As Integer, <NotNullWhen(True)> ByRef explicitLambdaParameterType As ITypeSymbol) As Boolean 157Dim typeSymbol = DirectCast(s, ITypeSymbol) 275If container Is Nothing OrElse TryCast(container, ITypeSymbol)?.TypeKind = TypeKind.Enum Then 404Dim isInterface = TryCast(typeOrAssemblySymbol, ITypeSymbol)?.TypeKind = TypeKind.Interface 494Dim type = TryCast(symbol, ITypeSymbol)
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (4)
85Dim declaredSymbolType As ITypeSymbol = Nothing 90Dim initializerType As ITypeSymbol 114Dim declaredSymbolType As ITypeSymbol = Nothing 145<Out> ByRef typeSymbol As ITypeSymbol) As Boolean
Simplification\VisualBasicSimplificationService.Expander.vb (2)
47Private Function AddCast(expression As ExpressionSyntax, targetType As ITypeSymbol, oldExpression As ExpressionSyntax) As ExpressionSyntax 63Private Function AddCast(expression As ExpressionSyntax, targetType As ITypeSymbol, semanticModel As SemanticModel) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ArgumentSyntaxExtensions.vb (1)
16cancellationToken As CancellationToken) As ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (4)
105cancellationToken As CancellationToken) As ITypeSymbol 115Dim returnType As ITypeSymbol = Nothing 144<Out> ByRef returnType As ITypeSymbol) As Boolean 174cancellationToken As CancellationToken) As ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (4)
17cancellationToken As CancellationToken) As IList(Of ITypeSymbol) 22Return results.OfType(Of ITypeSymbol)().ToList() 26Return SpecializedCollections.EmptyList(Of ITypeSymbol)() 203Dim returnType As ITypeSymbol = Nothing
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (2)
29Public Function Type(variableDeclarator As VariableDeclaratorSyntax, semanticModel As SemanticModel) As ITypeSymbol 33Return TryCast(semanticModel.GetSymbolInfo(asNewType).Symbol, ITypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\CastAnalyzer.vb (11)
33Private Function CastPassedToParamArrayDefinitelyCantBeRemoved(castType As ITypeSymbol) As Boolean 57Private Shared Function GetOuterCastType(expression As ExpressionSyntax, expressionTypeInfo As TypeInfo, semanticModel As SemanticModel, cancellationToken As CancellationToken) As ITypeSymbol 122Private Shared Function GetSpeculatedExpressionToOuterTypeConversion(speculationAnalyzer As SpeculationAnalyzer, speculatedExpression As ExpressionSyntax, outerSpeculatedExpression As ExpressionSyntax, cancellationToken As CancellationToken, <Out> ByRef speculatedExpressionOuterType As ITypeSymbol) As Conversion 142Private Shared Function AsTypeInVariableDeclarator(node As SyntaxNode, semanticModel As SemanticModel) As ITypeSymbol 206Dim castExpressionType As ITypeSymbol 253Dim speculatedExpressionOuterType As ITypeSymbol = Nothing 319DirectCast(castExpressionType.OriginalDefinition, ITypeSymbol).SpecialType = SpecialType.System_Nullable_T 374Private Shared Function IsRequiredWideningNumericConversion(sourceType As ITypeSymbol, destinationType As ITypeSymbol) As Boolean 394Private Shared Function CastRemovalChangesDefaultValue(castType As ITypeSymbol, outerType As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (8)
547Protected Overrides Function ConversionsAreCompatible(originalExpression As ExpressionSyntax, originalTargetType As ITypeSymbol, newExpression As ExpressionSyntax, newTargetType As ITypeSymbol) As Boolean 600ByRef elementType As ITypeSymbol, 608Protected Overrides Function IsReferenceConversion(compilation As Compilation, sourceType As ITypeSymbol, targetType As ITypeSymbol) As Boolean 612Protected Overrides Function ClassifyConversion(model As SemanticModel, expression As ExpressionSyntax, targetType As ITypeSymbol) As Conversion 616Protected Overrides Function ClassifyConversion(model As SemanticModel, originalType As ITypeSymbol, targetType As ITypeSymbol) As Conversion
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (12)
31If Not TypeOf typedConstant.Value Is ITypeSymbol Then 35Return SyntaxFactory.GetTypeExpression(DirectCast(typedConstant.Value, ITypeSymbol).GenerateTypeSyntax()) 42Friend Function GenerateExpression(generator As SyntaxGenerator, type As ITypeSymbol, value As Object, canUseFieldReference As Boolean) As ExpressionSyntax 58Friend Function GenerateNonEnumValueExpression(type As ITypeSymbol, value As Object, canUseFieldReference As Boolean) As ExpressionSyntax 109Private Function GenerateStringLiteralExpression(type As ITypeSymbol, value As String) As ExpressionSyntax 162type As ITypeSymbol, 178type As ITypeSymbol, 225Private Sub DetermineSuffix(type As ITypeSymbol, 275Private Function GenerateDoubleLiteralExpression(type As ITypeSymbol, 300type As ITypeSymbol, 325type As ITypeSymbol, 373Private Function GenerateDecimalLiteralExpression(type As ITypeSymbol, value As Decimal, canUseFieldReference As Boolean) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamespaceGenerator.vb (2)
128If TypeOf symbol Is ITypeSymbol Then 129Return TryCast(DirectCast(symbol, ITypeSymbol).GenerateTypeSyntax(), NameSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
663Private Shared Function UpdateSimpleAsClause(asClause As SimpleAsClauseSyntax, newType As ITypeSymbol) As SimpleAsClauseSyntax 671Private Shared Function UpdateAsClause(asClause As AsClauseSyntax, newType As ITypeSymbol) As AsClauseSyntax 696Public Overrides Function UpdateDeclarationType(Of TDeclarationNode As SyntaxNode)(declaration As TDeclarationNode, newType As ITypeSymbol, options As VisualBasicCodeGenerationContextInfo, cancellationToken As CancellationToken) As TDeclarationNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (2)
326Dim objectCreationType = TryCast(symbolInfo.Symbol, ITypeSymbol) 803Return target.IsType AndAlso DirectCast(target, ITypeSymbol).TypeKind = TypeKind.Enum
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContextExtensions.vb (1)
123Dim objectCreationType = TryCast(symbolInfo.Symbol, ITypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (2)
89targetType As ITypeSymbol, 128targetType As ITypeSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ITypeSymbolExtensions.vb (3)
14Public Function GenerateExpressionSyntax(typeSymbol As ITypeSymbol) As ExpressionSyntax 59Public Function GetTypeFromPredefinedCastKeyword(compilation As Compilation, castKeyword As SyntaxKind) As ITypeSymbol 102Public Function IsIntrinsicType(this As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\StringExtensions.vb (2)
47Dim typeSymbol = TryCast(symbol, ITypeSymbol) 95Private Function IsPredefinedType(type As ITypeSymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
134Public Function ClassifyConversion(semanticModel As SemanticModel, expression As SyntaxNode, destination As ITypeSymbol) As CommonConversion Implements ISemanticFactsService.ClassifyConversion
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (1)
151Public Overrides Function Type(typeSymbol As ITypeSymbol, typeContext As Boolean) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (3)
22Protected Overrides Function IsUnusableType(otherSideType As ITypeSymbol) As Boolean 959lambda As LambdaExpressionSyntax) As ITypeSymbol 982parameterName As String, node As SyntaxNode) As ITypeSymbol
Utilities\IntrinsicOperators\PredefinedCastExpressionDocumentation.vb (1)
9Private ReadOnly _resultingType As ITypeSymbol
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (2)
CodeGeneration\SyntaxGeneratorTests.vb (2)
260VerifySyntax(Of TypeSyntax)(Generator.TupleTypeExpression(New ITypeSymbol() {intType, intType}), "(System.Int32, System.Int32)") 261VerifySyntax(Of TypeSyntax)(Generator.TupleTypeExpression(New ITypeSymbol() {intType, intType}, New String() {"x", "y"}), "(x As System.Int32, y As System.Int32)")
Microsoft.CodeAnalysis.Workspaces (464)
Classification\ClassificationExtensions.cs (1)
9public static string? GetClassification(this ITypeSymbol type)
Classification\SyntaxClassification\AbstractSyntaxClassifier.cs (1)
19protected static string? GetClassificationForType(ITypeSymbol type)
Editing\SymbolEditorExtensions.cs (3)
22ITypeSymbol baseOrInterfaceType, 32baseOrInterfaceType = (ITypeSymbol)(await editor.GetCurrentSymbolAsync(baseOrInterfaceType, cancellationToken).ConfigureAwait(false)); 96ITypeSymbol newBaseType,
Editing\SyntaxGenerator.cs (21)
338private protected abstract SyntaxNode GenerateExpression(ITypeSymbol? type, object? value, bool canUseFieldReference); 1603/// <see langword="true"/> if the language requires a <see cref="TypeExpression(ITypeSymbol)"/> 1605/// <see cref="LocalDeclarationStatement(ITypeSymbol, string, SyntaxNode, bool)"/>. 1628public SyntaxNode LocalDeclarationStatement(ITypeSymbol type, string name, SyntaxNode? initializer = null, bool isConst = false) 1741public SyntaxNode CatchClause(ITypeSymbol type, string identifier, IEnumerable<SyntaxNode> statements) 1780public abstract SyntaxNode DefaultExpression(ITypeSymbol type); 1848public SyntaxNode GenericName(string identifier, IEnumerable<ITypeSymbol> typeArguments) 1860public SyntaxNode GenericName(string identifier, params ITypeSymbol[] typeArguments) 1861=> GenericName(identifier, (IEnumerable<ITypeSymbol>)typeArguments); 1930public SyntaxNode TypeExpression(ITypeSymbol typeSymbol) 1933private protected abstract SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind); 1940public SyntaxNode TypeExpression(ITypeSymbol typeSymbol, bool addImport) 1992public SyntaxNode TupleTypeExpression(IEnumerable<ITypeSymbol> elementTypes, IEnumerable<string>? elementNames = null) 2021public SyntaxNode TupleElementExpression(ITypeSymbol type, string? name = null) 2205public SyntaxNode ObjectCreationExpression(ITypeSymbol type, IEnumerable<SyntaxNode> arguments) 2217public SyntaxNode ObjectCreationExpression(ITypeSymbol type, params SyntaxNode[] arguments) 2272public SyntaxNode IsTypeExpression(SyntaxNode expression, ITypeSymbol type) 2283public SyntaxNode TryCastExpression(SyntaxNode expression, ITypeSymbol type) 2294public SyntaxNode CastExpression(ITypeSymbol type, SyntaxNode expression) 2305public SyntaxNode ConvertExpression(ITypeSymbol type, SyntaxNode expression) 2384public SyntaxNode LambdaParameter(string identifier, ITypeSymbol type)
ExternalAccess\Pythia\Api\PythiaTypeInferenceServiceWrapper.cs (1)
22public ImmutableArray<ITypeSymbol> InferTypes(SemanticModel semanticModel, int position, string? name, CancellationToken cancellationToken)
FindSymbols\Declarations\DeclarationFinder.cs (1)
104if (IsOn(filter, SymbolFilter.Type) && symbol is ITypeSymbol)
FindSymbols\FindReferences\DependentTypeFinder.cs (3)
25/// types based either on <see cref="ITypeSymbol.BaseType"/> or <see cref="ITypeSymbol.Interfaces"/>. 29/// cref="ITypeSymbol"/>'s themselves), walking down is complicated. The general way this works is by using
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (1)
23private static INamedTypeSymbol? GetUnderlyingNamedType(ITypeSymbol symbol)
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (3)
109var convertedType = semanticModel.GetTypeInfo(lambdaNode, cancellationToken).ConvertedType; 133ITypeSymbol convertedType1, 149var convertedType2 = semanticModel.GetTypeInfo(lambdaNode, cancellationToken).ConvertedType;
Recommendations\AbstractRecommendationServiceRunner.cs (24)
44public abstract bool TryGetExplicitTypeOfLambdaParameter(SyntaxNode lambdaSyntax, int ordinalInLambda, [NotNullWhen(returnValue: true)] out ITypeSymbol explicitLambdaParameterType); 96var parameterTypeSymbols = ImmutableArray<ITypeSymbol>.Empty; 98if (TryGetExplicitTypeOfLambdaParameter(lambdaSyntax, parameter.Ordinal, out var explicitLambdaParameterType)) 134private ImmutableArray<ITypeSymbol> SubstituteTypeParameters(ImmutableArray<ITypeSymbol> parameterTypeSymbols, SyntaxNode invocationExpression) 147using var _ = ArrayBuilder<ITypeSymbol>.GetInstance(out var concreteTypes); 153foreach (var parameterTypeSymbol in parameterTypeSymbols) 160var concreteType = typeArguments.ElementAtOrDefault(index); 185private ImmutableArray<ITypeSymbol> GetTypeSymbols( 194using var _ = ArrayBuilder<ITypeSymbol>.GetInstance(out var builder); 200if (!TryGetMatchingParameterTypeForArgument(method, argumentName, ordinalInInvocation, out var type)) 238private bool TryGetMatchingParameterTypeForArgument(IMethodSymbol method, string argumentName, int ordinalInInvocation, out ITypeSymbol parameterType) 378if (unwrapNullable && namespaceOrType is ITypeSymbol typeSymbol) 398if (container is not ITypeSymbol containerType) 427static bool MatchesConstraints(ITypeSymbol originalContainerType, ImmutableArray<ITypeSymbol> constraintTypes) 434foreach (var constraintType in constraintTypes) 443static bool MatchesConstraint(ITypeSymbol originalContainerType, ITypeSymbol originalConstraintType) 461foreach (var constraintType in typeParameterContainer.ConstraintTypes) 486foreach (var constrainedType in typeParameterContainer.ConstraintTypes) 511static bool MatchesAnyBaseTypes(ITypeSymbol source, ITypeSymbol matched) 513for (var current = source; current != null; current = current.BaseType)
Rename\ConflictEngine\DeclarationConflictHelpers.cs (9)
40Func<ISymbol, ImmutableArray<ImmutableArray<ITypeSymbol>>> getAllSignatures) 42var signatureToConflictingMember = new Dictionary<ImmutableArray<ITypeSymbol>, ISymbol>(ConflictingSignatureComparer.Instance); 77private sealed class ConflictingSignatureComparer : IEqualityComparer<ImmutableArray<ITypeSymbol>> 83public bool Equals(ImmutableArray<ITypeSymbol> x, ImmutableArray<ITypeSymbol> y) 86public int GetHashCode(ImmutableArray<ITypeSymbol> obj) 95private static ImmutableArray<ImmutableArray<ITypeSymbol>> GetAllSignatures(ImmutableArray<IParameterSymbol> parameters, bool trimOptionalParameters) 97var resultBuilder = ArrayBuilder<ImmutableArray<ITypeSymbol>>.GetInstance(); 99var signatureBuilder = ArrayBuilder<ITypeSymbol>.GetInstance();
Shared\Extensions\ITypeSymbolExtensions.cs (6)
28this ITypeSymbol typeSymbol, 106for (var currentType = typeSymbol; currentType != null; currentType = currentType.BaseType) 127public static ISymbol? FindImplementations(this ITypeSymbol typeSymbol, ISymbol constructedInterfaceMember, SolutionServices services) 137this ITypeSymbol typeSymbol, 175public static bool CanBeEnumerated(this ITypeSymbol type) 186public static bool CanBeAsynchronouslyEnumerated(this ITypeSymbol type, Compilation compilation)
Shared\Extensions\SemanticModelExtensions.cs (4)
21private static ISymbol? MapSymbol(ISymbol? symbol, ITypeSymbol? type) 53methodSymbol.ContainingType is ITypeSymbol containingType) 86ITypeSymbol? type = null; 87ITypeSymbol? convertedType = null;
Shared\Extensions\TokenSemanticInfo.cs (4)
18ITypeSymbol type, 19ITypeSymbol convertedType, 28public readonly ITypeSymbol Type = type; 29public readonly ITypeSymbol ConvertedType = convertedType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (2)
36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol) 665public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (21)
163=> symbol is ITypeSymbol { TypeKind: TypeKind.Error }; 166=> symbol is ITypeSymbol { TypeKind: TypeKind.Module }; 169=> symbol is ITypeSymbol { TypeKind: TypeKind.Interface }; 175=> symbol is ITypeSymbol { IsTupleType: true }; 244=> symbol is ITypeSymbol { TypeKind: TypeKind.Delegate }; 275public static ITypeSymbol? GetMemberType(this ISymbol? symbol) 387public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol) 395public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol) 397var results = ArrayBuilder<ITypeSymbol>.GetInstance(); 411=> (symbol as ITypeSymbol)?.IsAttribute() == true; 425public static ITypeSymbol ConvertToType( 430if (symbol is ITypeSymbol type) 502public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination) 561public static ITypeSymbol? GetSymbolType(this ISymbol? symbol) 568IAliasSymbol aliasSymbol => aliasSymbol.Target as ITypeSymbol, 569_ => symbol as ITypeSymbol, 580ITypeSymbol? typeSymbol = null; 584typeSymbol = symbol as ITypeSymbol; 613var returnType = getAwaiter.ReturnType; 647var returnType = getEnumerator.ReturnType; 687var returnType = getAsyncEnumerator.ReturnType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (9)
19ITypeSymbol? throughType = null) 41ITypeSymbol? throughType = null) 53ITypeSymbol? throughType = null) 66ITypeSymbol? throughType, 85ITypeSymbol? throughType, 188foreach (var typeArg in type.TypeArguments) 248ITypeSymbol? throughType, 333ITypeSymbol? throughType, 373var originalThroughType = throughType?.OriginalDefinition;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeGenerator.cs (6)
9ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank); 10ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType); 11ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (1)
15private static INamedTypeSymbol? GetNamedTypeSymbol(ITypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (8)
14private sealed class AnonymousTypeRemover(Compilation compilation) : SymbolVisitor<ITypeSymbol> 16public override ITypeSymbol DefaultVisit(ISymbol node) 19public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 22public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 33public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 41public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 53public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 64public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (2)
56foreach (var child in symbol.GetAllTypeArguments()) 85foreach (var constraint in symbol.ConstraintTypes)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CompilationTypeGenerator.cs (6)
13public ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank) 16public ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 19public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (98)
22public static bool IsIntegralType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 25public static bool IsSignedIntegralType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 28public static bool CanAddNullCheck([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 39public static IList<INamedTypeSymbol> GetAllInterfacesIncludingThis(this ITypeSymbol type) 55public static bool IsAbstractClass([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 58public static bool IsSystemVoid([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 61public static bool IsNullable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 64public static bool IsNonNullableValueType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 68[NotNullWhen(true)] this ITypeSymbol? symbol, 69[NotNullWhen(true)] out ITypeSymbol? underlyingType) 81public static bool IsModuleType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 84public static bool IsInterfaceType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 87public static bool IsDelegateType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 90public static bool IsFunctionPointerType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 93public static bool IsStructType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 100this ITypeSymbol type, 114public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol? type) 116var current = type; 124public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol type) 134public static IEnumerable<ITypeSymbol> GetContainingTypesAndThis(this ITypeSymbol? type) 136var current = type; 144public static IEnumerable<INamedTypeSymbol> GetContainingTypes(this ITypeSymbol type) 157this ITypeSymbol type, ITypeSymbol baseType, bool includeInterfaces) 170this ITypeSymbol type, ITypeSymbol baseType) 178this ITypeSymbol type, ITypeSymbol baseType) 180var originalBaseType = baseType.OriginalDefinition; 188IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); 195this ITypeSymbol type, ITypeSymbol baseType) 197var originalBaseType = baseType.OriginalDefinition; 217this ITypeSymbol type, ITypeSymbol interfaceType) 219var originalInterfaceType = interfaceType.OriginalDefinition; 224this ITypeSymbol type, ITypeSymbol interfaceType) 229public static bool IsAttribute(this ITypeSymbol symbol) 247public static bool IsFormattableStringOrIFormattable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 256this ITypeSymbol typeSymbol, bool allowDelegateAndEnumConstraints = false) 284public static bool IsNumericType([NotNullWhen(returnValue: true)] this ITypeSymbol? type) 310public static Accessibility DetermineMinimalAccessibility(this ITypeSymbol typeSymbol) 313public static bool ContainsAnonymousType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 329foreach (var typeArg in type.GetAllTypeArguments()) 338public static string CreateParameterName(this ITypeSymbol type, bool capitalize = false) 359private static string GetParameterName(ITypeSymbol? type) 372public static bool IsSpecialType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol) 403public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within) 414public static INamedTypeSymbol? GetDelegateType(this ITypeSymbol? typeSymbol, Compilation compilation) 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 434public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol 443public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol 453public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol 463public static bool? AreMoreSpecificThan(this IList<ITypeSymbol> t1, IList<ITypeSymbol> t2) 498public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol 508private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol 518private static bool? IsMoreSpecificThan(this ITypeSymbol t1, ITypeSymbol t2) 597public static bool IsOrDerivesFromExceptionType([NotNullWhen(returnValue: true)] this ITypeSymbol? type, Compilation compilation) 604foreach (var baseType in type.GetBaseTypesAndThis()) 615foreach (var constraint in ((ITypeParameterSymbol)type).ConstraintTypes) 630public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type) 633public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type, [NotNullWhen(true)] out INamedTypeSymbol? enumType) 645public static bool? IsMutableValueType(this ITypeSymbol type) 647if (type.IsNullable(out var underlyingType)) 724public static bool IsDisposable([NotNullWhen(returnValue: true)] this ITypeSymbol? type, [NotNullWhen(returnValue: true)] ITypeSymbol? iDisposableType) 729public static ITypeSymbol WithNullableAnnotationFrom(this ITypeSymbol type, ITypeSymbol symbolForNullableAnnotation) 733public static ITypeSymbol? RemoveNullableIfPresent(this ITypeSymbol? symbol) 735if (symbol.IsNullable(out var underlyingType)) 743public static bool IsSpanOrReadOnlySpan([NotNullWhen(true)] this ITypeSymbol? type) 746public static bool IsSpan([NotNullWhen(true)] this ITypeSymbol? type) 762public static bool IsInlineArray([NotNullWhen(true)] this ITypeSymbol? type) 767public static ITypeSymbol? RemoveUnavailableTypeParameters( 768this ITypeSymbol? type, 776private static ITypeSymbol? RemoveUnavailableTypeParameters( 777this ITypeSymbol? type, 785public static ITypeSymbol? RemoveAnonymousTypes( 786this ITypeSymbol? type, 793public static ITypeSymbol? RemoveUnnamedErrorTypes( 794this ITypeSymbol? type, 800this ITypeSymbol? type, IList<ITypeParameterSymbol>? result = null) 808this ITypeSymbol? type, IList<ITypeParameterSymbol>? result = null) 816public static ITypeSymbol? SubstituteTypes<TType1, TType2>( 817this ITypeSymbol? type, 820where TType1 : ITypeSymbol 821where TType2 : ITypeSymbol 827public static ITypeSymbol? SubstituteTypes<TType1, TType2>( 828this ITypeSymbol? type, 831where TType1 : ITypeSymbol 832where TType2 : ITypeSymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
52foreach (var arg in symbol.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (18)
15private sealed class SubstituteTypesVisitor<TType1, TType2> : SymbolVisitor<ITypeSymbol> 16where TType1 : ITypeSymbol 17where TType2 : ITypeSymbol 31public override ITypeSymbol DefaultVisit(ISymbol node) 34private ITypeSymbol VisitType(ITypeSymbol symbol) 44public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 47public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol) 50public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 57public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 59var mapped = VisitType(symbol); 78var updatedContainingType = symbol.ContainingType?.Accept(this); 95public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 97var mapped = VisitType(symbol); 103var elementType = symbol.ElementType.Accept(this); 112public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 114var mapped = VisitType(symbol); 120var pointedAtType = symbol.PointedAtType.Accept(this);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (8)
15private sealed class UnavailableTypeParameterRemover(Compilation compilation, ISet<string> availableTypeParameterNames) : SymbolVisitor<ITypeSymbol> 17public override ITypeSymbol DefaultVisit(ISymbol node) 20public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 23public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 34public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 40public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 51public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 62public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (8)
14private sealed class UnnamedErrorTypeRemover(Compilation compilation) : SymbolVisitor<ITypeSymbol> 16public override ITypeSymbol DefaultVisit(ISymbol node) 19public override ITypeSymbol VisitDynamicType(IDynamicTypeSymbol symbol) 22public override ITypeSymbol VisitArrayType(IArrayTypeSymbol symbol) 33public override ITypeSymbol VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol) 39public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol) 55public override ITypeSymbol VisitPointerType(IPointerTypeSymbol symbol) 66public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (4)
150public static string GenerateNameFromType(this SemanticModel semanticModel, ITypeSymbol type, ISyntaxFacts syntaxFacts, bool capitalize) 181private static bool ShouldPluralize(this SemanticModel semanticModel, ITypeSymbol type) 196ImmutableArray<ITypeSymbol> typeArguments, 231public static ITypeSymbol GetType(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (1)
367SymbolCategory.Type => symbol is ITypeSymbol type && type.TypeKind == (TypeKind)_kind,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (2)
15public readonly ITypeSymbol ElementType; 21ITypeSymbol elementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
118private static bool IsFloatingPoint([NotNullWhen(returnValue: true)] ITypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
41using var propertyTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ArrayTypeSymbolKey.cs (1)
32foreach (var typeSymbol in elementTypeResolution.OfType<ITypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (3)
30using var parameterTypes = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 47var returnTypeSymbol = (ITypeSymbol?)returnType.GetAnySymbol();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (2)
45visitor.WriteSymbolKeyArray(ImmutableArray<ITypeSymbol>.Empty); 73using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
58using var parameterTypes = reader.ReadSymbolKeyArray<IFunctionPointerTypeSymbol, ITypeSymbol>( 78if (returnType.GetAnySymbol() is not ITypeSymbol returnTypeSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (5)
45foreach (var receiverType in receiverTypeResolution.OfType<ITypeSymbol>()) 71using var typeArguments = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 224_ = reader.ReadSymbolKeyArray<IMethodSymbol, ITypeSymbol>( 247var returnType = (ITypeSymbol?)reader.ReadSymbolKey(contextualSymbol: method.ReturnType, out _).GetAnySymbol();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (6)
35visitor.WriteSymbolKeyArray(ImmutableArray<ITypeSymbol>.Empty); 50using var typeArguments = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>( 96ITypeSymbol[] typeArgumentsArray, 146ITypeSymbol[] typeArgumentsArray, 173ITypeSymbol[] typeArguments) 197private static INamedTypeSymbol Construct(INamedTypeSymbol type, bool isUnboundGenericType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PointerTypeSymbolKey.cs (1)
34foreach (var typeSymbol in pointedAtTypeResolution.OfType<ITypeSymbol>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
71_ = reader.ReadSymbolKeyArray<IPropertySymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (2)
383Func<TOwningSymbol, int, ITypeSymbol?> getContextualType, 387using var originalParameterTypes = this.ReadSymbolKeyArray<TOwningSymbol, ITypeSymbol>(owningSymbol, getContextualType, out _);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
98using var elementTypes = reader.ReadSymbolKeyArray<INamedTypeSymbol, ITypeSymbol>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (25)
104protected abstract TConversion ClassifyConversion(SemanticModel model, TExpressionSyntax expression, ITypeSymbol targetType); 105protected abstract TConversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType); 107protected abstract bool ConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType); 108protected abstract bool IsReferenceConversion(Compilation model, ITypeSymbol sourceType, ITypeSymbol targetType); 114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables); 304private bool ImplicitConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType) 740var previousOriginalType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode).Type; 741var previousReplacedType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode).Type; 780GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType, out var originalLocalVariables); 781GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType, out var newLocalVariables); 826var expressionType = this.SpeculativeSemanticModel.GetTypeInfo(newForEachStatementExpression, CancellationToken).ConvertedType; 849var originalThrowExpressionType = this.OriginalSemanticModel.GetTypeInfo(originalThrowExpression).Type; 851var newThrowExpressionType = this.SpeculativeSemanticModel.GetTypeInfo(newThrowExpression).Type; 964var originalTargetType = this.OriginalSemanticModel.GetTypeInfo(originalLeft).Type; 967var newTargetType = this.SpeculativeSemanticModel.GetTypeInfo(newLeft).Type; 1000var newReceiverType = newReceiver != null 1039var receiverType = semanticModel.GetTypeInfo(receiver).Type; 1199ITypeSymbol originalTargetType, 1201ITypeSymbol newTargetType, 1216var originalConvertedTypeSymbol = this.OriginalSemanticModel.GetTypeInfo(originalExpression).ConvertedType; 1222var newConvertedTypeSymbol = this.SpeculativeSemanticModel.GetTypeInfo(newExpression).ConvertedType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (1)
25private IEqualityComparer<ITypeSymbol> SignatureTypeEquivalenceComparer => _symbolEquivalenceComparer.SignatureTypeEquivalenceComparer;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (1)
196=> symbol.IsKind(SymbolKind.NamedType, out ITypeSymbol? typeSymbol) && typeSymbol.SpecialType == SpecialType.System_Object;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
94private bool NullableAnnotationsEquivalent(ITypeSymbol x, ITypeSymbol y) 492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
47return Hash.Combine(GetNullableAnnotationsHashCode((ITypeSymbol)x), Hash.Combine(typeof(IDynamicTypeSymbol), currentHash)); 53private int GetNullableAnnotationsHashCode(ITypeSymbol type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.SignatureTypeSymbolEquivalenceComparer.cs (6)
11internal sealed class SignatureTypeSymbolEquivalenceComparer(SymbolEquivalenceComparer symbolEquivalenceComparer) : IEqualityComparer<ITypeSymbol?> 13public bool Equals(ITypeSymbol? x, ITypeSymbol? y) 16public bool Equals(ITypeSymbol? x, ITypeSymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies) 19public int GetHashCode(ITypeSymbol? x)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (2)
113public TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 140public abstract TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType) 133public static bool TypesMatch(ITypeSymbol? type, object value)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (18)
35DeclarationModifiers modifiers, ITypeSymbol type, 52ITypeSymbol type, 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 110ITypeSymbol type, string name, 156ITypeSymbol? returnType, 178ITypeSymbol? returnType, 199ITypeSymbol returnType, 224ITypeSymbol toType, 252ITypeSymbol toType, 268public static IParameterSymbol CreateParameterSymbol(ITypeSymbol type, string name) 271public static IParameterSymbol CreateParameterSymbol(RefKind refKind, ITypeSymbol type, string name) 281ImmutableArray<AttributeData> attributes, RefKind refKind, bool isParams, ITypeSymbol type, string name, bool isOptional = false, bool hasDefaultValue = false, object? defaultValue = null) 294ITypeSymbol? type = null, 335ImmutableArray<ITypeSymbol> constraintTypes, 351public static IPointerTypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 357public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None) 467ITypeSymbol returnType, 524ITypeSymbol? returnType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (1)
119TDeclarationNode UpdateDeclarationType<TDeclarationNode>(TDeclarationNode declaration, ITypeSymbol newType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\NullableSyntaxAnnotation.cs (1)
10/// Annotation placed on <see cref="ITypeSymbol"/>s that the <see cref="SyntaxGenerator"/> converts to a node. This
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (7)
46public abstract ITypeSymbol ReturnType { get; } 47public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; } 55public abstract ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter); 56public abstract IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType); 66public virtual ITypeSymbol ReceiverType => this.ContainingType; 111public IMethodSymbol Construct(params ITypeSymbol[] typeArguments) 114public IMethodSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (3)
58public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments) 69public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations) 89public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (2)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol 12public ITypeSymbol ElementType { get; } = elementType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (6)
14private readonly ImmutableArray<ITypeSymbol> _typeArguments; 18ImmutableArray<ITypeSymbol> typeArguments) 47public override ITypeSymbol ReturnType 56public override ImmutableArray<ITypeSymbol> TypeArguments => _typeArguments; 84public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 87public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (3)
16private readonly ImmutableArray<ITypeSymbol> _typeArguments; 20ImmutableArray<ITypeSymbol> typeArguments, 31public override ImmutableArray<ITypeSymbol> TypeArguments => _typeArguments;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConversionSymbol.cs (1)
22ITypeSymbol toType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationEventSymbol.cs (2)
20ITypeSymbol type, 27public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationFieldSymbol.cs (2)
22ITypeSymbol type, 27public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (6)
21public override ITypeSymbol ReturnType { get; } 32ITypeSymbol returnType, 100public override ImmutableArray<ITypeSymbol> TypeArguments 101=> this.TypeParameters.As<ITypeSymbol>(); 114public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 117public override IMethodSymbol ReduceExtensionMethod(ITypeSymbol receiverType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (2)
127public override ImmutableArray<ITypeSymbol> TypeArguments 131return this.TypeParameters.As<ITypeSymbol>();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationOperatorSymbol.cs (1)
23ITypeSymbol returnType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationParameterSymbol.cs (2)
22ITypeSymbol type, 32public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPointerTypeSymbol.cs (2)
9internal sealed class CodeGenerationPointerTypeSymbol(ITypeSymbol pointedAtType) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, NullableAnnotation.None), IPointerTypeSymbol 11public ITypeSymbol PointedAtType { get; } = pointedAtType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (2)
22ITypeSymbol type, 31public ITypeSymbol Type { get; } = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (2)
17ImmutableArray<ITypeSymbol> constraintTypes, 27public ImmutableArray<ITypeSymbol> ConstraintTypes { get; internal set; } = constraintTypes;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeSymbol.cs (6)
56public static ImmutableArray<ITypeSymbol> TupleElementTypes => default; 60public new ITypeSymbol OriginalDefinition => this; 80bool ITypeSymbol.IsRefLikeType => throw new System.NotImplementedException(); 82bool ITypeSymbol.IsUnmanagedType => throw new System.NotImplementedException(); 84bool ITypeSymbol.IsReadOnly => Modifiers.IsReadOnly; 90public ITypeSymbol WithNullableAnnotation(NullableAnnotation nullableAnnotation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\TypeGenerator.cs (6)
15public ITypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank) 18public ITypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType) 21public ITypeSymbol Construct(INamedTypeSymbol namedType, ITypeSymbol[] typeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ContextQuery\SyntaxContext.cs (1)
56public ImmutableArray<ITypeSymbol> InferredTypes { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
56var mapping = new Dictionary<ITypeSymbol, ITypeSymbol>(SymbolEqualityComparer.Default); 110var mapping = new Dictionary<ITypeSymbol, ITypeSymbol>(SymbolEqualityComparer.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (7)
15public static ImmutableArray<ITypeSymbol> InferTypes(this ITypeInferenceService service, SemanticModel semanticModel, SyntaxNode expression, CancellationToken cancellationToken) 18public static ImmutableArray<ITypeSymbol> InferTypes(this ITypeInferenceService service, SemanticModel semanticModel, int position, CancellationToken cancellationToken) 47private static INamedTypeSymbol? GetFirstDelegateType(SemanticModel semanticModel, ImmutableArray<ITypeSymbol> types) 53public static ITypeSymbol? InferType( 65public static ITypeSymbol? InferType( 83public static ITypeSymbol? InferType( 95public static ITypeSymbol? InferType(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\KnownTypes.cs (1)
20public bool IsTaskLike(ITypeSymbol returnType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (4)
77ITypeSymbol type) 87private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol) 130var throughMemberType = throughMember.GetMemberType(); 331var parameterType = parameter.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (5)
236var memberType = member.GetSymbolType(); 365public static string? GetLocalName(this ITypeSymbol containingType, string? fallback = "v") 387private static bool ImplementsIEquatable(ITypeSymbol memberType, INamedTypeSymbol iequatableType) 400private static bool ShouldUseEqualityOperator(ITypeSymbol typeSymbol) 404if (typeSymbol.IsNullable(out var underlyingType))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
457var type = variableExpression.Type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (3)
103protected static IMethodSymbol? FindDisposeMethod(Compilation compilation, ITypeSymbol? type, bool isAsync) 128var currentType = type; 144var currentType = type;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\ISemanticFactsService.cs (1)
47CommonConversion ClassifyConversion(SemanticModel semanticModel, SyntaxNode expression, ITypeSymbol destination);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (2)
85/// Produces an appropriate TypeSyntax for the given <see cref="ITypeSymbol"/>. The <paramref name="typeContext"/> 99public abstract SyntaxNode Type(ITypeSymbol typeSymbol, bool typeContext);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (5)
39protected abstract bool IsUnusableType(ITypeSymbol arg); 86protected static IEnumerable<TypeInferenceInfo> CreateResult(ITypeSymbol type) 89protected static IEnumerable<ITypeSymbol> ExpandParamsParameter(IParameterSymbol parameterSymbol) 91var result = new List<ITypeSymbol> 113var elementType = parameters.ElementAtOrDefault(0);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (5)
17private static ImmutableArray<ITypeSymbol> InferTypeBasedOnNameIfEmpty( 18SemanticModel semanticModel, ImmutableArray<ITypeSymbol> result, string nameOpt) 43private static ImmutableArray<ITypeSymbol> InferTypeBasedOnName( 81public ImmutableArray<ITypeSymbol> InferTypes( 93public ImmutableArray<ITypeSymbol> InferTypes(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\ITypeInferenceService.cs (4)
29ImmutableArray<ITypeSymbol> InferTypes(SemanticModel semanticModel, SyntaxNode expression, string nameOpt, CancellationToken cancellationToken); 30ImmutableArray<ITypeSymbol> InferTypes(SemanticModel semanticModel, int position, string nameOpt, CancellationToken cancellationToken); 36internal readonly record struct TypeInferenceInfo(ITypeSymbol InferredType, bool IsParams) 38public TypeInferenceInfo(ITypeSymbol type) : this(type, IsParams: false)
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
FindReferencesTests.cs (1)
516var constraint = comp.GetTypeByMetadataName("C`1").TypeParameters.Single().ConstraintTypes.Single();
SymbolKeyTests.cs (5)
1095var propType = symbol.Type; 1130var propType = symbol.Type; 1177var propType = symbol.Type; 1224var propType = symbol.Type; 1278var symbol = semanticModel.GetTypeInfo(node).Type;
Microsoft.Extensions.Logging.Generators (4)
LoggerMessageGenerator.Parser.cs (4)
355ITypeSymbol paramTypeSymbol = paramSymbol.Type; 627private (string? loggerField, bool multipleLoggerFields) FindLoggerField(SemanticModel sm, TypeDeclarationSyntax classDec, ITypeSymbol loggerSymbol) 726private bool IsBaseOrIdentity(ITypeSymbol source, ITypeSymbol dest)
Microsoft.Extensions.Options.SourceGeneration (43)
OptionsSourceGenContext.cs (1)
45internal static bool IsConvertibleBasicType(ITypeSymbol typeSymbol)
Parser.cs (35)
29private readonly Dictionary<ITypeSymbol, ValidatorType> _synthesizedValidators = new(SymbolEqualityComparer.Default); 30private readonly HashSet<ITypeSymbol> _visitedModelTypes = new(SymbolEqualityComparer.Default); 59var validatorType = sm.GetDeclaredSymbol(syntax) as ITypeSymbol; 80foreach (var modelType in modelTypes) 167private static string GetTypeKeyword(ITypeSymbol type) 210private static bool HasOpenGenerics(ITypeSymbol type, out string genericType) 216foreach (var ta in mt.TypeArguments) 240private ITypeSymbol? GetEnumeratedType(ITypeSymbol type) 266private List<ValidatedMember> GetMembersToValidate(ITypeSymbol modelType, bool speculate, Location lowerLocationInCompilation, ITypeSymbol validatorType) 316private ValidatedMember? GetMemberInfo(ISymbol member, bool speculate, Location location, ITypeSymbol modelType, ITypeSymbol validatorType) 318ITypeSymbol memberType; 410var enumeratedType = GetEnumeratedType(memberType); 565var enumeratedType = GetEnumeratedType(memberType); 598private bool LengthBasedAttributeIsTrackedForSubstitution(ITypeSymbol memberType, Location location, ITypeSymbol attributeType, ref string attributeFullQualifiedName) 619private void TrackCompareAttributeForSubstitution(AttributeData attribute, ITypeSymbol modelType, ref string attributeFullQualifiedName) 630private void TrackRangeAttributeForSubstitution(AttributeData attribute, ITypeSymbol memberType, ref string attributeFullQualifiedName) 633ITypeSymbol? argumentType = null; 636ITypeSymbol typeSymbol = memberType; 684private string? AddSynthesizedValidator(ITypeSymbol modelType, ISymbol member, Location location, ITypeSymbol validatorType) 686var mt = modelType.WithNullableAnnotation(NullableAnnotation.None); 728private bool ConvertTo(ITypeSymbol source, ITypeSymbol dest) 734private bool ModelSelfValidates(ITypeSymbol modelType) 747private List<ITypeSymbol> GetModelTypes(ITypeSymbol validatorType) 749var result = new List<ITypeSymbol>(); 761private bool CanValidate(ITypeSymbol validatorType, ISymbol modelType) 767var t = implementingInterface.TypeArguments.First(); 804private string GetArgumentExpression(ITypeSymbol type, object? value)
ParserUtilities.cs (7)
52internal static bool IsBaseOrIdentity(ITypeSymbol source, ITypeSymbol dest, Compilation comp) 58internal static bool ImplementsInterface(this ITypeSymbol type, ITypeSymbol interfaceType) 71internal static bool TypeHasProperty(ITypeSymbol typeSymbol, string propertyName, SpecialType returnType) 73ITypeSymbol? type = typeSymbol; 107internal static bool IsNullableOfT(this ITypeSymbol type)
Microsoft.Gen.ComplianceReports (6)
Parser.cs (6)
92private static string FormatType(ITypeSymbol typeSymbol) 140private Dictionary<string, ClassifiedItem>? GetClassifiedMembers(ITypeSymbol typeSymbol, Dictionary<string, ClassifiedItem>? classifiedMembers) 157Dictionary<string, ClassifiedItem>? ClassifyMember(Dictionary<string, ClassifiedItem>? classifiedMembers, ISymbol member, ITypeSymbol memberType) 199private List<ClassifiedLogMethod>? GetClassifiedLogMethods(ITypeSymbol typeSymbol) 285private bool DerivesFrom(ITypeSymbol source, ITypeSymbol dest)
Microsoft.Gen.Logging (44)
Parsing\AttributeProcessors.cs (3)
166public static (bool omitReferenceName, ITypeSymbol providerType, string providerMethodName) ExtractTagProviderAttributeValues(AttributeData attr) 169ITypeSymbol? providerType = null; 187providerType = attr.ConstructorArguments[0].Value as ITypeSymbol;
Parsing\Parser.cs (4)
536var paramTypeSymbol = paramSymbol.Type; 564var extractedType = paramTypeSymbol; 620private (string? member, ISymbol? secondMember, bool isNullable) FindLoggerMember(SemanticModel sm, TypeDeclarationSyntax classDec, ITypeSymbol loggerSymbol) 650ITypeSymbol? typeSymbol = ms switch
Parsing\Parser.LogProperties.cs (7)
42var paramTypeSymbol = paramSymbol.Type; 51var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 85ITypeSymbol type, 86ISet<ITypeSymbol> typesChain, 163var current = type; 183var extractedType = property.Type; 334bool CanLogProperties(ISymbol sym, ITypeSymbol symType, SymbolHolder symbols, bool silent = false)
Parsing\Parser.Records.cs (7)
14internal bool RecordHasSensitivePublicMembers(ITypeSymbol type, SymbolHolder symbols) 22var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 29ITypeSymbol Type, 32private static bool RecordHasSensitivePublicMembers(ITypeSymbol type, HashSet<ITypeSymbol> typesChain, SymbolHolder symbols, CancellationToken token) 120var memberType = memberInfo.Type; 126var extractedType = memberType;
Parsing\Parser.TagProvider.cs (9)
26var paramTypeSymbol = paramSymbol.Type; 28(lp.OmitReferenceName, var providerType, var providerMethodName) = AttributeProcessors.ExtractTagProviderAttributeValues(tagProviderAttribute); 54var propTypeSymbol = propSymbol.Type; 56(lp.OmitReferenceName, var providerType, var providerMethodName) = AttributeProcessors.ExtractTagProviderAttributeValues(tagProviderAttribute); 75ITypeSymbol providerType, 77ITypeSymbol tagCollectorType, 78ITypeSymbol complexObjType, 151bool IsAssignableTo(ITypeSymbol type, ITypeSymbol target)
Parsing\TypeSymbolExtensions.cs (9)
12internal static bool IsEnumerable(this ITypeSymbol sym, SymbolHolder symbols) 16internal static bool ImplementsIConvertible(this ITypeSymbol sym, SymbolHolder symbols) 39internal static bool ImplementsIFormattable(this ITypeSymbol sym, SymbolHolder symbols) 63internal static bool ImplementsISpanFormattable(this ITypeSymbol sym, SymbolHolder symbols) 70internal static bool IsSpecialType(this ITypeSymbol typeSymbol, SymbolHolder symbols) 77internal static bool HasCustomToString(this ITypeSymbol type) 79ITypeSymbol? current = type; 93internal static ITypeSymbol GetPossiblyNullWrappedType(this ITypeSymbol sym)
src\Generators\Shared\ParserUtilities.cs (5)
57internal static bool IsBaseOrIdentity(ITypeSymbol source, ITypeSymbol dest, Compilation comp) 63internal static bool ImplementsInterface(this ITypeSymbol type, ITypeSymbol interfaceType) 77internal static bool IsNullableOfT(this ITypeSymbol type)
Microsoft.Gen.Logging.Unit.Tests (5)
LogParserUtilitiesTests.cs (5)
23var typeSymbolMock = new Mock<ITypeSymbol>(); 28var anotherTypeSymbolMock = new Mock<ITypeSymbol>(); 38var typeSymbolMock = new Mock<ITypeSymbol>(); 48var symbolMock = new Mock<ITypeSymbol>(); 152.As<ITypeSymbol>();
Microsoft.Gen.Metrics (15)
Parser.cs (10)
212private static ITypeSymbol? GetGenericType(INamedTypeSymbol symbol) 217private static (InstrumentKind instrumentKind, ITypeSymbol? genericType) GetInstrumentType( 531var paramTypeSymbol = paramSymbol.Type; 572var returnType = methodSymbol.ReturnType; 632var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 677ISet<ITypeSymbol> typesChain, 687ITypeSymbol typeSymbol; 853ISet<ITypeSymbol> typesChain, 894ITypeSymbol symbol, 909var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default);
src\Generators\Shared\ParserUtilities.cs (5)
57internal static bool IsBaseOrIdentity(ITypeSymbol source, ITypeSymbol dest, Compilation comp) 63internal static bool ImplementsInterface(this ITypeSymbol type, ITypeSymbol interfaceType) 77internal static bool IsNullableOfT(this ITypeSymbol type)
Microsoft.Gen.MetricsReports (15)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (10)
212private static ITypeSymbol? GetGenericType(INamedTypeSymbol symbol) 217private static (InstrumentKind instrumentKind, ITypeSymbol? genericType) GetInstrumentType( 531var paramTypeSymbol = paramSymbol.Type; 572var returnType = methodSymbol.ReturnType; 632var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default); 677ISet<ITypeSymbol> typesChain, 687ITypeSymbol typeSymbol; 853ISet<ITypeSymbol> typesChain, 894ITypeSymbol symbol, 909var typesChain = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default);
src\Generators\Shared\ParserUtilities.cs (5)
57internal static bool IsBaseOrIdentity(ITypeSymbol source, ITypeSymbol dest, Compilation comp) 63internal static bool ImplementsInterface(this ITypeSymbol type, ITypeSymbol interfaceType) 77internal static bool IsNullableOfT(this ITypeSymbol type)
Microsoft.Interop.ComInterfaceGenerator (16)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (4)
215public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type.SpecialType == SpecialType.System_String; 216public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) 222public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type is { TypeKind: TypeKind.Array or TypeKind.Delegate } or { SpecialType: SpecialType.System_Array or SpecialType.System_Object }; 223public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) => new TrackedMarshallingInfo(TrackedMarshallingInfoAnnotation.ExplicitlyUnsupported, NoMarshallingInfo.Instance);
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (9)
34List<Func<ITypeSymbol, bool>> sourceGeneratedComRecognizers = new(); 53var methodsOfInterest = new Dictionary<ISymbol, ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>>>(SymbolEqualityComparer.Default); 108if (methodsOfInterest.TryGetValue(operation.TargetMethod.OriginalDefinition, out ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>> discoverers)) 110foreach (Func<IInvocationOperation, (ITypeSymbol, Location)?> discoverer in discoverers) 113if (typeInfo is (ITypeSymbol targetType, Location diagnosticLocation)) 200static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch 206static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeArgumentTypeLookup(int ordinal) => invocation => 208var type = invocation.TargetMethod.TypeArguments[ordinal]; 235static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeOfArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
284static bool IsHResultLikeType(ITypeSymbol type)
VirtualMethodPointerStubGenerator.cs (2)
305ITypeSymbol callConvSymbol = (ITypeSymbol)callConv.Value!;
Microsoft.Interop.JavaScript.JSImportGenerator (10)
FallbackJSMarshallingInfoProvider.cs (2)
16public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => true; 17public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
JSManagedTypeInfo.cs (7)
14public static JSTypeInfo CreateJSTypeInfoForTypeSymbol(ITypeSymbol type) 75case ITypeSymbol when fullTypeName == "global::System.DateTimeOffset": 80case ITypeSymbol when fullTypeName == "global::System.Exception": 95case ITypeSymbol when fullTypeName == "global::System.Runtime.InteropServices.JavaScript.JSObject": 110case IArrayTypeSymbol { IsSZArray: true, ElementType: ITypeSymbol elementType }: 118case ITypeSymbol when fullTypeName == Constants.TaskGlobal: 144case ITypeSymbol when fullTypeName == Constants.ActionGlobal:
JSMarshalAsAttributeInfoParser.cs (1)
22public MarshallingInfo ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
Microsoft.Interop.LibraryImportGenerator (44)
Analyzers\ConvertToLibraryImportFixer.cs (3)
456ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 465ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 591ITypeSymbol? callingConventionType = callingConvention switch
Analyzers\CustomMarshallerAttributeAnalyzer.cs (19)
659ITypeSymbol managedTypeInAttribute = managedTypeOfOp.TypeOperand; 665(entryType, managedType) => managedTypeReporter.CreateAndReportDiagnostic(ManagedTypeMustBeClosedOrMatchArityRule, managedType, entryType), out ITypeSymbol managedType)) 679ITypeSymbol? marshallerTypeInAttribute = marshallerTypeOfOp.TypeOperand; 684out ITypeSymbol 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) 881ITypeSymbol? unmanagedType = null; 947if (TryGetElementTypeFromSpanType(methods.ManagedValuesSource.ReturnType, out ITypeSymbol sourceElementType) 948&& TryGetElementTypeFromSpanType(methods.ManagedValuesDestination.ReturnType, out ITypeSymbol destinationElementType) 956ITypeSymbol expectedUnmanagedCollectionElementType = typeArguments[typeArguments.Length - 1]; 963private void VerifyUnmanagedCollectionElementType(DiagnosticReporter diagnosticReporter, IMethodSymbol? unmanagedValuesCollectionMethod, ITypeSymbol expectedElementType, INamedTypeSymbol expectedSpanType) 966&& TryGetElementTypeFromSpanType(unmanagedValuesCollectionMethod.ReturnType, out ITypeSymbol sourceElementType) 996private bool TryGetElementTypeFromSpanType(ITypeSymbol spanTypeMaybe, [NotNullWhen(true)] out ITypeSymbol? elementType) 1008private void AnalyzeStatefulMarshallerType(DiagnosticReporter diagnosticReporter, ITypeSymbol managedType, MarshalMode mode, INamedTypeSymbol marshallerType, bool isLinearCollectionMarshaller) 1198ITypeSymbol? unmanagedType = null; 1235if (TryGetElementTypeFromSpanType(methods.ManagedValuesSource.ReturnType, out ITypeSymbol sourceElementType) 1236&& TryGetElementTypeFromSpanType(methods.ManagedValuesDestination.ReturnType, out ITypeSymbol destinationElementType) 1244ITypeSymbol expectedUnmanagedCollectionElementType = typeArguments[typeArguments.Length - 1];
Analyzers\CustomMarshallerAttributeFixer.cs (15)
32Dictionary<(INamedTypeSymbol marshallerType, ITypeSymbol managedType, bool isLinearCollectionMarshaller), HashSet<string>> uniqueMarshallersToFix = new(); 40ITypeSymbol? managedType = GetManagedTypeInAttributeSyntax(diagnostic.Location, entryPointTypeSymbol); 161var managedTypeSymbolInAttribute = GetManagedTypeInAttributeSyntax(node.GetLocation(), entryPointTypeSymbol); 167ManualTypeMarshallingHelper.TryResolveManagedType(entryPointTypeSymbol, ManualTypeMarshallingHelper.ReplaceGenericPlaceholderInType(managedTypeSymbolInAttribute, entryPointTypeSymbol, model.Compilation), isLinearCollectionMarshaller, IgnoreArityMismatch, out ITypeSymbol managedType); 181private static ITypeSymbol GetManagedTypeInAttributeSyntax(Location locationInAttribute, INamedTypeSymbol attributedTypeSymbol) 182=> (ITypeSymbol)attributedTypeSymbol.GetAttributes().First(attr => 190ITypeSymbol managedType, 204private static void AddMissingMembersToStatelessMarshaller(DocumentEditor editor, SyntaxNode declaringSyntax, INamedTypeSymbol marshallerType, ITypeSymbol managedType, HashSet<string> missingMemberNames, bool isLinearCollectionMarshaller) 215Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false); 352ITypeSymbol? unmanagedType = null; 385ITypeSymbol CreateManagedElementTypeSymbol() 400private static void AddMissingMembersToStatefulMarshaller(DocumentEditor editor, SyntaxNode declaringSyntax, INamedTypeSymbol marshallerType, ITypeSymbol managedType, HashSet<string> missingMemberNames, bool isLinearCollectionMarshaller) 411Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false); 527ITypeSymbol? unmanagedType = null; 552ITypeSymbol CreateManagedElementTypeSymbol()
Analyzers\NativeMarshallingAttributeAnalyzer.cs (4)
109ITypeSymbol managedType, 141out ITypeSymbol resolvedEntryType)) 165private static ITypeSymbol GetSymbolType(ISymbol symbol) 172ITypeSymbol type => type,
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
65&& ManualTypeMarshallingHelper.TryResolveMarshallerType(containingType, marshallerTypeInAttribute, (_, _) => { }, out ITypeSymbol constructedMarshallerType)
LibraryImportGenerator.cs (1)
133TypeOfExpression(((ITypeSymbol)callConv.Value!).AsTypeSyntax()));
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
284static bool IsHResultLikeType(ITypeSymbol type)
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelStringMarshallingInfoProvider.cs (2)
26public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type.SpecialType == SpecialType.System_String; 28public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
Microsoft.Interop.SourceGeneration (177)
ArrayMarshallingInfoProvider.cs (9)
26public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type is IArrayTypeSymbol { IsSZArray: true }; 28public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) 36ITypeSymbol elementType = ((IArrayTypeSymbol)type).ElementType; 42ITypeSymbol managedType, 43ITypeSymbol elementType, 47ITypeSymbol typeArgumentToInsert = elementType; 49if (elementType is IPointerTypeSymbol { PointedAtType: ITypeSymbol pointedAt }) 72Func<ITypeSymbol, MarshallingInfo> getMarshallingInfoForElement = (ITypeSymbol elementType) => elementMarshallingInfo;
BlittableTypeMarshallingInfoProvider.cs (2)
23public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type is INamedTypeSymbol { IsUnmanagedType: true } unmanagedType 25public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
BooleanMarshallingInfoProvider.cs (2)
16public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type.SpecialType == SpecialType.System_Boolean; 18public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
CharMarshallingInfoProvider.cs (2)
23public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type.SpecialType == SpecialType.System_Char; 25public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
ComInterfaceMarshallingInfoProvider.cs (2)
26public MarshallingInfo? ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) 33ITypeSymbol interfaceType)
CustomMarshallingInfoHelper.cs (7)
14ITypeSymbol type, 65out ITypeSymbol resolvedEntryPointType)) 78Func<ITypeSymbol, MarshallingInfo> getMarshallingInfoForElement = (ITypeSymbol elementType) => getMarshallingInfoCallback(elementType, useSiteAttributeProvider, indirectionDepth + 1); 97out ITypeSymbol resolvedEntryPointType)) 134ITypeSymbol type, 172ITypeSymbol type,
ManagedTypeInfo.cs (1)
40public static ManagedTypeInfo CreateTypeInfoForTypeSymbol(ITypeSymbol type)
ManualTypeMarshallingHelper.cs (41)
89public static bool HasEntryPointMarshallerAttribute(ITypeSymbol entryPointType) 96ITypeSymbol managedType, 105ITypeSymbol managedType, 115ITypeSymbol managedType, 117Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo, 125ITypeSymbol managedType, 127Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo, 136ITypeSymbol managedType, 147ITypeSymbol managedType, 150Func<ITypeSymbol, MarshallingInfo> getMarshallingInfoForElement, 182ITypeSymbol? managedTypeOnAttr = attr.ConstructorArguments[0].Value as ITypeSymbol; 191if (!TryResolveManagedType(entryPointType, ReplaceGenericPlaceholderInType(managedTypeOnAttr, entryPointType, compilation), isLinearCollectionMarshalling, onArityMismatch, out ITypeSymbol managedTypeInst)) 206ITypeSymbol? marshallerTypeOnAttr = attr.ConstructorArguments[2].Value as ITypeSymbol; 210ITypeSymbol marshallerType = marshallerTypeOnAttr; 241public static bool TryResolveEntryPointType(INamedTypeSymbol managedType, ITypeSymbol typeInAttribute, bool isLinearCollectionMarshalling, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? entryPoint) 283public static bool TryResolveManagedType(INamedTypeSymbol entryPointType, ITypeSymbol typeInAttribute, bool isLinearCollectionMarshalling, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? managed) 326public static bool TryResolveMarshallerType(INamedTypeSymbol entryPointType, ITypeSymbol typeInAttribute, Action<INamedTypeSymbol, INamedTypeSymbol> onArityMismatch, [NotNullWhen(true)] out ITypeSymbol? marshallerType) 356public static ITypeSymbol ReplaceGenericPlaceholderInType(ITypeSymbol managedType, INamedTypeSymbol entryType, Compilation compilation) 362Stack<ITypeSymbol> typeStack = new(); 363ITypeSymbol innerType = managedType; 383ITypeSymbol resultType = entryType.TypeArguments[0]; 387ITypeSymbol wrapperType = typeStack.Pop(); 405ITypeSymbol marshallerType, 407ITypeSymbol managedType, 410Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo) 453private static CustomTypeMarshallerData? GetStatelessMarshallerDataForType(ITypeSymbol marshallerType, MarshalMode mode, ITypeSymbol managedType, bool isLinearCollectionMarshaller, Compilation compilation, Func<ITypeSymbol, MarshallingInfo>? getMarshallingInfo) 457ITypeSymbol? collectionElementType = null; 458ITypeSymbol? nativeType = null; 548ITypeSymbol marshallerType, 550ITypeSymbol managedType, 553Func<ITypeSymbol, MarshallingInfo>? getMarshallingInfo) 557ITypeSymbol? nativeType = null; 558ITypeSymbol? collectionElementType = null;
MarshalAsParser.cs (1)
152MarshallingInfo? IMarshallingInfoAttributeParser.ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
MarshalAsWithCustomMarshallersParser.cs (3)
37MarshallingInfo? IMarshallingInfoAttributeParser.ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) 53if (type is not IArrayTypeSymbol { ElementType: ITypeSymbol elementType }) 97ITypeSymbol type,
MarshallerShape.cs (66)
111public static (MarshallerShape, MarshallerMethods) GetShapeForType(ITypeSymbol marshallerType, ITypeSymbol managedType, bool isLinearCollectionMarshaller, Compilation compilation) 204private static IMethodSymbol? GetStatelessFree(ITypeSymbol type) 212private static IMethodSymbol? GetStatelessGetPinnableReference(ITypeSymbol type, ITypeSymbol managedType) 224internal static bool IsSpanOfUnmanagedType(ITypeSymbol typeToCheck, ITypeSymbol spanOfT, ITypeSymbol containingType) 231ITypeSymbol typeArgument = namedType.TypeArguments[0]; 257internal static IMethodSymbol? ConvertToUnmanaged(ITypeSymbol type, ITypeSymbol managedType) 267ITypeSymbol type, 268ITypeSymbol managedType, 269ITypeSymbol spanOfT) 288internal static IMethodSymbol? ConvertToManaged(ITypeSymbol type, ITypeSymbol managedType) 297internal static IMethodSymbol? ConvertToManagedFinally(ITypeSymbol type, ITypeSymbol managedType) 309internal static IMethodSymbol? AllocateContainerForUnmanagedElements(ITypeSymbol type, ITypeSymbol managedType) 320internal static IMethodSymbol? AllocateContainerForUnmanagedElementsWithCallerAllocatedBuffer(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol spanOfT) 341internal static IMethodSymbol? GetManagedValuesSource(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol readOnlySpanOfT) 351internal static IMethodSymbol? GetUnmanagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 361internal static IMethodSymbol? AllocateContainerForManagedElements(ITypeSymbol type, ITypeSymbol managedType) 371internal static IMethodSymbol? AllocateContainerForManagedElementsFinally(ITypeSymbol type, ITypeSymbol managedType) 381internal static IMethodSymbol? GetManagedValuesDestination(ITypeSymbol type, ITypeSymbol managedType, ITypeSymbol spanOfT) 391internal static IMethodSymbol? GetUnmanagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT) 446public static (MarshallerShape shape, MarshallerMethods methods) GetShapeForType(ITypeSymbol marshallerType, ITypeSymbol managedType, bool isLinearCollectionMarshaller, Compilation compilation) 451ITypeSymbol? unmanagedType = null; 561private static IMethodSymbol? GetFromManagedMethod(ITypeSymbol type, ITypeSymbol managedType) 570ITypeSymbol type, 571ITypeSymbol managedType, 572ITypeSymbol spanOfT) 590private static IMethodSymbol? GetToManagedMethod(ITypeSymbol type, ITypeSymbol managedType) 598private static IMethodSymbol? GetToManagedFinallyMethod(ITypeSymbol type, ITypeSymbol managedType) 606private static IMethodSymbol? GetToUnmanagedMethod(ITypeSymbol type) 613public static ImmutableArray<IMethodSymbol> GetFromUnmanagedMethodCandidates(ITypeSymbol type) 621private static IMethodSymbol? GetFromUnmanagedMethod(ITypeSymbol type, ITypeSymbol? unmanagedType) 652private static IMethodSymbol? GetStatefulFreeMethod(ITypeSymbol type) 659private static IMethodSymbol? GetOnInvokedMethod(ITypeSymbol type) 666private static IMethodSymbol? GetStatelessGetPinnableReference(ITypeSymbol type, ITypeSymbol managedType) 675private static IMethodSymbol? GetStatefulGetPinnableReference(ITypeSymbol type) 685internal static IMethodSymbol? GetManagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT) 694internal static IMethodSymbol? GetUnmanagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 703internal static IMethodSymbol? GetManagedValuesDestination(ITypeSymbol type, ITypeSymbol spanOfT) 713internal static IMethodSymbol? GetUnmanagedValuesSource(ITypeSymbol type, ITypeSymbol readOnlySpanOfT)
MarshallingInfoParser.cs (8)
27public delegate MarshallingInfo GetMarshallingInfoCallback(ITypeSymbol type, UseSiteAttributeProvider useSiteAttributes, int indirectionDepth); 72MarshallingInfo? ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback); 85bool CanProvideMarshallingInfoForType(ITypeSymbol type); 94MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback); 213ITypeSymbol managedType, 228ITypeSymbol type, 255private MarshallingInfo? GetMarshallingInfoForAttribute(AttributeData attribute, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback) 269private MarshallingInfo? GetMarshallingInfoForType(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
MarshalUsingAttributeParser.cs (1)
28MarshallingInfo? IMarshallingInfoAttributeParser.ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
NativeMarshallingAttributeParser.cs (1)
22public MarshallingInfo? ParseAttribute(AttributeData attributeData, ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
SafeHandleMarshallingInfoProvider.cs (3)
21public bool CanProvideMarshallingInfoForType(ITypeSymbol type) 30for (ITypeSymbol? currentType = type; currentType is not null; currentType = currentType.BaseType) 41public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
StringMarshallingInfoProvider.cs (2)
28public bool CanProvideMarshallingInfoForType(ITypeSymbol type) => type.SpecialType == SpecialType.System_String; 30public MarshallingInfo GetMarshallingInfo(ITypeSymbol type, int indirectionDepth, UseSiteAttributeProvider useSiteAttributes, GetMarshallingInfoCallback marshallingInfoCallback)
TypeSymbolExtensions.cs (26)
29public static bool IsConsideredBlittable(this ITypeSymbol type) 34return IsBlittableWorker(type, ImmutableHashSet.Create<ITypeSymbol>(SymbolEqualityComparer.Default), compilation: null!, &IsConsideredBlittableWorker); 37static bool IsConsideredBlittableWorker(ITypeSymbol t, ImmutableHashSet<ITypeSymbol> seenTypes, Compilation compilation) 55public static bool IsStrictlyBlittableInContext(this ITypeSymbol type, Compilation compilation) 59return IsBlittableWorker(type, ImmutableHashSet.Create<ITypeSymbol>(SymbolEqualityComparer.Default), compilation, &IsStrictlyBlittableWorker); 62static unsafe bool IsStrictlyBlittableWorker(ITypeSymbol t, ImmutableHashSet<ITypeSymbol> seenTypes, Compilation compilation) 100private static unsafe bool IsBlittableWorker(this ITypeSymbol type, ImmutableHashSet<ITypeSymbol> seenTypes, Compilation compilation, delegate*<ITypeSymbol, ImmutableHashSet<ITypeSymbol>, Compilation, bool> isBlittable) 135private static bool IsAutoLayout(this ITypeSymbol type) 147private static unsafe bool HasOnlyBlittableFields(this ITypeSymbol type, ImmutableHashSet<ITypeSymbol> seenTypes, Compilation compilation, delegate*<ITypeSymbol, ImmutableHashSet<ITypeSymbol>, Compilation, bool> isBlittable) 170public static TypeSyntax AsTypeSyntax(this ITypeSymbol type) 206public static bool IsConstructedFromEqualTypes(this ITypeSymbol type, ITypeSymbol other) 275var arguments = new ITypeSymbol[numArgumentsToInsert]; 291currentType.TypeParameters.CastArray<ITypeSymbol>().CopyTo(currentType.TypeParameters.Length - numArgumentsToPropogate, arguments, numArgumentsToCopy, numArgumentsToPropogate); 305public static (ImmutableArray<ITypeSymbol> TypeArguments, ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations) GetAllTypeArgumentsIncludingInContainingTypes(this INamedTypeSymbol genericType) 309Stack<(ImmutableArray<ITypeSymbol>, ImmutableArray<NullableAnnotation>)> genericTypesToSubstitute = new(); 316ImmutableArray<ITypeSymbol>.Builder typeArguments = ImmutableArray.CreateBuilder<ITypeSymbol>();
Microsoft.ML.InternalCodeAnalyzer (1)
ContractsCheckNameofFixProvider.cs (1)
134var type = semanticModel.GetTypeInfo(argParam.Type, context.CancellationToken).Type;
Microsoft.VisualStudio.LanguageServices (23)
ChangeSignature\AddParameterDialogViewModel.cs (2)
56public ITypeSymbol? TypeSymbol { get; set; } 246private static bool DoesTypeFullyBind(ITypeSymbol? type)
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (2)
89protected void AddTypeLink(ITypeSymbol typeSymbol, LinkFlags flags) 273else if (containingSymbol is ITypeSymbol typeSymbol)
Library\ObjectBrowser\Extensions.cs (1)
48public static string GetTypeNavInfoNameOrEmpty(this ITypeSymbol typeSymbol)
Library\VsNavInfo\NavInfoFactory.cs (3)
45case ITypeSymbol typeSymbol: 73public IVsNavInfo CreateForType(ITypeSymbol typeSymbol, Project project, Compilation compilation, bool useExpandedHierarchy = false) 232private string GetClassName(ITypeSymbol typeSymbol)
Progression\GraphBuilder.cs (1)
498if (symbol is ITypeSymbol typeSymbol && typeSymbol.IsAnonymousType)
Progression\GraphNodeCreation.cs (1)
42return await GraphNodeIdCreation.GetIdForTypeAsync((ITypeSymbol)symbol, solution, cancellationToken).ConfigureAwait(false);
Progression\GraphNodeIdCreation.cs (10)
51internal static async Task<GraphNodeId> GetIdForTypeAsync(ITypeSymbol symbol, Solution solution, CancellationToken cancellationToken) 66private static async Task<IEnumerable<GraphNodeId>> GetPartialsForNamespaceAndTypeAsync(ITypeSymbol symbol, bool includeNamespace, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) 76var underlyingType = ChaseToUnderlyingType(symbol); 121private static async Task<GraphNodeId> GetPartialForTypeAsync(ITypeSymbol symbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) 192foreach (var arg in namedType.TypeArguments) 240var underlyingType = ChaseToUnderlyingType(arrayType); 273private static ITypeSymbol ChaseToUnderlyingType(ITypeSymbol symbol) 377if (symbol is not ITypeSymbol typeSymbol) 382var underlyingType = ChaseToUnderlyingType(typeSymbol);
ProjectSystem\AbstractEntryPointFinder.cs (1)
59var elementType = ((IArrayTypeSymbol)parameter.Type).ElementType;
Venus\ContainedLanguageCodeSupport.cs (2)
103var eventType = ((IEventSymbol)eventMember).Type; 177var eventType = ((IEventSymbol)eventMember).Type;
Microsoft.VisualStudio.LanguageServices.CSharp (23)
CodeModel\CSharpCodeModelService.cs (16)
676var typeSymbol = GetTypeSymbolFromFullName(typeName, compilation); 693public override EnvDTE.vsCMTypeRef GetTypeKindForCodeTypeRef(ITypeSymbol typeSymbol) 766public override string GetAsFullNameForCodeTypeRef(ITypeSymbol typeSymbol) 769public override string GetAsStringForCodeTypeRef(ITypeSymbol typeSymbol) 2715public override SyntaxNode SetType(SyntaxNode node, ITypeSymbol? typeSymbol) 3013protected override ITypeSymbol? GetTypeSymbolFromPartialName(string partialName, SemanticModel semanticModel, int position) 3020public override ITypeSymbol? GetTypeSymbolFromFullName(string fullName, Compilation compilation) 3022ITypeSymbol? typeSymbol = compilation.GetTypeByMetadataName(fullName); 3063public override SyntaxNode CreateReturnDefaultValueStatement(ITypeSymbol type) 3689private static TypeDeclarationSyntax InsertIntoBaseList(TypeDeclarationSyntax typeDeclaration, ITypeSymbol typeSymbol, SemanticModel semanticModel, int insertionIndex) 3707public override bool IsValidBaseType(SyntaxNode node, ITypeSymbol typeSymbol) 3721public override SyntaxNode AddBase(SyntaxNode node, ITypeSymbol typeSymbol, SemanticModel semanticModel, int? position) 3754public override SyntaxNode RemoveBase(SyntaxNode node, ITypeSymbol typeSymbol, SemanticModel semanticModel) 3804public override bool IsValidInterfaceType(SyntaxNode node, ITypeSymbol typeSymbol) 3814public override SyntaxNode AddImplementedInterface(SyntaxNode node, ITypeSymbol typeSymbol, SemanticModel semanticModel, int? position) 3849public override SyntaxNode RemoveImplementedInterface(SyntaxNode node, ITypeSymbol typeSymbol, SemanticModel semanticModel)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
391if (SemanticModel.GetSymbolInfo(objectCreationExpression.Type).Symbol is not ITypeSymbol type) 502GenerateType((ITypeSymbol)leftHandSymbol);
LanguageService\CSharpHelpContextService.cs (2)
541if (symbol is ITypeSymbol type && type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T) 559if (symbol is ITypeSymbol or INamespaceSymbol)
ObjectBrowser\DescriptionBuilder.cs (1)
381foreach (var constraintType in typeParameterSymbol.ConstraintTypes)
Progression\CSharpProgressionLanguageService.cs (2)
98var typeToShow = GetType(symbol); 113private static ITypeSymbol GetType(ISymbol symbol)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (4)
GlyphExtensionsTests.cs (4)
183ITypeSymbol elementType = null, 185ITypeSymbol pointedAtType = null, 200ITypeSymbol elementType = null, 202ITypeSymbol pointedAtType = null,
Microsoft.VisualStudio.LanguageServices.VisualBasic (32)
CodeModel\MethodXML\MethodXmlBuilder.vb (4)
294Dim type = TryCast(SemanticModel.GetSymbolInfo(objectCreationExpression.Type).Symbol, ITypeSymbol) 383GenerateType(DirectCast(leftHandSymbol, ITypeSymbol)) 478Private Function TryGenerateCast(type As ITypeSymbol, expression As ExpressionSyntax, Optional specialCastKind As SpecialCastKind? = Nothing) As Boolean 575Private Function TryGenerateNewArray(arrayBounds As ArgumentListSyntax, initializer As ExpressionSyntax, type As ITypeSymbol) As Boolean
CodeModel\VisualBasicCodeModelService.vb (24)
750Public Overrides Function GetTypeKindForCodeTypeRef(typeSymbol As ITypeSymbol) As EnvDTE.vsCMTypeRef 819Public Overrides Function GetAsFullNameForCodeTypeRef(typeSymbol As ITypeSymbol) As String 823Public Overrides Function GetAsStringForCodeTypeRef(typeSymbol As ITypeSymbol) As String 2973Private Shared Function SetDelegateType(delegateStatement As DelegateStatementSyntax, typeSymbol As ITypeSymbol) As DelegateStatementSyntax 3023Private Shared Function SetEventType(eventStatement As EventStatementSyntax, typeSymbol As ITypeSymbol) As EventStatementSyntax 3056Private Shared Function SetEventType(eventBlock As EventBlockSyntax, typeSymbol As ITypeSymbol) As EventBlockSyntax 3137Private Shared Function SetMethodType(declareStatement As DeclareStatementSyntax, typeSymbol As ITypeSymbol) As DeclareStatementSyntax 3193Private Shared Function SetMethodType(methodStatement As MethodStatementSyntax, typeSymbol As ITypeSymbol) As MethodStatementSyntax 3247Private Shared Function SetMethodType(methodBlock As MethodBlockSyntax, typeSymbol As ITypeSymbol) As MethodBlockSyntax 3276Private Shared Function SetParameterType(parameter As ParameterSyntax, typeSymbol As ITypeSymbol) As ParameterSyntax 3305Private Shared Function SetPropertyType(propertyStatement As PropertyStatementSyntax, typeSymbol As ITypeSymbol) As PropertyStatementSyntax 3334Private Shared Function SetPropertyType(propertyBlock As PropertyBlockSyntax, typeSymbol As ITypeSymbol) As PropertyBlockSyntax 3388Private Shared Function SetVariableType(variableDeclarator As VariableDeclaratorSyntax, typeSymbol As ITypeSymbol) As VariableDeclaratorSyntax 3417Public Overrides Function SetType(node As SyntaxNode, typeSymbol As ITypeSymbol) As SyntaxNode 3627Public Overrides Function GetTypeSymbolFromFullName(fullName As String, compilation As Compilation) As ITypeSymbol 3628Dim typeSymbol As ITypeSymbol = compilation.GetTypeByMetadataName(fullName) 3671Protected Overrides Function GetTypeSymbolFromPartialName(partialName As String, semanticModel As SemanticModel, position As Integer) As ITypeSymbol 3677Public Overrides Function CreateReturnDefaultValueStatement(type As ITypeSymbol) As SyntaxNode 4245Public Overrides Function IsValidBaseType(node As SyntaxNode, typeSymbol As ITypeSymbol) As Boolean 4255Public Overrides Function AddBase(node As SyntaxNode, typeSymbol As ITypeSymbol, semanticModel As SemanticModel, position As Integer?) As SyntaxNode 4281Public Overrides Function RemoveBase(node As SyntaxNode, typeSymbol As ITypeSymbol, semanticModel As SemanticModel) As SyntaxNode 4313Public Overrides Function IsValidInterfaceType(node As SyntaxNode, typeSymbol As ITypeSymbol) As Boolean 4321Public Overrides Function AddImplementedInterface(node As SyntaxNode, typeSymbol As ITypeSymbol, semanticModel As SemanticModel, position As Integer?) As SyntaxNode 4353Public Overrides Function RemoveImplementedInterface(node As SyntaxNode, typeSymbol As ITypeSymbol, semanticModel As SemanticModel) As SyntaxNode
CodeModel\VisualBasicCodeModelService_Prototype.vb (1)
210Private Shared Sub AppendType(builder As StringBuilder, type As ITypeSymbol, flags As PrototypeFlags)
Help\VisualBasicHelpContextService.vb (1)
112If TypeOf symbol Is ITypeSymbol OrElse TypeOf symbol Is INamespaceSymbol Then
Help\VisualBasicHelpContextService.Visitor.vb (2)
454ElseIf TypeOf symbol Is ITypeSymbol AndAlso DirectCast(symbol, ITypeSymbol).SpecialType <> SpecialType.None Then
Mvc.Api.Analyzers.Test (4)
SymbolApiResponseMetadataProviderTest.cs (4)
412var result = SymbolApiResponseMetadataProvider.GetErrorResponseType(symbolCache, method); 430var result = SymbolApiResponseMetadataProvider.GetErrorResponseType(symbolCache, method); 448var result = SymbolApiResponseMetadataProvider.GetErrorResponseType(symbolCache, method); 466var result = SymbolApiResponseMetadataProvider.GetErrorResponseType(symbolCache, method);
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
455if (symbol == null || symbol is ITypeSymbol type && type.SpecialType != SpecialType.None)
System.Text.Json.SourceGeneration (63)
Helpers\KnownTypeSymbols.cs (3)
23public HashSet<ITypeSymbol>? BuiltInSupportTypes { get; set; } 265public bool IsImmutableEnumerableType(ITypeSymbol type, out string? factoryTypeFullName) 318public bool IsImmutableDictionaryType(ITypeSymbol type, out string? factoryTypeFullName)
Helpers\RoslynExtensions.cs (19)
46public static ITypeSymbol EraseCompileTimeMetadata(this Compilation compilation, ITypeSymbol type) 55ITypeSymbol elementType = compilation.EraseCompileTimeMetadata(arrayType.ElementType); 68ImmutableArray<ITypeSymbol> erasedElements = namedType.TupleElements 81ImmutableArray<ITypeSymbol> typeArguments = namedType.TypeArguments; 92ITypeSymbol[] erasedTypeArgs = typeArguments 104public static bool CanUseDefaultConstructorForDeserialization(this ITypeSymbol type, out IMethodSymbol? constructorInfo) 125public static bool IsAssignableFrom(this ITypeSymbol? baseType, ITypeSymbol? type) 151public static INamedTypeSymbol? GetCompatibleGenericBaseType(this ITypeSymbol type, INamedTypeSymbol? baseType) 187public static bool IsGenericTypeDefinition(this ITypeSymbol type) 190public static bool IsNumberType(this ITypeSymbol type) 198public static bool IsNullableType(this ITypeSymbol type) 201public static bool IsNullableValueType(this ITypeSymbol type, [NotNullWhen(true)] out ITypeSymbol? elementType) 213public static ITypeSymbol GetMemberType(this ISymbol member) 229public static INamedTypeSymbol[] GetSortedTypeHierarchy(this ITypeSymbol type) 335private static bool IsOutputTypeNonNullable(this ISymbol symbol, ITypeSymbol returnType) 355private static bool IsInputTypeNonNullable(this ISymbol symbol, ITypeSymbol inputType)
JsonSourceGenerator.Parser.cs (37)
44private readonly HashSet<ITypeSymbol> _builtInSupportTypes; 47private readonly Dictionary<ITypeSymbol, TypeGenerationSpec> _generatedTypes = new(SymbolEqualityComparer.Default); 207private TypeRef EnqueueType(ITypeSymbol type, JsonSourceGenerationMode? generationMode) 313var converterType = (ITypeSymbol?)element.Value; 455var typeSymbol = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value; 503ITypeSymbol type = typeToGenerate.Type; 549else if (type.IsNullableValueType(out ITypeSymbol? underlyingType)) 570out ITypeSymbol? valueType, 571out ITypeSymbol? keyType, 727var derivedType = (ITypeSymbol)attributeData.ConstructorArguments[0].Value!; 741ITypeSymbol type, 742[NotNullWhen(true)] out ITypeSymbol? valueType, 743out ITypeSymbol? keyType, 810ImmutableArray<ITypeSymbol> genericArgs = ((INamedTypeSymbol)type).TypeArguments; 904private TypeRef? GetDictionaryTypeRef(ITypeSymbol keyType, ITypeSymbol valueType) 983ITypeSymbol memberType, 1094private bool IsValidDataExtensionPropertyType(ITypeSymbol type) 1116ITypeSymbol memberType, 1441ITypeSymbol type = typeToGenerate.Type; 1572Debug.Assert(attributeData.ConstructorArguments.Length == 1 && attributeData.ConstructorArguments[0].Value is null or ITypeSymbol); 1573var converterType = (ITypeSymbol?)attributeData.ConstructorArguments[0].Value; 1577private TypeRef? GetConverterTypeFromAttribute(INamedTypeSymbol contextType, ITypeSymbol? converterType, ISymbol declaringSymbol, AttributeData attributeData) 1651private JsonPrimitiveTypeKind? GetPrimitiveTypeKind(ITypeSymbol type) 1684private static string GetTypeInfoPropertyName(ITypeSymbol type) 1704if (namedType.GetAllTypeArgumentsInScope() is List<ITypeSymbol> typeArgsInScope) 1706foreach (ITypeSymbol genericArg in typeArgsInScope) 1716ITypeSymbol type, 1784private bool IsUnsupportedType(ITypeSymbol type) 1795private bool IsBuiltInSupportType(ITypeSymbol type) 1808private static HashSet<ITypeSymbol> CreateBuiltInSupportTypeSet(KnownTypeSymbols knownSymbols) 1811HashSet<ITypeSymbol> builtInSupportTypes = new(SymbolEqualityComparer.Default); 1837void AddTypeIfNotNull(ITypeSymbol? type)
src\libraries\Common\src\SourceGenerators\TypeModelHelper.cs (3)
13public static List<ITypeSymbol>? GetAllTypeArgumentsInScope(this INamedTypeSymbol type) 20List<ITypeSymbol>? args = null; 38public static string GetFullyQualifiedName(this ITypeSymbol type) => type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
src\libraries\Common\src\SourceGenerators\TypeRef.cs (1)
16public TypeRef(ITypeSymbol type)
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
242static IEnumerable<ISymbol> GetAllMembers(ITypeSymbol? symbol)
System.Windows.Forms.PrivateSourceGenerators (5)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (2)
207HashSet<ITypeSymbol> foundTypes = new(SymbolEqualityComparer.Default); 218ITypeSymbol? enumType = semanticModel.GetTypeInfo(argument, cancellationToken).Type;
System\Windows\Forms\SourceGenerators\EnumValidationInfo.cs (3)
10public static EnumValidationInfo FromEnumType(ITypeSymbol enumType, bool isFlags) 16private static IEnumerable<int> GetElementValues(ITypeSymbol enumType) 34public static EnumTypeInfo FromEnumType(ITypeSymbol enumType)