2 implementations of ITypeParameterSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\TypeParameterSymbol.cs (1)
12internal sealed class TypeParameterSymbol : TypeSymbol, ITypeParameterSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\TypeParameterSymbol.vb (1)
22Implements ITypeParameterSymbol, ITypeParameterSymbolInternal
692 references to ITypeParameterSymbol
ILLink.RoslynAnalyzer (16)
DynamicallyAccessedMembersAnalyzer.cs (1)
231 var attributableSymbol = attributableMethod.TypeParameters[i];
RequiresAnalyzerBase.cs (2)
78 var typeParams = ImmutableArray<ITypeParameterSymbol>.Empty; 96 var typeParam = typeParams[i];
TrimAnalysis\GenericArgumentDataFlow.cs (3)
38 ImmutableArray<ITypeParameterSymbol> typeParameters, 98 static bool RequiresGenericArgumentDataFlow (ImmutableArray<ITypeParameterSymbol> typeParameters) 100 foreach (var typeParameter in typeParameters) {
TrimAnalysis\GenericParameterProxy.cs (2)
10 public GenericParameterProxy (ITypeParameterSymbol typeParameterSymbol) => TypeParameterSymbol = typeParameterSymbol; 27 public readonly ITypeParameterSymbol TypeParameterSymbol;
TrimAnalysis\GenericParameterValue.cs (2)
18 public GenericParameterValue (ITypeParameterSymbol typeParameterSymbol, DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes) 24 public GenericParameterValue (ITypeParameterSymbol typeParameterSymbol)
TrimAnalysis\HandleCallAction.cs (2)
91 if (staticType is null || staticTypeDef is null || staticType is ITypeParameterSymbol) { 93 if (staticType is ITypeParameterSymbol genericParam) {
TrimAnalysis\MethodProxy.cs (1)
42 foreach (var typeParameter in Method.TypeParameters) {
TrimAnalysis\SingleValueExtensions.cs (2)
21 new GenericParameterValue ((ITypeParameterSymbol) underlyingType)), 30 SymbolKind.TypeParameter => new GenericParameterValue ((ITypeParameterSymbol) type),
TrimAnalysis\TypeProxy.cs (1)
21 foreach (var typeParameter in namedType.TypeParameters) {
Metrics (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Metrics.Legacy (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Microsoft.Analyzers.Extra (1)
ConditionalAccessAnalyzer.cs (1)
85if (type is ITypeParameterSymbol tp)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (3)
StaticRouteHandlerModel\Emitters\DiagnosticEmitter.cs (3)
14if (response.ResponseType is ITypeParameterSymbol) 33if (typeSymbol is ITypeParameterSymbol || 35((INamedTypeSymbol)typeSymbol).TypeArguments.Any(a => a is ITypeParameterSymbol))
Microsoft.AspNetCore.OpenApi.SourceGenerators (4)
Helpers\ISymbolExtensions.cs (3)
51public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol) 53var results = ImmutableArray.CreateBuilder<ITypeParameterSymbol>(); 64public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
XmlComments\XmlComment.InheritDoc.cs (1)
236var targetTypeParameter = symbol.GetAllTypeParameters().FirstOrDefault(p => p.Name == typeParamName.Value);
Microsoft.CodeAnalysis (14)
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n)
DocumentationCommentId.cs (3)
650public override bool VisitTypeParameter(ITypeParameterSymbol symbol) 682private bool IsInScope(ITypeParameterSymbol typeParameterSymbol) 1410private static ITypeParameterSymbol? GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n)
Symbols\IMethodSymbol.cs (2)
119ImmutableArray<ITypeParameterSymbol> TypeParameters { get; } 185ITypeSymbol? GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter);
Symbols\INamedTypeSymbol.cs (1)
73ImmutableArray<ITypeParameterSymbol> TypeParameters { get; }
Symbols\ISymbolExtensions.cs (1)
39var typeParameter = method.TypeParameters[i];
Symbols\ITypeParameterSymbol.cs (2)
98new ITypeParameterSymbol OriginalDefinition { get; } 104ITypeParameterSymbol? ReducedFrom { get; }
Symbols\SymbolVisitor.cs (1)
108public virtual void VisitTypeParameter(ITypeParameterSymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
111public virtual TResult? VisitTypeParameter(ITypeParameterSymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
116public virtual TResult VisitTypeParameter(ITypeParameterSymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.Analyzers (6)
MetaAnalyzers\RegisterActionAnalyzer.cs (1)
392ITypeParameterSymbol? typeParam = method.TypeParameters.FirstOrDefault(t => t.Name == DiagnosticWellKnownNames.TLanguageKindEnumName);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Microsoft.CodeAnalysis.AnalyzerUtilities (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Microsoft.CodeAnalysis.BannedApiAnalyzers (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Microsoft.CodeAnalysis.CodeStyle (50)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
263useSpread = method.GetOriginalUnreducedDefinition() is not IMethodSymbol { IsExtensionMethod: true, Parameters: [_, { Type: ITypeParameterSymbol }] };
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (3)
110var genericParameterSymbol = GetGenericParameterSymbol(syntaxFacts, semanticModel, arguments[0], arguments[1], cancellationToken); 148private static ITypeParameterSymbol? GetGenericParameterSymbol(ISyntaxFacts syntaxFacts, SemanticModel semanticModel, SyntaxNode node1, SyntaxNode node2, CancellationToken cancellationToken) 155return parameterType as ITypeParameterSymbol;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (3)
428public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol) 436public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol) 438var results = ArrayBuilder<ITypeParameterSymbol>.GetInstance();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
96public override bool VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (3)
12public static INamedTypeSymbol? GetNamedTypeSymbolConstraint(this ITypeParameterSymbol typeParameter) 19: type is ITypeParameterSymbol 20? GetNamedTypeSymbolConstraint((ITypeParameterSymbol)type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (1)
64public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (2)
13ArrayBuilder<ITypeParameterSymbol> typeParameters, 76public override void VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (9)
523var isTypeParameter1 = t1 is ITypeParameterSymbol; 524var isTypeParameter2 = t2 is ITypeParameterSymbol; 616foreach (var constraint in ((ITypeParameterSymbol)type).ConstraintTypes) 771IEnumerable<ITypeParameterSymbol> availableTypeParameters) 802this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result) 808this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result) 814this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result, bool onlyMethodTypeParameters) 823public static IList<ITypeParameterSymbol> GetReferencedTypeParameters(this ITypeSymbol? type) 825using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
68public override Accessibility VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (1)
47public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (1)
62public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (1)
66public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
62/// <item>Two <see cref="ITypeParameterSymbol"/> are the "same" if they have
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
476public override void VisitTypeParameter(ITypeParameterSymbol typeParameterSymbol) 495if (symbol is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } typeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (2)
11public static void Create(ITypeParameterSymbol symbol, int methodIndex, SymbolKeyWriter visitor) 24var typeParameter = method?.TypeParameters[ordinal];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (5)
11private sealed class TypeParameterSymbolKey : AbstractSymbolKey<ITypeParameterSymbol> 15public sealed override void Create(ITypeParameterSymbol symbol, SymbolKeyWriter visitor) 31SymbolKeyReader reader, ITypeParameterSymbol? contextualSymbol, out string? failureReason) 60using var result = PooledArrayBuilder<ITypeParameterSymbol>.GetInstance(); 63foreach (var typeParam in containingSymbol.GetTypeParameters())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
221var typeParameter1 = method1.TypeParameters[i]; 222var typeParameter2 = method2.TypeParameters[i]; 231private bool HaveSameConstraints(ITypeParameterSymbol typeParameter1, ITypeParameterSymbol typeParameter2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
131SymbolKind.TypeParameter => TypeParametersAreEquivalent((ITypeParameterSymbol)x, (ITypeParameterSymbol)y, equivalentTypesWithDifferingAssemblies), 616private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
73SymbolKind.TypeParameter => CombineHashCodes((ITypeParameterSymbol)x, currentHash), 261public int CombineHashCodes(ITypeParameterSymbol x, int currentHash)
Microsoft.CodeAnalysis.CodeStyle.Fixes (50)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
291private static ITypeSymbol FixType(ITypeSymbol typeSymbol, SemanticModel semanticModel, IEnumerable<ITypeParameterSymbol> allTypeParameters)
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (1)
182typeToGenerateIn = typeInfo.Type is ITypeParameterSymbol typeParameter
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (7)
22protected abstract ImmutableArray<ITypeParameterSymbol> GetCapturedTypeParameters(CancellationToken cancellationToken); 23protected abstract ImmutableArray<ITypeParameterSymbol> GenerateTypeParameters(CancellationToken cancellationToken); 30protected override ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker( 37private ImmutableArray<ITypeParameterSymbol> ComputeTypeParameters( 46var result = capturedTypeParameters.Except<ITypeParameterSymbol>(availableTypeParameters, SymbolEqualityComparer.Default).ToImmutableArray(); 55private ITypeParameterSymbol MassageTypeParameter( 56ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (1)
28protected override ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (7)
38private ImmutableArray<ITypeParameterSymbol> _typeParameters; 39private IDictionary<ITypeSymbol, ITypeParameterSymbol> _typeArgumentToTypeParameterMap; 41public ImmutableArray<ITypeParameterSymbol> DetermineTypeParameters(CancellationToken cancellationToken) 48protected abstract ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker(CancellationToken cancellationToken); 166private IDictionary<ITypeSymbol, ITypeParameterSymbol> GetTypeArgumentToTypeParameterMap( 172private IDictionary<ITypeSymbol, ITypeParameterSymbol> CreateTypeArgumentToTypeParameterMap( 182var result = new Dictionary<ITypeSymbol, ITypeParameterSymbol>(SymbolEqualityComparer.Default);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
57public override async ValueTask VisitTypeParameter(ITypeParameterSymbol symbol) 83private async ValueTask<ITypeSymbol?> DetermineCommonDerivedTypeAsync(ITypeParameterSymbol symbol)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
464using var _1 = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var capturedMethodTypeParameters); 478using var _2 = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var combinedTypeParameters);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
316current is ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
181if (first is ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
274ITypeParameterSymbol typeParameter,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (7)
161ImmutableArray<ITypeParameterSymbol> typeParameters, 182string? name, ImmutableArray<ITypeParameterSymbol> typeParameters, 320public static ITypeParameterSymbol CreateTypeParameterSymbol(string name, int ordinal = 0) 333public static ITypeParameterSymbol CreateTypeParameter( 424ImmutableArray<ITypeParameterSymbol> typeParameters = default, 443ImmutableArray<ITypeParameterSymbol> typeParameters = default, 471ImmutableArray<ITypeParameterSymbol> typeParameters = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (2)
48public abstract ImmutableArray<ITypeParameterSymbol> TypeParameters { get; } 55public abstract ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
102public abstract ImmutableArray<ITypeParameterSymbol> TypeParameters { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (2)
58public override ImmutableArray<ITypeParameterSymbol> TypeParameters => _constructedFrom.TypeParameters; 84public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
103public override ImmutableArray<ITypeParameterSymbol> TypeParameters => _constructedFrom.TypeParameters;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (3)
22public override ImmutableArray<ITypeParameterSymbol> TypeParameters { get; } 36ImmutableArray<ITypeParameterSymbol> typeParameters, 114public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
23private readonly ImmutableArray<ITypeParameterSymbol> _typeParameters; 36ImmutableArray<ITypeParameterSymbol> typeParameters, 144public override ImmutableArray<ITypeParameterSymbol> TypeParameters
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (3)
24int ordinal) : CodeGenerationTypeSymbol(containingType?.ContainingAssembly, containingType, attributes, Accessibility.NotApplicable, default, name, SpecialType.None, nullableAnnotation), ITypeParameterSymbol 45public new ITypeParameterSymbol OriginalDefinition => this; 47public ITypeParameterSymbol ReducedFrom => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
99private static ImmutableArray<ITypeParameterSymbol> RenameTypeParameters( 100ImmutableArray<ITypeParameterSymbol> typeParameters, 111var typeParameter = typeParameters[i]; 138return [.. newTypeParameters.Cast<ITypeParameterSymbol>()];
Microsoft.CodeAnalysis.CSharp (39)
Compilation\CSharpSemanticModel.cs (1)
3259public abstract ITypeParameterSymbol GetDeclaredSymbol(TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken));
Compilation\MemberSemanticModel.cs (1)
891public override ITypeParameterSymbol GetDeclaredSymbol(TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
375public override ITypeParameterSymbol GetDeclaredSymbol(TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (1)
2190public override ITypeParameterSymbol GetDeclaredSymbol(TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken))
CSharpExtensions.cs (1)
1571public static ITypeParameterSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken))
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
874!(symbol.IsParams && symbol.Type is { IsRefLikeType: true } or ITypeParameterSymbol { AllowsRefLikeType: true }))
SymbolDisplay\SymbolDisplayVisitor.Types.cs (7)
156public override void VisitTypeParameter(ITypeParameterSymbol symbol) 798private void AddTypeParameterVarianceIfNeeded(ITypeParameterSymbol symbol) 850var typeParam = (ITypeParameterSymbol)typeArg; 873private static bool TypeParameterHasConstraints(ITypeParameterSymbol typeParam) 888var typeParam = (ITypeParameterSymbol)typeArg;
Symbols\PublicModel\MethodSymbol.cs (2)
114ImmutableArray<ITypeParameterSymbol> IMethodSymbol.TypeParameters 196ITypeSymbol IMethodSymbol.GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
Symbols\PublicModel\NamedTypeSymbol.cs (1)
64ImmutableArray<ITypeParameterSymbol> INamedTypeSymbol.TypeParameters
Symbols\PublicModel\TypeParameterSymbol.cs (18)
35CodeAnalysis.NullableAnnotation ITypeParameterSymbol.ReferenceTypeConstraintNullableAnnotation => 44TypeParameterKind ITypeParameterSymbol.TypeParameterKind 52IMethodSymbol ITypeParameterSymbol.DeclaringMethod 57INamedTypeSymbol ITypeParameterSymbol.DeclaringType 62ImmutableArray<ITypeSymbol> ITypeParameterSymbol.ConstraintTypes 70ImmutableArray<CodeAnalysis.NullableAnnotation> ITypeParameterSymbol.ConstraintNullableAnnotations => 73ITypeParameterSymbol ITypeParameterSymbol.OriginalDefinition 78ITypeParameterSymbol ITypeParameterSymbol.ReducedFrom 83int ITypeParameterSymbol.Ordinal => _underlying.Ordinal; 85VarianceKind ITypeParameterSymbol.Variance => _underlying.Variance; 87bool ITypeParameterSymbol.HasReferenceTypeConstraint => _underlying.HasReferenceTypeConstraint; 89bool ITypeParameterSymbol.HasValueTypeConstraint => _underlying.HasValueTypeConstraint; 91bool ITypeParameterSymbol.AllowsRefLikeType => _underlying.AllowsRefLikeType; 93bool ITypeParameterSymbol.HasUnmanagedTypeConstraint => _underlying.HasUnmanagedTypeConstraint; 95bool ITypeParameterSymbol.HasNotNullConstraint => _underlying.HasNotNullConstraint; 97bool ITypeParameterSymbol.HasConstructorConstraint => _underlying.HasConstructorConstraint;
Symbols\SymbolExtensions.cs (5)
419internal static TypeParameterSymbol? EnsureCSharpSymbolOrNull(this ITypeParameterSymbol? symbol, string paramName) 646internal static ITypeParameterSymbol? GetPublicSymbol(this TypeParameterSymbol? symbol) 648return symbol.GetPublicSymbol<ITypeParameterSymbol>(); 721internal static ImmutableArray<ITypeParameterSymbol> GetPublicSymbols(this ImmutableArray<TypeParameterSymbol> symbols) 723return GetPublicSymbols<ITypeParameterSymbol>(StaticCast<Symbol>.From(symbols));
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
259instance is { Type: ITypeParameterSymbol { HasReferenceTypeConstraint: false } };
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (4)
937TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] 953if (originalCreateMethod.Parameters.All(static p => p.Type is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method })) 958if (originalCreateMethod.Parameters is [{ IsParams: true, Type: IArrayTypeSymbol { ElementType: ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } } }]) 984TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }]
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
81if (expressionType is ITypeParameterSymbol typeParameter &&
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (28)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (10)
49protected override ImmutableArray<ITypeParameterSymbol> GetCapturedTypeParameters(CancellationToken cancellationToken) 51using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var result); 62protected override ImmutableArray<ITypeParameterSymbol> GenerateTypeParameters(CancellationToken cancellationToken) 75var typeParameter = GetUniqueTypeParameter( 84var list = new FixedSizeArrayBuilder<ITypeParameterSymbol>(genericName.TypeArgumentList.Arguments.Count); 90var typeParameter = GetUniqueTypeParameter( 104private ITypeParameterSymbol GetUniqueTypeParameter( 109var methodTypeParameter = GetMethodTypeParameter(type, cancellationToken); 113private ITypeParameterSymbol? GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 118if (info.Type is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } typeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (5)
255foreach (var typeParameter in method.TypeParameters) 270private static TypeParameterConstraintSyntax GetConstraint(ITypeParameterSymbol typeParameter) 272using var _ = PooledHashSet<ITypeParameterSymbol>.GetInstance(out var visited); 277TypeParameterConstraintSyntax? GetConstraintRecursive(ITypeParameterSymbol typeParameter) 302if (constraintType is ITypeParameterSymbol constraintTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (2)
19ImmutableArray<ITypeParameterSymbol> typeParameters, CSharpCodeGenerationContextInfo info) 27private static TypeParameterSyntax GenerateTypeParameter(ITypeParameterSymbol symbol, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (4)
19this ImmutableArray<ITypeParameterSymbol> typeParameters) 25this IEnumerable<ITypeParameterSymbol> typeParameters) 29foreach (var typeParameter in typeParameters) 37ITypeParameterSymbol typeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
360public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (6)
639IDictionary<ITypeParameterSymbol, ITypeSymbol> bestMap = null; 661private static Dictionary<ITypeParameterSymbol, ITypeSymbol> DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType) 663var result = new Dictionary<ITypeParameterSymbol, ITypeSymbol>(); 668private static void DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType, Dictionary<ITypeParameterSymbol, ITypeSymbol> result) 679var returnTypeParameter = (ITypeParameterSymbol)returnType;
Microsoft.CodeAnalysis.CSharp.Features (35)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (5)
99var typeParameters = new List<ITypeParameterSymbol>(); 283private static void AddCapturedTypeParameters(ISymbol symbol, List<ITypeParameterSymbol> typeParameters) 298List<ITypeParameterSymbol> typeParameters, 299IEnumerable<ITypeParameterSymbol> reservedTypeParameters) 305if (symbol != null && symbol.OriginalDefinition is ITypeParameterSymbol typeParameter)
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
50ImmutableArray<ITypeParameterSymbol> MethodTypeParameters) 96using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var methodTypeParameters); 265var typeParameters = firstExtensionInfo.MethodTypeParameters.CastArray<ITypeParameterSymbol>();
ConvertToExtension\ExtensionMethodEqualityComparer.cs (4)
19IEqualityComparer<ITypeParameterSymbol>, 66public bool Equals(ITypeParameterSymbol? x, ITypeParameterSymbol? y) 110public int GetHashCode([DisallowNull] ITypeParameterSymbol obj)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
1159else if (oldSymbol is ITypeParameterSymbol oldTypeParameter)
GenerateType\CSharpGenerateTypeService.cs (3)
69var typeParameter = parameterIndex < type.TypeParameters.Length ? type.TypeParameters[parameterIndex] : null; 76var typeParameter = parameterIndex < method.TypeParameters.Length ? method.TypeParameters[parameterIndex] : null; 467protected override ImmutableArray<ITypeParameterSymbol> GetTypeParameters(
SignatureHelp\GenericNameSignatureHelpProvider.cs (3)
211ITypeParameterSymbol parameter, 225ITypeParameterSymbol typeParam, 308private static bool TypeParameterHasConstraints(ITypeParameterSymbol typeParam)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
259instance is { Type: ITypeParameterSymbol { HasReferenceTypeConstraint: false } };
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (4)
937TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] 953if (originalCreateMethod.Parameters.All(static p => p.Type is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method })) 958if (originalCreateMethod.Parameters is [{ IsParams: true, Type: IArrayTypeSymbol { ElementType: ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } } }]) 984TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }]
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (1)
81if (expressionType is ITypeParameterSymbol typeParameter &&
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (10)
49protected override ImmutableArray<ITypeParameterSymbol> GetCapturedTypeParameters(CancellationToken cancellationToken) 51using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var result); 62protected override ImmutableArray<ITypeParameterSymbol> GenerateTypeParameters(CancellationToken cancellationToken) 75var typeParameter = GetUniqueTypeParameter( 84var list = new FixedSizeArrayBuilder<ITypeParameterSymbol>(genericName.TypeArgumentList.Arguments.Count); 90var typeParameter = GetUniqueTypeParameter( 104private ITypeParameterSymbol GetUniqueTypeParameter( 109var methodTypeParameter = GetMethodTypeParameter(type, cancellationToken); 113private ITypeParameterSymbol? GetMethodTypeParameter(TypeSyntax type, CancellationToken cancellationToken) 118if (info.Type is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } typeParameter)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\LocalFunctionTests.cs (1)
5115var symbol = model.GetDeclaredSymbol(typeParameter);
Semantics\LockTests.cs (1)
551var parameterSymbol = model.GetDeclaredSymbol(localDecl);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (35)
Compilation\GetSemanticInfoTests.cs (3)
2093ITypeParameterSymbol typeParameter; 2204private IEnumerable<ISymbol> LookupTypeParameterMembers(string types, string constraints, string memberName, out ITypeParameterSymbol typeParameter) 6046var symbol = model.GetDeclaredSymbol(typeParameters[typeParameters.Length - 1]);
Compilation\SemanticModelAPITests.cs (4)
618var at = a.TypeParameters.First(); 620var bt = b.TypeParameters.First(); 1009var sym1 = model1.GetDeclaredSymbol(para1); 1010var sym2 = model2.GetDeclaredSymbol(para2);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (8)
884var symbol = model.GetDeclaredSymbol(typeDecl.TypeParameterList.Parameters[0]); 904var symbol = model.GetDeclaredSymbol(methodDecl.TypeParameterList.Parameters[0]); 969var ptsym = model.GetDeclaredSymbol(pt); 1484var symbol = LookupTypeParameterFromConstraintClause(model, interfaceDecl.ConstraintClauses[0], "T"); 1533var symbol = LookupTypeParameterFromConstraintClause(model, interfaceDecl.ConstraintClauses[0], "T1"); 1556private static ITypeParameterSymbol LookupTypeParameterFromConstraintClause(SemanticModel model, TypeParameterConstraintClauseSyntax constraintSyntax, string name) 1561var symbol = symbols[0] as ITypeParameterSymbol;
Compilation\SymbolVisitorTests.cs (3)
174public override void VisitTypeParameter(ITypeParameterSymbol symbol) 361public override string VisitTypeParameter(ITypeParameterSymbol symbol) 511public override int VisitTypeParameter(ITypeParameterSymbol symbol, StringBuilder argument)
DocumentationComments\CrefTests.cs (9)
3009ITypeParameterSymbol actualJ; 3014actualJ = (ITypeParameterSymbol)actualTypeA.TypeArguments.Single(); 3022ITypeParameterSymbol actualK; 3026actualK = (ITypeParameterSymbol)actualTypeB.TypeArguments.Single(); 3037ITypeParameterSymbol actualL; 3041actualL = (ITypeParameterSymbol)actualMethod.TypeArguments.Single(); 5566var sourceTypeParam = referencedType.TypeParameters.Single(); 6676var typeParameter = (ITypeParameterSymbol)model.GetSymbolInfo(name).Symbol;
Symbols\Source\DeclaringSyntaxNodeTests.cs (3)
461foreach (ITypeParameterSymbol tp in ((INamedTypeSymbol)f.Type).TypeParameters) 469foreach (ITypeParameterSymbol tp in m.TypeParameters) 477foreach (ITypeParameterSymbol tp in ((INamedTypeSymbol)f.Type).TypeParameters)
Symbols\Source\MethodTests.cs (1)
190var t1 = mylist.TypeParameters[0];
Symbols\Source\NullablePublicAPITests.cs (2)
825ITypeParameterSymbol typeParameterSymbol = ((INamedTypeSymbol)((INamedTypeSymbol)method.ReturnType).GetMembers("B").Single()).TypeParameters.Single(); 4180var typeParameters = localFunctionSymbol.TypeParameters[0];
Symbols\Source\TypeMapTests.cs (2)
56var t = at.TypeParameters[0]; 59var u = atbu.TypeParameters[0];
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
CompilationTestUtils.cs (3)
82internal static void CheckConstraints(ITypeParameterSymbol symbol, TypeParameterConstraintKind constraints, params string[] constraintTypes) 163foreach (var typeParameter in method.TypeParameters) 169internal static TypeParameterConstraintKind GetTypeParameterConstraints(ITypeParameterSymbol typeParameter)
Extensions.cs (1)
694public static ImmutableArray<INamedTypeSymbol> AllEffectiveInterfacesNoUseSiteDiagnostics(this ITypeParameterSymbol symbol)
Microsoft.CodeAnalysis.CSharp.Workspaces (20)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
1730private protected override SyntaxNode TypeParameter(ITypeParameterSymbol typeParameter)
Recommendations\CSharpRecommendationServiceRunner.cs (1)
888if (excludeInstance && containerType is ITypeParameterSymbol && symbol.IsStatic)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (5)
255foreach (var typeParameter in method.TypeParameters) 270private static TypeParameterConstraintSyntax GetConstraint(ITypeParameterSymbol typeParameter) 272using var _ = PooledHashSet<ITypeParameterSymbol>.GetInstance(out var visited); 277TypeParameterConstraintSyntax? GetConstraintRecursive(ITypeParameterSymbol typeParameter) 302if (constraintType is ITypeParameterSymbol constraintTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\TypeParameterGenerator.cs (2)
19ImmutableArray<ITypeParameterSymbol> typeParameters, CSharpCodeGenerationContextInfo info) 27private static TypeParameterSyntax GenerateTypeParameter(ITypeParameterSymbol symbol, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (4)
19this ImmutableArray<ITypeParameterSymbol> typeParameters) 25this IEnumerable<ITypeParameterSymbol> typeParameters) 29foreach (var typeParameter in typeParameters) 37ITypeParameterSymbol typeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
360public override TypeSyntax VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (6)
639IDictionary<ITypeParameterSymbol, ITypeSymbol> bestMap = null; 661private static Dictionary<ITypeParameterSymbol, ITypeSymbol> DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType) 663var result = new Dictionary<ITypeParameterSymbol, ITypeSymbol>(); 668private static void DetermineTypeParameterMapping(ITypeSymbol inferredType, ITypeSymbol returnType, Dictionary<ITypeParameterSymbol, ITypeSymbol> result) 679var returnTypeParameter = (ITypeParameterSymbol)returnType;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
CodeGeneration\CodeGenerationTests.cs (3)
139ImmutableArray<ITypeParameterSymbol> typeParameters = default, 341ImmutableArray<ITypeParameterSymbol> typeParameters = default, 506ImmutableArray<ITypeParameterSymbol> typeParameters = default,
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (5)
AbstractTypeParameterChecker.cs (5)
15/// Shared <see cref="SymbolVisitor"/> that looks for instances of <see cref="ITypeParameterSymbol"/> 20private readonly HashSet<ITypeParameterSymbol> _acceptableTypeParameters; 22protected AbstractTypeParameterChecker(ImmutableArray<ITypeParameterSymbol> acceptableTypeParameters) 24_acceptableTypeParameters = new HashSet<ITypeParameterSymbol>(acceptableTypeParameters); 29public sealed override void VisitTypeParameter(ITypeParameterSymbol symbol)
Microsoft.CodeAnalysis.Features (114)
Completion\Providers\AbstractObjectCreationCompletionProvider.cs (1)
91if (type is ITypeParameterSymbol typeParameter && !typeParameter.HasConstructorConstraint)
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
33if (type is ITypeParameterSymbol typeParameterSymbol)
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (1)
106if (symbol is INamespaceSymbol or ITypeParameterSymbol)
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (1)
483if (receiverTypeSymbol is ITypeParameterSymbol typeParameter)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
313string className, bool isRecord, ImmutableArray<ITypeParameterSymbol> capturedTypeParameters, ImmutableArray<ISymbol> members)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (10)
122ImmutableArray<ITypeParameterSymbol> capturedTypeParameters, 327string structName, ImmutableArray<ITypeParameterSymbol> typeParameters, 404ImmutableArray<ITypeParameterSymbol> typeParameters, bool addRenameAnnotation) 615string structName, ImmutableArray<ITypeParameterSymbol> typeParameters, 635string typeName, ImmutableArray<ITypeParameterSymbol> typeParameters, 689SyntaxEditor editor, string typeName, ImmutableArray<ITypeParameterSymbol> typeParameters, 749string typeName, ImmutableArray<ITypeParameterSymbol> typeParameters, 779SyntaxEditor editor, string typeName, ImmutableArray<ITypeParameterSymbol> typeParameters, 798Document document, Scope scope, bool isRecord, string structName, ImmutableArray<ITypeParameterSymbol> typeParameters, 910ImmutableArray<ITypeParameterSymbol> typeParameters, ImmutableArray<ISymbol> members)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (4)
2431protected static bool TypeParameterConstraintsEquivalent(ITypeParameterSymbol oldParameter, ITypeParameterSymbol newParameter, bool exact) 2441protected static bool TypeParametersEquivalent(ImmutableArray<ITypeParameterSymbol> oldParameters, ImmutableArray<ITypeParameterSymbol> newParameters, bool exact)
ExtractMethod\MethodExtractor.Analyzer.cs (22)
125var sortedMap = new SortedDictionary<int, ITypeParameterSymbol>(); 721private void AddTypeParametersToMap(IEnumerable<ITypeParameterSymbol> typeParameters, IDictionary<int, ITypeParameterSymbol> sortedMap) 723foreach (var typeParameter in typeParameters) 727private void AddTypeParameterToMap(ITypeParameterSymbol typeParameter, IDictionary<int, ITypeParameterSymbol> sortedMap) 748IDictionary<int, ITypeParameterSymbol> sortedMap) 754private void AppendMethodTypeParameterFromConstraint(SortedDictionary<int, ITypeParameterSymbol> sortedMap) 756var typeParametersInConstraint = new List<ITypeParameterSymbol>(); 759foreach (var typeParameter in sortedMap.Values) 773foreach (var typeParameter in typeParametersInConstraint) 777private void AppendMethodTypeParameterUsedDirectly(MultiDictionary<ISymbol, SyntaxToken> symbolMap, IDictionary<int, ITypeParameterSymbol> sortedMap) 779foreach (var typeParameter in symbolMap.Keys.OfType<ITypeParameterSymbol>()) 783private ImmutableArray<ITypeParameterSymbol> GetMethodTypeParametersInConstraintList( 786SortedDictionary<int, ITypeParameterSymbol> sortedMap) 798private void AppendTypeParametersInConstraintsUsedByConstructedTypeWithItsOwnConstraints(SortedDictionary<int, ITypeParameterSymbol> sortedMap) 801using var _2 = PooledHashSet<ITypeParameterSymbol>.GetInstance(out var candidates); 804foreach (var typeParameter in sortedMap.Values) 820ITypeSymbol type, HashSet<ITypeSymbol> visited, HashSet<ITypeParameterSymbol> typeParameters) 838if (arguments[i] is ITypeParameterSymbol argument) 859private ImmutableArray<ITypeParameterSymbol> GetMethodTypeParametersInDeclaration(ITypeSymbol returnType, SortedDictionary<int, ITypeParameterSymbol> sortedMap)
ExtractMethod\MethodExtractor.AnalyzerResult.cs (4)
23ImmutableArray<ITypeParameterSymbol> typeParametersInDeclaration, 24ImmutableArray<ITypeParameterSymbol> typeParametersInConstraintList, 33public ImmutableArray<ITypeParameterSymbol> MethodTypeParametersInDeclaration { get; } = typeParametersInDeclaration; 34public ImmutableArray<ITypeParameterSymbol> MethodTypeParametersInConstraintList { get; } = typeParametersInConstraintList;
ExtractMethod\MethodExtractor.CodeGenerator.cs (3)
402protected ImmutableArray<ITypeParameterSymbol> CreateMethodTypeParameters() 407var set = new HashSet<ITypeParameterSymbol>(AnalyzerResult.MethodTypeParametersInConstraintList); 409var typeParameters = ArrayBuilder<ITypeParameterSymbol>.GetInstance();
ExtractMethod\MethodExtractor.TypeParameterCollector.cs (3)
20private readonly List<ITypeParameterSymbol> _typeParameters = []; 22public static IEnumerable<ITypeParameterSymbol> Collect(ITypeSymbol? typeSymbol) 60public override void VisitTypeParameter(ITypeParameterSymbol typeParameterTypeSymbol)
GenerateType\AbstractGenerateTypeService.cs (5)
39protected abstract ImmutableArray<ITypeParameterSymbol> GetTypeParameters(State state, SemanticModel semanticModel, CancellationToken cancellationToken); 179protected static ImmutableArray<ITypeParameterSymbol> GetTypeParameters( 187using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var typeParameters); 197if (type is ITypeParameterSymbol typeParameter) 257protected IList<ITypeParameterSymbol> GetAvailableTypeParameters(
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (3)
83private ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWithDelegateChecks() 308private ImmutableArray<ITypeParameterSymbol> DetermineTypeParameters() 320private IList<ITypeParameterSymbol> GetAvailableTypeParameters()
IntroduceVariable\AbstractIntroduceVariableService.State_Parameter.cs (1)
26if (bindingMap.AllReferencedSymbols.OfType<ITypeParameterSymbol>()
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
130public override void VisitTypeParameter(ITypeParameterSymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (4)
359else if (symbol is ITypeParameterSymbol typeParameter) 513if (typeArgument is ITypeParameterSymbol && typeArgument.Name == typeParameter.Name) 691private void AddDescriptionForTypeParameter(ITypeParameterSymbol symbol) 729ImmutableArray<ITypeParameterSymbol> typeParameters,
MetadataAsSource\AbstractMetadataAsSourceService.WrappedMethodSymbol.cs (2)
78public ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter) 107public ImmutableArray<ITypeParameterSymbol> TypeParameters => _symbol.TypeParameters;
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
77public ImmutableArray<ITypeParameterSymbol> TypeParameters => _symbol.TypeParameters;
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
280if (symbol is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Cref })
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
48foreach (var typeParameter in symbol.TypeParameters)
Shared\Extensions\ISymbolExtensions_2.cs (1)
198ITypeParameterSymbol typeParam => typeParam.ContainingSymbol.GetDocumentationComment(compilation, expandIncludes: true, expandInheritdoc: true, cancellationToken: cancellationToken)?.GetTypeParameter(typeParam.Name) ?? DocumentationComment.Empty,
Shared\Utilities\ExtractTypeHelpers.cs (13)
131public static ImmutableArray<ITypeParameterSymbol> GetRequiredTypeParametersForMembers( 141var allReferencedTypeParameters = new HashSet<ITypeParameterSymbol>(directlyReferencedTypeParameters); 142var unanalyzedTypeParameters = new Queue<ITypeParameterSymbol>(directlyReferencedTypeParameters); 146var typeParameter = unanalyzedTypeParameters.Dequeue(); 150foreach (var originalTypeParameter in potentialTypeParameters) 165private static ImmutableArray<ITypeParameterSymbol> GetPotentialTypeParameters(INamedTypeSymbol type) 167using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var typeParameters); 186private static ImmutableArray<ITypeParameterSymbol> GetDirectlyReferencedTypeParameters( 187ImmutableArray<ITypeParameterSymbol> potentialTypeParameters, ImmutableArray<ISymbol> includedMembers) 189using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var directlyReferencedTypeParameters); 190foreach (var typeParameter in potentialTypeParameters) 201private static bool DoesMemberReferenceTypeParameter(ISymbol member, ITypeParameterSymbol typeParameter, HashSet<ITypeSymbol> checkedTypes) 226private static bool DoesTypeReferenceTypeParameter(ITypeSymbol type, ITypeParameterSymbol typeParameter, HashSet<ITypeSymbol> checkedTypes)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
263useSpread = method.GetOriginalUnreducedDefinition() is not IMethodSymbol { IsExtensionMethod: true, Parameters: [_, { Type: ITypeParameterSymbol }] };
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (3)
110var genericParameterSymbol = GetGenericParameterSymbol(syntaxFacts, semanticModel, arguments[0], arguments[1], cancellationToken); 148private static ITypeParameterSymbol? GetGenericParameterSymbol(ISyntaxFacts syntaxFacts, SemanticModel semanticModel, SyntaxNode node1, SyntaxNode node2, CancellationToken cancellationToken) 155return parameterType as ITypeParameterSymbol;
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
291private static ITypeSymbol FixType(ITypeSymbol typeSymbol, SemanticModel semanticModel, IEnumerable<ITypeParameterSymbol> allTypeParameters)
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (1)
182typeToGenerateIn = typeInfo.Type is ITypeParameterSymbol typeParameter
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.AbstractInvocationInfo.cs (7)
22protected abstract ImmutableArray<ITypeParameterSymbol> GetCapturedTypeParameters(CancellationToken cancellationToken); 23protected abstract ImmutableArray<ITypeParameterSymbol> GenerateTypeParameters(CancellationToken cancellationToken); 30protected override ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker( 37private ImmutableArray<ITypeParameterSymbol> ComputeTypeParameters( 46var result = capturedTypeParameters.Except<ITypeParameterSymbol>(availableTypeParameters, SymbolEqualityComparer.Default).ToImmutableArray(); 55private ITypeParameterSymbol MassageTypeParameter( 56ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs (1)
28protected override ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker(CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (7)
38private ImmutableArray<ITypeParameterSymbol> _typeParameters; 39private IDictionary<ITypeSymbol, ITypeParameterSymbol> _typeArgumentToTypeParameterMap; 41public ImmutableArray<ITypeParameterSymbol> DetermineTypeParameters(CancellationToken cancellationToken) 48protected abstract ImmutableArray<ITypeParameterSymbol> DetermineTypeParametersWorker(CancellationToken cancellationToken); 166private IDictionary<ITypeSymbol, ITypeParameterSymbol> GetTypeArgumentToTypeParameterMap( 172private IDictionary<ITypeSymbol, ITypeParameterSymbol> CreateTypeArgumentToTypeParameterMap( 182var result = new Dictionary<ITypeSymbol, ITypeParameterSymbol>(SymbolEqualityComparer.Default);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (2)
57public override async ValueTask VisitTypeParameter(ITypeParameterSymbol symbol) 83private async ValueTask<ITypeSymbol?> DetermineCommonDerivedTypeAsync(ITypeParameterSymbol symbol)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
464using var _1 = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var capturedMethodTypeParameters); 478using var _2 = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var combinedTypeParameters);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
316current is ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
181if (first is ITypeParameterSymbol typeParameter)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
274ITypeParameterSymbol typeParameter,
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 836private static ITypeParameterSymbol GetNthTypeParameter(INamedTypeSymbol typeSymbol, int n)
Microsoft.CodeAnalysis.Features.UnitTests (8)
FindUsages\DefinitionItemFactoryTests.cs (8)
703var t1 = tuple.TypeParameters[0]; 704var t2 = tuple.TypeParameters[1]; 765var t1 = tuple.TypeParameters[0]; 766var t2 = tuple.TypeParameters[1]; 821var t1 = type.TypeParameters[0]; 822var t2 = type.TypeParameters[1]; 875var t1 = type.TypeParameters[0]; 876var t2 = type.TypeParameters[1];
Microsoft.CodeAnalysis.PublicApiAnalyzers (16)
DeclarePublicApiAnalyzer.Impl.cs (4)
955foreach (var typeParameter in symbol.TypeParameters) 1009public override bool VisitTypeParameter(ITypeParameterSymbol symbol) 1025foreach (var typeParameter in symbol.TypeParameters) 1036private static bool CheckTypeParameterConstraints(ITypeParameterSymbol symbol)
ITypeParameterSymbolExtensions.cs (8)
12private static readonly Func<ITypeParameterSymbol, bool> s_hasReferenceTypeConstraint 13= LightupHelpers.CreateSymbolPropertyAccessor<ITypeParameterSymbol, bool>(typeof(ITypeParameterSymbol), nameof(HasReferenceTypeConstraint), fallbackResult: false); 15private static readonly Func<ITypeParameterSymbol, NullableAnnotation> s_referenceTypeConstraintNullableAnnotation 16= LightupHelpers.CreateSymbolPropertyAccessor<ITypeParameterSymbol, NullableAnnotation>(typeof(ITypeParameterSymbol), nameof(ReferenceTypeConstraintNullableAnnotation), fallbackResult: Lightup.NullableAnnotation.None); 18public static bool HasReferenceTypeConstraint(this ITypeParameterSymbol typeParameterSymbol) 21public static NullableAnnotation ReferenceTypeConstraintNullableAnnotation(this ITypeParameterSymbol typeParameterSymbol)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (2)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol;
Microsoft.CodeAnalysis.ResxSourceGenerator (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Microsoft.CodeAnalysis.Test.Utilities (2)
Compilation\TestOperationVisitor.cs (2)
781Assert.IsAssignableFrom<ITypeParameterSymbol>(constrainedToType); 882Assert.IsAssignableFrom<ITypeParameterSymbol>(constrainedToType);
Microsoft.CodeAnalysis.VisualBasic (33)
Binding\MemberSemanticModel.vb (1)
558Public Overloads Overrides Function GetDeclaredSymbol(typeParameter As TypeParameterSyntax, Optional cancellationToken As CancellationToken = Nothing) As ITypeParameterSymbol
Compilation\SemanticModel.vb (1)
2616Public MustOverride Overloads Function GetDeclaredSymbol(typeParameter As TypeParameterSyntax, Optional cancellationToken As CancellationToken = Nothing) As ITypeParameterSymbol
Compilation\SpeculativeSemanticModelWithMemberModel.vb (1)
177Public Overloads Overrides Function GetDeclaredSymbol(typeParameter As TypeParameterSyntax, Optional cancellationToken As CancellationToken = Nothing) As ITypeParameterSymbol
Compilation\SyntaxTreeSemanticModel.vb (1)
1105Public Overloads Overrides Function GetDeclaredSymbol(typeParameter As TypeParameterSyntax, Optional cancellationToken As CancellationToken = Nothing) As ITypeParameterSymbol
SymbolDisplay\SymbolDisplayVisitor.Types.vb (5)
81Public Overrides Sub VisitTypeParameter(symbol As ITypeParameterSymbol) 468Private Sub AddTypeParameterVarianceIfRequired(symbol As ITypeParameterSymbol) 499Dim typeParam = DirectCast(typeArg, ITypeParameterSymbol) 522Private Shared Function TypeParameterSpecialConstraintCount(typeParam As ITypeParameterSymbol) As Integer 528Private Sub AddTypeParameterConstraints(typeParam As ITypeParameterSymbol)
Symbols\MethodSymbol.vb (3)
983Private Function IMethodSymbol_GetTypeInferredDuringReduction(reducedFromTypeParameter As ITypeParameterSymbol) As ITypeSymbol Implements IMethodSymbol.GetTypeInferredDuringReduction 1122Private ReadOnly Property IMethodSymbol_TypeParameters As ImmutableArray(Of ITypeParameterSymbol) Implements IMethodSymbol.TypeParameters 1124Return StaticCast(Of ITypeParameterSymbol).From(Me.TypeParameters)
Symbols\NamedTypeSymbol.vb (2)
1389Private ReadOnly Property INamedTypeSymbol_TypeParameters As ImmutableArray(Of ITypeParameterSymbol) Implements INamedTypeSymbol.TypeParameters 1391Return StaticCast(Of ITypeParameterSymbol).From(Me.TypeParameters)
Symbols\TypeParameterSymbol.vb (18)
79Public MustOverride ReadOnly Property HasConstructorConstraint As Boolean Implements ITypeParameterSymbol.HasConstructorConstraint 91Public MustOverride ReadOnly Property TypeParameterKind As TypeParameterKind Implements ITypeParameterSymbol.TypeParameterKind 316Public MustOverride ReadOnly Property HasReferenceTypeConstraint As Boolean Implements ITypeParameterSymbol.HasReferenceTypeConstraint 318Public MustOverride ReadOnly Property HasValueTypeConstraint As Boolean Implements ITypeParameterSymbol.HasValueTypeConstraint 320Public MustOverride ReadOnly Property AllowsRefLikeType As Boolean Implements ITypeParameterSymbol.AllowsRefLikeType 322Friend MustOverride ReadOnly Property HasUnmanagedTypeConstraint As Boolean Implements ITypeParameterSymbol.HasUnmanagedTypeConstraint 324Private ReadOnly Property HasNotNullConstraint As Boolean Implements ITypeParameterSymbol.HasNotNullConstraint 330Public MustOverride ReadOnly Property Variance As VarianceKind Implements ITypeParameterSymbol.Variance 369Private ReadOnly Property ITypeParameterSymbol_ReferenceTypeConstraintNullableAnnotation As NullableAnnotation Implements ITypeParameterSymbol.ReferenceTypeConstraintNullableAnnotation 375Private ReadOnly Property ITypeParameterSymbol_DeclaringMethod As IMethodSymbol Implements ITypeParameterSymbol.DeclaringMethod 381Private ReadOnly Property ITypeParameterSymbol_DeclaringType As INamedTypeSymbol Implements ITypeParameterSymbol.DeclaringType 387Private ReadOnly Property ITypeParameterSymbol_Ordinal As Integer Implements ITypeParameterSymbol.Ordinal 393Private ReadOnly Property ITypeParameterSymbol_ConstraintTypes As ImmutableArray(Of ITypeSymbol) Implements ITypeParameterSymbol.ConstraintTypes 399Private ReadOnly Property ITypeParameterSymbol_ConstraintNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements ITypeParameterSymbol.ConstraintNullableAnnotations 405Private ReadOnly Property ITypeParameterSymbol_OriginalDefinition As ITypeParameterSymbol Implements ITypeParameterSymbol.OriginalDefinition 411Private ReadOnly Property ITypeParameterSymbol_ReducedFrom As ITypeParameterSymbol Implements ITypeParameterSymbol.ReducedFrom
VisualBasicExtensions.vb (1)
1058Public Function GetDeclaredSymbol(semanticModel As SemanticModel, typeParameter As TypeParameterSyntax, Optional cancellationToken As CancellationToken = Nothing) As ITypeParameterSymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (14)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (1)
158typeParameters:=ImmutableArray(Of ITypeParameterSymbol).Empty,
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateParameterizedMemberService.vb (9)
64Protected Overrides Function GetCapturedTypeParameters(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeParameterSymbol) 65Dim result = ArrayBuilder(Of ITypeParameterSymbol).GetInstance() 76Protected Overrides Function GenerateTypeParameters(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeParameterSymbol) 95Dim list = ArrayBuilder(Of ITypeParameterSymbol).GetInstance() 111cancellationToken As CancellationToken) As ITypeParameterSymbol 119Private Function GetMethodTypeParameter(type As TypeSyntax, cancellationToken As CancellationToken) As ITypeParameterSymbol 122If TypeOf info.Type Is ITypeParameterSymbol AndAlso 123DirectCast(info.Type, ITypeParameterSymbol).TypeParameterKind = TypeParameterKind.Method Then 124Return DirectCast(info.Type, ITypeParameterSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\TypeParameterGenerator.vb (3)
10Public Shared Function GenerateTypeParameterList(typeParameters As ImmutableArray(Of ITypeParameterSymbol)) As TypeParameterListSyntax 16Private Shared Function GenerateTypeParameter(symbol As ITypeParameterSymbol) As TypeParameterSyntax 23Private Shared Function GenerateTypeParameterConstraintClause(symbol As ITypeParameterSymbol) As TypeParameterConstraintClauseSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (1)
202Public Overrides Function VisitTypeParameter(symbol As ITypeParameterSymbol) As TypeSyntax
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
TypeParameterChecker.vb (1)
26MyBase.New(acceptableTypeParameters.As(Of ITypeParameterSymbol))
Microsoft.CodeAnalysis.VisualBasic.Features (16)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (1)
789newSymbol = matchingNewContainingMemberOrType.GetTypeParameters()(DirectCast(oldSymbol, ITypeParameterSymbol).Ordinal)
GenerateType\VisualBasicGenerateTypeService.vb (2)
371cancellationToken As CancellationToken) As ImmutableArray(Of ITypeParameterSymbol) 380Return ImmutableArray(Of ITypeParameterSymbol).Empty
SignatureHelp\GenericNameSignatureHelpProvider.vb (3)
146Private Overloads Shared Function Convert(parameter As ITypeParameterSymbol, semanticModel As SemanticModel, position As Integer, documentationCommentFormattingService As IDocumentationCommentFormattingService) As SignatureHelpSymbolParameter 158Private Shared Function AddConstraints(typeParam As ITypeParameterSymbol, 210Private Shared Function TypeParameterSpecialConstraintCount(typeParam As ITypeParameterSymbol) As Integer
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (1)
158typeParameters:=ImmutableArray(Of ITypeParameterSymbol).Empty,
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateParameterizedMemberService.vb (9)
64Protected Overrides Function GetCapturedTypeParameters(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeParameterSymbol) 65Dim result = ArrayBuilder(Of ITypeParameterSymbol).GetInstance() 76Protected Overrides Function GenerateTypeParameters(cancellationToken As CancellationToken) As ImmutableArray(Of ITypeParameterSymbol) 95Dim list = ArrayBuilder(Of ITypeParameterSymbol).GetInstance() 111cancellationToken As CancellationToken) As ITypeParameterSymbol 119Private Function GetMethodTypeParameter(type As TypeSyntax, cancellationToken As CancellationToken) As ITypeParameterSymbol 122If TypeOf info.Type Is ITypeParameterSymbol AndAlso 123DirectCast(info.Type, ITypeParameterSymbol).TypeParameterKind = TypeParameterKind.Method Then 124Return DirectCast(info.Type, ITypeParameterSymbol)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
1784ByRef syntax As TypeParameterSyntax) As ITypeParameterSymbol
Semantics\GetSemanticInfoTests.vb (1)
4424ByRef syntax As TypeParameterSyntax) As ITypeParameterSymbol
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
SymbolsTests\UnmanagedTypeConstraintTests.vb (2)
1059Assert.False(DirectCast(s5T, ITypeParameterSymbol).HasUnmanagedTypeConstraint) 1065Assert.True(DirectCast(mT, ITypeParameterSymbol).HasUnmanagedTypeConstraint)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (5)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2509Private Protected Overrides Function TypeParameter(symbol As ITypeParameterSymbol) As SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\TypeParameterGenerator.vb (3)
10Public Shared Function GenerateTypeParameterList(typeParameters As ImmutableArray(Of ITypeParameterSymbol)) As TypeParameterListSyntax 16Private Shared Function GenerateTypeParameter(symbol As ITypeParameterSymbol) As TypeParameterSyntax 23Private Shared Function GenerateTypeParameterConstraintClause(symbol As ITypeParameterSymbol) As TypeParameterConstraintClauseSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (1)
202Public Overrides Function VisitTypeParameter(symbol As ITypeParameterSymbol) As TypeSyntax
Microsoft.CodeAnalysis.Workspaces (93)
Editing\SyntaxGenerator.cs (8)
207foreach (var typeParameter in method.TypeParameters) 240bool HasNullableAnnotation(ITypeParameterSymbol typeParameter, IMethodSymbol method) 246static bool IsNullableAnnotatedTypeParameter(ITypeParameterSymbol typeParameter, ITypeParameterSymbol current) 334private protected abstract SyntaxNode TypeParameter(ITypeParameterSymbol typeParameter); 860private SyntaxNode WithTypeParametersAndConstraints(SyntaxNode declaration, ImmutableArray<ITypeParameterSymbol> typeParameters) 866foreach (var tp in typeParameters) 883private static bool HasSomeConstraint(ITypeParameterSymbol typeParameter)
FindSymbols\FindReferences\Finders\AbstractTypeParameterSymbolReferenceFinder.cs (2)
13internal abstract class AbstractTypeParameterSymbolReferenceFinder : AbstractReferenceFinder<ITypeParameterSymbol> 16ITypeParameterSymbol symbol,
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.UnderlyingNamedTypeVisitor.cs (1)
31public override INamedTypeSymbol? VisitTypeParameter(ITypeParameterSymbol symbol)
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (3)
16protected override bool CanFind(ITypeParameterSymbol symbol) 20ITypeParameterSymbol symbol, 41ITypeParameterSymbol symbol,
FindSymbols\FindReferences\Finders\TypeParameterSymbolReferenceFinder.cs (2)
15protected override bool CanFind(ITypeParameterSymbol symbol) 19ITypeParameterSymbol symbol,
Recommendations\AbstractRecommendationService.cs (1)
107return ((ITypeParameterSymbol)symbol).TypeParameterKind != TypeParameterKind.Cref;
Recommendations\AbstractRecommendationServiceRunner.cs (5)
155if (parameterTypeSymbol.IsKind<ITypeParameterSymbol>(SymbolKind.TypeParameter, out var typeParameter)) 424if (originalMember is IMethodSymbol { Parameters: [{ Type: ITypeParameterSymbol parameterType }, ..] }) 467if (originalContainerType is ITypeParameterSymbol typeParameterContainer) 492if (originalContainerType is ITypeParameterSymbol typeParameterContainer)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (3)
428public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol) 436public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol) 438var results = ArrayBuilder<ITypeParameterSymbol>.GetInstance();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
96public override bool VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (3)
12public static INamedTypeSymbol? GetNamedTypeSymbolConstraint(this ITypeParameterSymbol typeParameter) 19: type is ITypeParameterSymbol 20? GetNamedTypeSymbolConstraint((ITypeParameterSymbol)type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (1)
64public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs (2)
13ArrayBuilder<ITypeParameterSymbol> typeParameters, 76public override void VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (9)
523var isTypeParameter1 = t1 is ITypeParameterSymbol; 524var isTypeParameter2 = t2 is ITypeParameterSymbol; 616foreach (var constraint in ((ITypeParameterSymbol)type).ConstraintTypes) 771IEnumerable<ITypeParameterSymbol> availableTypeParameters) 802this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result) 808this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result) 814this ITypeSymbol? type, ArrayBuilder<ITypeParameterSymbol> result, bool onlyMethodTypeParameters) 823public static IList<ITypeParameterSymbol> GetReferencedTypeParameters(this ITypeSymbol? type) 825using var _ = ArrayBuilder<ITypeParameterSymbol>.GetInstance(out var result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
68public override Accessibility VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (1)
47public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (1)
62public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (1)
66public override ITypeSymbol VisitTypeParameter(ITypeParameterSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
62/// <item>Two <see cref="ITypeParameterSymbol"/> are the "same" if they have
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
476public override void VisitTypeParameter(ITypeParameterSymbol typeParameterSymbol) 495if (symbol is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } typeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (2)
11public static void Create(ITypeParameterSymbol symbol, int methodIndex, SymbolKeyWriter visitor) 24var typeParameter = method?.TypeParameters[ordinal];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterSymbolKey.cs (5)
11private sealed class TypeParameterSymbolKey : AbstractSymbolKey<ITypeParameterSymbol> 15public sealed override void Create(ITypeParameterSymbol symbol, SymbolKeyWriter visitor) 31SymbolKeyReader reader, ITypeParameterSymbol? contextualSymbol, out string? failureReason) 60using var result = PooledArrayBuilder<ITypeParameterSymbol>.GetInstance(); 63foreach (var typeParam in containingSymbol.GetTypeParameters())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
221var typeParameter1 = method1.TypeParameters[i]; 222var typeParameter2 = method2.TypeParameters[i]; 231private bool HaveSameConstraints(ITypeParameterSymbol typeParameter1, ITypeParameterSymbol typeParameter2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
131SymbolKind.TypeParameter => TypeParametersAreEquivalent((ITypeParameterSymbol)x, (ITypeParameterSymbol)y, equivalentTypesWithDifferingAssemblies), 616private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
73SymbolKind.TypeParameter => CombineHashCodes((ITypeParameterSymbol)x, currentHash), 261public int CombineHashCodes(ITypeParameterSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (7)
161ImmutableArray<ITypeParameterSymbol> typeParameters, 182string? name, ImmutableArray<ITypeParameterSymbol> typeParameters, 320public static ITypeParameterSymbol CreateTypeParameterSymbol(string name, int ordinal = 0) 333public static ITypeParameterSymbol CreateTypeParameter( 424ImmutableArray<ITypeParameterSymbol> typeParameters = default, 443ImmutableArray<ITypeParameterSymbol> typeParameters = default, 471ImmutableArray<ITypeParameterSymbol> typeParameters = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractMethodSymbol.cs (2)
48public abstract ImmutableArray<ITypeParameterSymbol> TypeParameters { get; } 55public abstract ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
102public abstract ImmutableArray<ITypeParameterSymbol> TypeParameters { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedMethodSymbol.cs (2)
58public override ImmutableArray<ITypeParameterSymbol> TypeParameters => _constructedFrom.TypeParameters; 84public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructedNamedTypeSymbol.cs (1)
103public override ImmutableArray<ITypeParameterSymbol> TypeParameters => _constructedFrom.TypeParameters;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (3)
22public override ImmutableArray<ITypeParameterSymbol> TypeParameters { get; } 36ImmutableArray<ITypeParameterSymbol> typeParameters, 114public override ITypeSymbol GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (3)
23private readonly ImmutableArray<ITypeParameterSymbol> _typeParameters; 36ImmutableArray<ITypeParameterSymbol> typeParameters, 144public override ImmutableArray<ITypeParameterSymbol> TypeParameters
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationTypeParameterSymbol.cs (3)
24int ordinal) : CodeGenerationTypeSymbol(containingType?.ContainingAssembly, containingType, attributes, Accessibility.NotApplicable, default, name, SpecialType.None, nullableAnnotation), ITypeParameterSymbol 45public new ITypeParameterSymbol OriginalDefinition => this; 47public ITypeParameterSymbol ReducedFrom => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
99private static ImmutableArray<ITypeParameterSymbol> RenameTypeParameters( 100ImmutableArray<ITypeParameterSymbol> typeParameters, 111var typeParameter = typeParameters[i]; 138return [.. newTypeParameters.Cast<ITypeParameterSymbol>()];
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
175else if (symbol is ITypeParameterSymbol
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
SymbolKeyTests.cs (2)
826var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().Where(n => !n.IsImplicitlyDeclared).Single().TypeParameters.Single(); 839var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>()
Microsoft.Extensions.Options.SourceGeneration (1)
Parser.cs (1)
226else if (type is ITypeParameterSymbol)
Microsoft.VisualStudio.LanguageServices (6)
ChangeSignature\AddParameterDialogViewModel.cs (1)
251if (typeArgument is ITypeParameterSymbol)
Progression\GraphNodeIdCreation.cs (5)
80var typeParameter = (ITypeParameterSymbol)symbol; 97items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, ((ITypeParameterSymbol)symbol).Ordinal.ToString())); 135else if (symbol is ITypeParameterSymbol typeParameter) 257private static async Task<GraphNodeId> GetPartialForTypeParameterSymbolAsync(ITypeParameterSymbol typeParameterSymbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken)
Microsoft.VisualStudio.LanguageServices.CSharp (3)
ObjectBrowser\DescriptionBuilder.cs (3)
320foreach (var typeParameterSymbol in typeSymbol.TypeParameters) 326foreach (var typeParameterSymbol in methodSymbol.TypeParameters) 330private async Task BuildConstraintsAsync(ITypeParameterSymbol typeParameterSymbol, CancellationToken cancellationToken)
Microsoft.VisualStudio.LanguageServices.VisualBasic (5)
ObjectBrowser\DescriptionBuilder.vb (5)
442typeParameters As ImmutableArray(Of ITypeParameterSymbol), 462typeParameter As ITypeParameterSymbol, 477typeParameter As ITypeParameterSymbol, 494typeParameter As ITypeParameterSymbol, 537Private Shared Function CountConstraints(typeParameter As ITypeParameterSymbol) As Integer
Roslyn.Diagnostics.Analyzers (9)
AbstractDoNotCopyValue.cs (4)
353public override void VisitTypeParameter(ITypeParameterSymbol symbol) 1542CheckTypeParameterSymbolInUnsupportedContext(operation, (ITypeParameterSymbol)symbol); 1586private void CheckTypeParameterSymbolInUnsupportedContext(IOperation operation, ITypeParameterSymbol? typeParameter) 1627foreach (var typeParameter in symbol.TypeParameters)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
System.Text.Json.SourceGeneration (2)
Helpers\RoslynExtensions.cs (2)
347if (returnType is ITypeParameterSymbol { HasNotNullConstraint: false }) 369if (inputType is ITypeParameterSymbol { HasNotNullConstraint: false })
Test.Utilities (5)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;
Text.Analyzers (7)
IdentifiersShouldBeSpelledCorrectly.cs (2)
333foreach (var typeParameter in method.TypeParameters) 346foreach (var typeParameter in type.TypeParameters)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (2)
399((ITypeParameterSymbol)type1).Ordinal == ((ITypeParameterSymbol)type2).Ordinal)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\ITypeSymbolExtensions.cs (3)
116var typeParameterSymbol = (ITypeParameterSymbol)symbol; 303typeSymbol is ITypeParameterSymbol typeParameter && !typeParameter.IsValueType;