Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (8)
108CompletionContext context, SemanticModel semanticModel, SyntaxToken token, ITypeSymbol type, bool isParams, CancellationToken cancellationToken)
116var typeArg = type.GetTypeArguments().FirstOrDefault();
131var enumType = TryGetEnumTypeInEnumInitializer(semanticModel, token, type, cancellationToken) ??
220ITypeSymbol symbolType;
269private static ITypeSymbol? TryGetEnumTypeInEnumInitializer(
271ITypeSymbol type, CancellationToken cancellationToken)
316private static INamedTypeSymbol? TryGetCompletionListType(ITypeSymbol type, INamedTypeSymbol? within, Compilation compilation)
342private static INamedTypeSymbol? TryGetTypeWithStaticMembers(ITypeSymbol type)
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (7)
60var propertyPatternType = semanticModel.GetTypeInfo((PatternSyntax)propertyPatternClause.Parent!, cancellationToken).ConvertedType;
64var type = GetMemberAccessType(propertyPatternType, memberAccess, document, semanticModel, position);
100static ITypeSymbol? GetMemberAccessType(ITypeSymbol? type, ExpressionSyntax? expression, Document document, SemanticModel semanticModel, int position)
119static ITypeSymbol? GetMemberType(ITypeSymbol? type, string name, Document document, SemanticModel semanticModel, int position)
136static ImmutableArray<ISymbol> GetCandidatePropertiesAndFields(Document document, SemanticModel semanticModel, int position, ITypeSymbol? type)
CSharpAddYieldCodeFixProvider.cs (10)
57if (!TryGetMethodReturnType(node, model, cancellationToken, out var methodReturnType))
62if (!TryGetExpressionType(model, returnStatement.Expression, out var returnExpressionType))
92SemanticModel model, ExpressionSyntax? expression, [NotNullWhen(true)] out ITypeSymbol? returnExpressionType)
107[NotNullWhen(true)] out ITypeSymbol? methodReturnType)
120private bool IsCorrectTypeForYieldReturn(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, ITypeSymbol methodReturnType, SemanticModel model)
154private bool CanConvertTypes(ITypeSymbol typeArgument, ITypeSymbol returnExpressionType, SemanticModel model)
193private static bool IsCorrectTypeForYieldReturn(ITypeSymbol methodReturnType, SemanticModel model)
UseExplicitTypeCodeFixProvider.cs (10)
96var tupleTypeSymbol = GetConvertedType(semanticModel, typeSyntax.Parent, cancellationToken);
107var typeSymbol = GetConvertedType(semanticModel, typeSyntax, cancellationToken);
136var typeSymbol = GetConvertedType(semanticModel, typeSyntax, cancellationToken);
147private static ITypeSymbol AdjustNullabilityOfTypeSymbol(
148ITypeSymbol typeSymbol,
168private static ExpressionSyntax GenerateTupleDeclaration(ITypeSymbol typeSymbol, ParenthesizedVariableDesignationSyntax parensDesignation)
178var type = elements[i].Type;
210private static SyntaxNode GenerateTypeDeclaration(TypeSyntax typeSyntax, ITypeSymbol newTypeSymbol)
221private static ITypeSymbol GetConvertedType(SemanticModel semanticModel, SyntaxNode typeSyntax, CancellationToken cancellationToken)
223var typeSymbol = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).ConvertedType;
AbstractAddParameterCodeFixProvider.cs (4)
37protected abstract ITypeSymbol GetArgumentType(SyntaxNode argumentNode, SemanticModel semanticModel, CancellationToken cancellationToken);
391private async Task<(ITypeSymbol, RefKind)> GetArgumentTypeAndRefKindAsync(Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken)
395var argumentType = GetArgumentType(argument, semanticModel, cancellationToken);
533Compilation compilation, TypeInfo argumentTypeInfo, ITypeSymbol parameterType,
AddImport\SymbolReferenceFinder.cs (10)
213var typeSymbols = OfType<ITypeSymbol>(symbols);
240ITypeSymbol symbol,
319var propertyOrFieldType = symbol.GetSymbolType();
396ImmutableArray<SymbolResult<IMethodSymbol>> methodSymbols, ITypeSymbol typeSymbol)
451var type = _owner.GetQueryClauseInfo(_semanticModel, _node, searchScope.CancellationToken);
474var type = GetAwaitInfo(_semanticModel, _syntaxFacts, _node);
496var type = GetCollectionExpressionType(_semanticModel, _syntaxFacts, _node);
518var type = GetCollectionExpressionType(_semanticModel, _syntaxFacts, _node);
540var type = _owner.GetDeconstructInfo(_semanticModel, _node, searchScope.CancellationToken);
557SearchScope searchScope, string name, ITypeSymbol type, Func<IMethodSymbol, bool> predicate = null)
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (8)
50ITypeSymbol receiverTypeSymbol,
52ImmutableArray<ITypeSymbol> targetTypesSymbols,
102ITypeSymbol receiverTypeSymbol,
104ImmutableArray<ITypeSymbol> targetTypes,
139Compilation compilation, ImmutableArray<IMethodSymbol> extentsionMethodSymbols, ImmutableArray<ITypeSymbol> targetTypeSymbols, CancellationToken cancellationToken)
141Dictionary<ITypeSymbol, bool> typeConvertibilityCache = new();
208Compilation compilation, IMethodSymbol methodSymbol, ImmutableArray<ITypeSymbol> targetTypeSymbols,
209Dictionary<ITypeSymbol, bool> typeConvertibilityCache)
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (16)
26private readonly ITypeSymbol _receiverTypeSymbol;
34private readonly ConcurrentDictionary<ITypeSymbol, bool> _checkedReceiverTypes = new();
39ITypeSymbol receiverTypeSymbol,
57ITypeSymbol receiverTypeSymbol,
235MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols,
245var declaredReceiverTypeInOriginatingCompilation = SymbolFinder.FindSimilarSymbols(declaredReceiverType, _originatingSemanticModel.Compilation, cancellationToken).FirstOrDefault();
307MultiDictionary<ITypeSymbol, IMethodSymbol> matchingMethodSymbols,
350private MultiDictionary<ITypeSymbol, IMethodSymbol> GetPotentialMatchingSymbolsFromAssembly(
356var builder = new MultiDictionary<ITypeSymbol, IMethodSymbol>();
391if (MatchExtensionMethod(methodSymbol, receiverTypeName, internalsVisible, out var receiverType))
402static bool MatchExtensionMethod(IMethodSymbol method, string filterReceiverTypeName, bool internalsVisible, out ITypeSymbol? receiverType)
483private static ImmutableArray<string> GetReceiverTypeNames(ITypeSymbol receiverTypeSymbol)
489static void AddNamesForTypeWorker(ITypeSymbol receiverTypeSymbol, PooledHashSet<string> builder)
493foreach (var constraintType in typeParameter.ConstraintTypes)
527private static string GetReceiverTypeName(ITypeSymbol typeSymbol)
535var elementType = arrayType.ElementType;
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)
432ITypeSymbol? explicitCastInterface, ITypeSymbol forEachElementType,
452public ITypeSymbol? ExplicitCastInterface { get; }
453public ITypeSymbol ForEachElementType { get; }
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,
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (13)
2284protected static bool SignaturesEquivalent(ImmutableArray<IParameterSymbol> oldParameters, ITypeSymbol oldReturnType, ImmutableArray<IParameterSymbol> newParameters, ITypeSymbol newReturnType)
2316protected static bool TypesEquivalent(ITypeSymbol? oldType, ITypeSymbol? newType, bool exact)
2317=> (exact ? s_exactSymbolEqualityComparer : (IEqualityComparer<ITypeSymbol?>)s_runtimeSymbolEqualityComparer.SignatureTypeEquivalenceComparer).Equals(oldType, newType);
2319protected static bool TypesEquivalent<T>(ImmutableArray<T> oldTypes, ImmutableArray<T> newTypes, bool exact) where T : ITypeSymbol
2344Func<ImmutableArray<IParameterSymbol>, ITypeSymbol, ImmutableArray<IParameterSymbol>, ITypeSymbol, bool>? signatureComparer = null)
3984private static void AnalyzeType(ITypeSymbol oldType, ITypeSymbol newType, ref RudeEditKind rudeEdit, ref bool hasGeneratedAttributeChange, RudeEditKind rudeEditKind = RudeEditKind.TypeUpdate)
5721var oldTypeOpt = GetType(oldCapture);
5722var newTypeOpt = GetType(newCapture);
5901private static ITypeSymbol GetType(ISymbol localOrParameter)
ExtractMethod\MethodExtractor.Analyzer.cs (24)
52protected abstract VariableInfo CreateFromSymbol(Compilation compilation, ISymbol symbol, ITypeSymbol type, VariableStyle variableStyle, bool variableDeclared);
62protected abstract ITypeSymbol GetRangeVariableType(SemanticModel model, IRangeVariableSymbol symbol);
151private (ITypeSymbol typeSymbol, bool hasAnonymousType, bool awaitTaskReturn) AdjustReturnType(SemanticModel model, ITypeSymbol returnType)
172private void UnwrapTaskIfNeeded(SemanticModel model, ref ITypeSymbol returnType)
181var originalDefinition = returnType.OriginalDefinition;
202private void WrapReturnTypeInTask(SemanticModel model, ref ITypeSymbol returnType, out bool awaitTaskReturn)
232private (ImmutableArray<VariableInfo> parameters, ITypeSymbol returnType, VariableInfo? variableToUseAsReturnValue, bool unsafeAddressTakenUsed)
244var returnType = SelectionResult.GetContainingScopeType() ?? compilation.GetSpecialType(SpecialType.System_Object);
254var returnType = variableToUseAsReturnValue != null
485var type = GetSymbolType(model, symbol);
520ITypeSymbol type,
596private bool SelectionContainsOnlyIdentifierWithSameType(ITypeSymbol type)
614private static bool UserDefinedValueType(Compilation compilation, ITypeSymbol type)
624private static bool WellKnownFrameworkValueType(Compilation compilation, ITypeSymbol type)
640protected virtual ITypeSymbol GetSymbolType(SemanticModel model, ISymbol symbol)
746var type = GetRangeVariableType(model, rangeVariable);
769foreach (var type in constraintTypes)
816var visited = new HashSet<ITypeSymbol>();
828foreach (var type in constraintTypes)
842ITypeSymbol type, HashSet<ITypeSymbol> visited)
897private static IEnumerable<ITypeParameterSymbol> GetMethodTypeParametersInDeclaration(ITypeSymbol returnType, SortedDictionary<int, ITypeParameterSymbol> sortedMap)
945ITypeSymbol type,
AbstractSpeculationAnalyzer.cs (25)
266private bool ImplicitConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType)
279protected abstract bool ConversionsAreCompatible(TExpressionSyntax originalExpression, ITypeSymbol originalTargetType, TExpressionSyntax newExpression, ITypeSymbol newTargetType);
688var previousOriginalType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode).Type;
689var previousReplacedType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode).Type;
743GetForEachSymbols(this.OriginalSemanticModel, forEachStatement, out var originalGetEnumerator, out var originalElementType);
744GetForEachSymbols(this.SpeculativeSemanticModel, newForEachStatement, out var newGetEnumerator, out var newElementType);
760protected abstract void GetForEachSymbols(SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType);
780var expressionType = this.SpeculativeSemanticModel.GetTypeInfo(newForEachStatementExpression, _cancellationToken).ConvertedType;
805var originalThrowExpressionType = this.OriginalSemanticModel.GetTypeInfo(originalThrowExpression).Type;
807var newThrowExpressionType = this.SpeculativeSemanticModel.GetTypeInfo(newThrowExpression).Type;
924var originalTargetType = this.OriginalSemanticModel.GetTypeInfo(originalLeft).Type;
927var newTargetType = this.SpeculativeSemanticModel.GetTypeInfo(newLeft).Type;
935protected abstract bool IsReferenceConversion(Compilation model, ITypeSymbol sourceType, ITypeSymbol targetType);
962var newReceiverType = newReceiver != null
1001var receiverType = semanticModel.GetTypeInfo(receiver).Type;
1167ITypeSymbol originalTargetType,
1169ITypeSymbol newTargetType,
1184var originalConvertedTypeSymbol = this.OriginalSemanticModel.GetTypeInfo(originalExpression).ConvertedType;
1190var newConvertedTypeSymbol = this.SpeculativeSemanticModel.GetTypeInfo(newExpression).ConvertedType;
1198protected abstract TConversion ClassifyConversion(SemanticModel model, TExpressionSyntax expression, ITypeSymbol targetType);
1199protected abstract TConversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType);
CodeGenerationSymbolFactory.cs (19)
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,
323name: name, constraintTypes: ImmutableArray.Create<ITypeSymbol>(),
334ImmutableArray<ITypeSymbol> constraintTypes,
349public static IPointerTypeSymbol CreatePointerTypeSymbol(ITypeSymbol pointedAtType)
355public static IArrayTypeSymbol CreateArrayTypeSymbol(ITypeSymbol elementType, int rank = 1, NullableAnnotation nullableAnnotation = NullableAnnotation.None)
465ITypeSymbol returnType,
522ITypeSymbol? returnType = null,
Editing\SyntaxGenerator.cs (21)
349private protected abstract SyntaxNode GenerateExpression(ITypeSymbol? type, object? value, bool canUseFieldReference);
1598/// <see langword="true"/> if the language requires a <see cref="TypeExpression(ITypeSymbol)"/>
1600/// <see cref="LocalDeclarationStatement(ITypeSymbol, string, SyntaxNode, bool)"/>.
1623public SyntaxNode LocalDeclarationStatement(ITypeSymbol type, string name, SyntaxNode? initializer = null, bool isConst = false)
1736public SyntaxNode CatchClause(ITypeSymbol type, string identifier, IEnumerable<SyntaxNode> statements)
1775public abstract SyntaxNode DefaultExpression(ITypeSymbol type);
1837public SyntaxNode GenericName(string identifier, IEnumerable<ITypeSymbol> typeArguments)
1849public SyntaxNode GenericName(string identifier, params ITypeSymbol[] typeArguments)
1850=> GenericName(identifier, (IEnumerable<ITypeSymbol>)typeArguments);
1919public SyntaxNode TypeExpression(ITypeSymbol typeSymbol)
1922private protected abstract SyntaxNode TypeExpression(ITypeSymbol typeSymbol, RefKind refKind);
1929public SyntaxNode TypeExpression(ITypeSymbol typeSymbol, bool addImport)
1981public SyntaxNode TupleTypeExpression(IEnumerable<ITypeSymbol> elementTypes, IEnumerable<string>? elementNames = null)
2010public SyntaxNode TupleElementExpression(ITypeSymbol type, string? name = null)
2194public SyntaxNode ObjectCreationExpression(ITypeSymbol type, IEnumerable<SyntaxNode> arguments)
2206public SyntaxNode ObjectCreationExpression(ITypeSymbol type, params SyntaxNode[] arguments)
2261public SyntaxNode IsTypeExpression(SyntaxNode expression, ITypeSymbol type)
2272public SyntaxNode TryCastExpression(SyntaxNode expression, ITypeSymbol type)
2283public SyntaxNode CastExpression(ITypeSymbol type, SyntaxNode expression)
2294public SyntaxNode ConvertExpression(ITypeSymbol type, SyntaxNode expression)
2373public SyntaxNode LambdaParameter(string identifier, ITypeSymbol type)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs\ITypeSymbolExtensions.cs (75)
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)
53public static bool IsAbstractClass([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
56public static bool IsSystemVoid([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
59public static bool IsNullable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
62public static bool IsNonNullableValueType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
66[NotNullWhen(true)] this ITypeSymbol? symbol,
67[NotNullWhen(true)] out ITypeSymbol? underlyingType)
79public static bool IsModuleType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
82public static bool IsInterfaceType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
85public static bool IsDelegateType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
88public static bool IsFunctionPointerType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
91public static bool IsStructType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
98this ITypeSymbol type,
112public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol? type)
114var current = type;
122public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol type)
132public static IEnumerable<ITypeSymbol> GetContainingTypesAndThis(this ITypeSymbol? type)
134var current = type;
142public static IEnumerable<INamedTypeSymbol> GetContainingTypes(this ITypeSymbol type)
155this ITypeSymbol type, ITypeSymbol baseType, bool includeInterfaces)
168this ITypeSymbol type, ITypeSymbol baseType)
176this ITypeSymbol type, ITypeSymbol baseType)
178var originalBaseType = baseType.OriginalDefinition;
186IEnumerable<ITypeSymbol> baseTypes = (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes();
193this ITypeSymbol type, ITypeSymbol baseType)
195var originalBaseType = baseType.OriginalDefinition;
215this ITypeSymbol type, ITypeSymbol interfaceType)
217var originalInterfaceType = interfaceType.OriginalDefinition;
222this ITypeSymbol type, ITypeSymbol interfaceType)
227public static bool IsAttribute(this ITypeSymbol symbol)
245public static bool IsFormattableStringOrIFormattable([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
254this ITypeSymbol typeSymbol, bool allowDelegateAndEnumConstraints = false)
282public static bool IsNumericType([NotNullWhen(returnValue: true)] this ITypeSymbol? type)
308public static Accessibility DetermineMinimalAccessibility(this ITypeSymbol typeSymbol)
311public static bool ContainsAnonymousType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
327foreach (var typeArg in type.GetAllTypeArguments())
336public static string CreateParameterName(this ITypeSymbol type, bool capitalize = false)
357private static string GetParameterName(ITypeSymbol? type)
370public static bool IsSpecialType([NotNullWhen(returnValue: true)] this ITypeSymbol? symbol)
401public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
412public static INamedTypeSymbol? GetDelegateType(this ITypeSymbol? typeSymbol, Compilation compilation)
419var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0];
432public 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 bool? AreMoreSpecificThan(this IList<ITypeSymbol> t1, IList<ITypeSymbol> t2)
488public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
498private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
508private static bool? IsMoreSpecificThan(this ITypeSymbol t1, ITypeSymbol t2)
587public static bool IsOrDerivesFromExceptionType([NotNullWhen(returnValue: true)] this ITypeSymbol? type, Compilation compilation)
594foreach (var baseType in type.GetBaseTypesAndThis())
605foreach (var constraint in ((ITypeParameterSymbol)type).ConstraintTypes)
620public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type)
623public static bool IsEnumType([NotNullWhen(true)] this ITypeSymbol? type, [NotNullWhen(true)] out INamedTypeSymbol? enumType)
635public static bool? IsMutableValueType(this ITypeSymbol type)
637if (type.IsNullable(out var underlyingType))
714public static bool IsDisposable([NotNullWhen(returnValue: true)] this ITypeSymbol? type, [NotNullWhen(returnValue: true)] ITypeSymbol? iDisposableType)
719public static ITypeSymbol WithNullableAnnotationFrom(this ITypeSymbol type, ITypeSymbol symbolForNullableAnnotation)
723public static ITypeSymbol? RemoveNullableIfPresent(this ITypeSymbol? symbol)
Recommendations\AbstractRecommendationServiceRunner.cs (19)
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))
131private ImmutableArray<ITypeSymbol> SubstituteTypeParameters(ImmutableArray<ITypeSymbol> parameterTypeSymbols, SyntaxNode invocationExpression)
144using var _ = ArrayBuilder<ITypeSymbol>.GetInstance(out var concreteTypes);
150foreach (var parameterTypeSymbol in parameterTypeSymbols)
157var concreteType = typeArguments.ElementAtOrDefault(index);
182private ImmutableArray<ITypeSymbol> GetTypeSymbols(
191using var _ = ArrayBuilder<ITypeSymbol>.GetInstance(out var builder);
197if (!TryGetMatchingParameterTypeForArgument(method, argumentName, ordinalInInvocation, out var type))
235private bool TryGetMatchingParameterTypeForArgument(IMethodSymbol method, string argumentName, int ordinalInInvocation, out ITypeSymbol parameterType)
331if (unwrapNullable && namespaceOrType is ITypeSymbol typeSymbol)
351if (container is not ITypeSymbol containerType)
380static bool MatchesConstraints(ITypeSymbol originalContainerType, ImmutableArray<ITypeSymbol> constraintTypes)
387foreach (var constraintType in constraintTypes)
396static bool MatchesConstraint(ITypeSymbol originalContainerType, ITypeSymbol originalConstraintType)
Shared\Extensions\ITypeSymbolExtensions.cs (20)
31this ITypeSymbol typeSymbol,
111for (var currentType = typeSymbol; currentType != null; currentType = currentType.BaseType)
132public static ISymbol? FindImplementations(this ITypeSymbol typeSymbol, ISymbol constructedInterfaceMember, SolutionServices services)
142this ITypeSymbol typeSymbol,
181public static ITypeSymbol? RemoveUnavailableTypeParameters(
182this ITypeSymbol? type,
190private static ITypeSymbol? RemoveUnavailableTypeParameters(
191this ITypeSymbol? type,
199public static ITypeSymbol? RemoveAnonymousTypes(
200this ITypeSymbol? type,
207public static ITypeSymbol? RemoveUnnamedErrorTypes(
208this ITypeSymbol? type,
215public static ITypeSymbol? SubstituteTypes<TType1, TType2>(
216this ITypeSymbol? type,
219where TType1 : ITypeSymbol
220where TType2 : ITypeSymbol
226public static ITypeSymbol? SubstituteTypes<TType1, TType2>(
227this ITypeSymbol? type,
230where TType1 : ITypeSymbol
231where TType2 : ITypeSymbol