3 instantiations of TypeParameterConstraintClause
Microsoft.CodeAnalysis.CSharp (3)
Symbols\Source\TypeParameterConstraintClause.cs (3)
74
internal static readonly TypeParameterConstraintClause Empty = new
TypeParameterConstraintClause
(
78
internal static readonly TypeParameterConstraintClause ObliviousNullabilityIfReferenceType = new
TypeParameterConstraintClause
(
99
return new
TypeParameterConstraintClause
(constraints, constraintTypes);
64 references to TypeParameterConstraintClause
Microsoft.CodeAnalysis.CSharp (64)
Binder\Binder_Constraints.cs (14)
23
internal ImmutableArray<
TypeParameterConstraintClause
> BindTypeParameterConstraintClauses(
54
var results = ArrayBuilder<
TypeParameterConstraintClause
?>.GetInstance(n, fillWithValue: null);
68
(
TypeParameterConstraintClause
constraintClause, ArrayBuilder<TypeConstraintSyntax>? typeConstraintNodes) = this.BindTypeParameterConstraints(typeParameterList.Parameters[ordinal], clause, isForOverride, diagnostics);
117
private (
TypeParameterConstraintClause
, ArrayBuilder<TypeConstraintSyntax>?) BindTypeParameterConstraints(
347
return (
TypeParameterConstraintClause
.Create(constraints, constraintTypes?.ToImmutableAndFree() ?? ImmutableArray<TypeWithAnnotations>.Empty), syntaxBuilder);
364
internal ImmutableArray<
TypeParameterConstraintClause
> GetDefaultTypeParameterConstraintClauses(TypeParameterListSyntax typeParameterList)
366
var builder = ArrayBuilder<
TypeParameterConstraintClause
>.GetInstance(typeParameterList.Parameters.Count);
376
private
TypeParameterConstraintClause
GetDefaultTypeParameterConstraintClause(TypeParameterSyntax typeParameterSyntax, bool isForOverride = false)
378
return isForOverride || AreNullableAnnotationsEnabled(typeParameterSyntax.Identifier) ?
TypeParameterConstraintClause
.Empty :
TypeParameterConstraintClause
.ObliviousNullabilityIfReferenceType;
386
ArrayBuilder<
TypeParameterConstraintClause
> constraintClauses,
400
private static
TypeParameterConstraintClause
RemoveInvalidConstraints(
402
TypeParameterConstraintClause
constraintClause,
436
return
TypeParameterConstraintClause
.Create(constraintClause.Constraints, constraintTypeBuilder.ToImmutableAndFree());
Symbols\ConstraintsHelper.cs (10)
362
ImmutableArray<
TypeParameterConstraintClause
> clauses;
386
ImmutableArray<
TypeParameterConstraintClause
> clauses;
415
internal static ImmutableArray<
TypeParameterConstraintClause
> AdjustConstraintKindsBasedOnConstraintTypes(ImmutableArray<TypeParameterSymbol> typeParameters, ImmutableArray<
TypeParameterConstraintClause
> constraintClauses)
421
SmallDictionary<TypeParameterSymbol, bool> isValueTypeMap =
TypeParameterConstraintClause
.BuildIsValueTypeMap(typeParameters, constraintClauses);
422
SmallDictionary<TypeParameterSymbol, bool> isReferenceTypeFromConstraintTypesMap =
TypeParameterConstraintClause
.BuildIsReferenceTypeFromConstraintTypesMap(typeParameters, constraintClauses);
423
ArrayBuilder<
TypeParameterConstraintClause
> builder = null;
427
var
constraint = constraintClauses[i];
447
builder = ArrayBuilder<
TypeParameterConstraintClause
>.GetInstance(constraintClauses.Length);
451
builder[i] =
TypeParameterConstraintClause
.Create(constraintKind, constraint.ConstraintTypes);
Symbols\Source\SourceNamedTypeSymbol.cs (28)
316
var results = ImmutableArray<
TypeParameterConstraintClause
>.Empty;
322
ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>> otherPartialClauses = null;
336
ImmutableArray<
TypeParameterConstraintClause
> constraints;
364
(otherPartialClauses ??= ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>>.GetInstance()).Add(constraints);
372
results = ImmutableArray<
TypeParameterConstraintClause
>.Empty;
397
var results = ImmutableArray<
TypeParameterConstraintClause
>.Empty;
403
ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>> otherPartialClauses = null;
417
ImmutableArray<
TypeParameterConstraintClause
> constraints;
446
(otherPartialClauses ??= ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>>.GetInstance()).Add(constraints);
455
results = ImmutableArray<
TypeParameterConstraintClause
>.Empty;
488
private ImmutableArray<
TypeParameterConstraintClause
> MergeConstraintTypesForPartialDeclarations(ImmutableArray<
TypeParameterConstraintClause
> constraintClauses,
489
ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>> otherPartialClauses,
497
ArrayBuilder<
TypeParameterConstraintClause
> builder = null;
505
var
constraint = constraintClauses[i];
514
foreach (ImmutableArray<
TypeParameterConstraintClause
> otherPartialConstraints in otherPartialClauses)
540
builder = ArrayBuilder<
TypeParameterConstraintClause
>.GetInstance(constraintClauses.Length);
544
builder[i] =
TypeParameterConstraintClause
.Create(constraint.Constraints,
558
TypeParameterConstraintClause
clause)
642
private ImmutableArray<
TypeParameterConstraintClause
> MergeConstraintKindsForPartialDeclarations(ImmutableArray<
TypeParameterConstraintClause
> constraintClauses,
643
ArrayBuilder<ImmutableArray<
TypeParameterConstraintClause
>> otherPartialClauses)
650
ArrayBuilder<
TypeParameterConstraintClause
> builder = null;
658
var
constraint = constraintClauses[i];
663
foreach (ImmutableArray<
TypeParameterConstraintClause
> otherPartialConstraints in otherPartialClauses)
679
builder = ArrayBuilder<
TypeParameterConstraintClause
>.GetInstance(constraintClauses.Length);
683
builder[i] =
TypeParameterConstraintClause
.Create(mergedKind, originalConstraintTypes);
694
static void mergeConstraints(ref TypeParameterConstraintKind mergedKind, ImmutableArray<TypeWithAnnotations> originalConstraintTypes,
TypeParameterConstraintClause
clause)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (3)
113
private (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters, ImmutableArray<
TypeParameterConstraintClause
> DeclaredConstraintsForOverrideOrImplementation) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)
155
ImmutableArray<
TypeParameterConstraintClause
> declaredConstraints = default;
187
static void forceMethodTypeParameters(TypeWithAnnotations type, SourceOrdinaryMethodSymbol method, ImmutableArray<
TypeParameterConstraintClause
> declaredConstraints)
Symbols\Source\TypeParameterConstraintClause.cs (9)
74
internal static readonly
TypeParameterConstraintClause
Empty = new TypeParameterConstraintClause(
78
internal static readonly
TypeParameterConstraintClause
ObliviousNullabilityIfReferenceType = new TypeParameterConstraintClause(
82
internal static
TypeParameterConstraintClause
Create(
134
ImmutableArray<
TypeParameterConstraintClause
> constraintClauses)
147
static bool isValueType(TypeParameterSymbol thisTypeParameter, ImmutableArray<
TypeParameterConstraintClause
> constraintClauses, SmallDictionary<TypeParameterSymbol, bool> isValueTypeMap, ConsList<TypeParameterSymbol> inProgress)
159
TypeParameterConstraintClause
constraintClause = constraintClauses[thisTypeParameter.Ordinal];
199
ImmutableArray<
TypeParameterConstraintClause
> constraintClauses)
212
static bool isReferenceTypeFromConstraintTypes(TypeParameterSymbol thisTypeParameter, ImmutableArray<
TypeParameterConstraintClause
> constraintClauses,
225
TypeParameterConstraintClause
constraintClause = constraintClauses[thisTypeParameter.Ordinal];