180 references to TypeParameterConstraintKind
Microsoft.CodeAnalysis.CSharp (178)
Binder\Binder_Constraints.cs (28)
120var constraints = TypeParameterConstraintKind.None; 143if (isForOverride && (constraints & (TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.ReferenceType)) != 0) 153constraints |= TypeParameterConstraintKind.NullableReferenceType; 166constraints |= TypeParameterConstraintKind.NotNullableReferenceType; 170constraints |= TypeParameterConstraintKind.ReferenceType; 184if (isForOverride && (constraints & (TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.ReferenceType)) != 0) 190constraints |= TypeParameterConstraintKind.ValueType; 199if ((constraints & TypeParameterConstraintKind.ValueType) != 0) 203if ((constraints & TypeParameterConstraintKind.Unmanaged) != 0) 213constraints |= TypeParameterConstraintKind.Constructor; 230if (isForOverride && (constraints & (TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.ReferenceType)) != 0) 236constraints |= TypeParameterConstraintKind.Default; 271constraints |= TypeParameterConstraintKind.Unmanaged; 280constraints |= TypeParameterConstraintKind.NotNull; 326constraints |= TypeParameterConstraintKind.AllowByRefLike; 341constraints |= TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType; 345(constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType)) != (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType)); 486TypeParameterConstraintKind constraints, 517if ((constraints & (TypeParameterConstraintKind.ReferenceType)) != 0) 534if ((constraints & TypeParameterConstraintKind.ValueType) != 0) 540else if ((constraints & TypeParameterConstraintKind.Unmanaged) != 0)
Lowering\SynthesizedMethodBaseSymbol.cs (2)
99public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 100=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\ConstraintsHelper.cs (10)
374internal static ImmutableArray<TypeParameterConstraintKind> MakeTypeParameterConstraintKinds( 383return ImmutableArray<TypeParameterConstraintKind>.Empty; 407if (clauses.All(clause => clause.Constraints == TypeParameterConstraintKind.None)) 409return ImmutableArray<TypeParameterConstraintKind>.Empty; 429TypeParameterConstraintKind constraintKind = constraint.Constraints; 431Debug.Assert((constraintKind & (TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes)) == 0); 433if ((constraintKind & TypeParameterConstraintKind.AllValueTypeKinds) == 0 && isValueTypeMap[typeParameter]) 435constraintKind |= TypeParameterConstraintKind.ValueTypeFromConstraintTypes; 440constraintKind |= TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes;
Symbols\Source\LambdaSymbol.cs (2)
429public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() => ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\LocalFunctionSymbol.cs (2)
29private ImmutableArray<TypeParameterConstraintKind> _lazyTypeParameterConstraintKinds; 500public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
Symbols\Source\SourceConstructorSymbolBase.cs (2)
140public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 141=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
155public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 156=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceDestructorSymbol.cs (2)
117public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 118=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceEventAccessorSymbol.cs (2)
194public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 195=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceMethodSymbol.cs (1)
29public abstract ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds();
Symbols\Source\SourceNamedTypeSymbol.cs (38)
294internal TypeParameterConstraintKind GetTypeParameterConstraintKind(int ordinal) 297return (constraintKinds.Length > 0) ? constraintKinds[ordinal] : TypeParameterConstraintKind.None; 300private ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 394private ImmutableArray<TypeParameterConstraintKind> MakeTypeParameterConstraintKinds() 453if (results.All(clause => clause.Constraints == TypeParameterConstraintKind.None)) 513bool report = (GetTypeParameterConstraintKind(i) & TypeParameterConstraintKind.PartialMismatch) != 0; 660TypeParameterConstraintKind mergedKind = constraint.Constraints; 670Debug.Assert((constraint.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) == 671(mergedKind & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull))); 672Debug.Assert((mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 673(constraint.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0); 674Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == (mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds) || 675(constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == TypeParameterConstraintKind.ReferenceType); 694static void mergeConstraints(ref TypeParameterConstraintKind mergedKind, ImmutableArray<TypeWithAnnotations> originalConstraintTypes, TypeParameterConstraintClause clause) 696if ((mergedKind & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) != (clause.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull))) 698mergedKind |= TypeParameterConstraintKind.PartialMismatch; 701if ((mergedKind & TypeParameterConstraintKind.ReferenceType) != 0 && (clause.Constraints & TypeParameterConstraintKind.ReferenceType) != 0) 704TypeParameterConstraintKind clause1Constraints = mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds; 705TypeParameterConstraintKind clause2Constraints = clause.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds; 708if (clause1Constraints == TypeParameterConstraintKind.ReferenceType) // Oblivious 711mergedKind = (mergedKind & (~TypeParameterConstraintKind.AllReferenceTypeKinds)) | clause2Constraints; 713else if (clause2Constraints != TypeParameterConstraintKind.ReferenceType) 716mergedKind |= TypeParameterConstraintKind.PartialMismatch; 724if (((mergedKind | clause.Constraints) & ~(TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType | TypeParameterConstraintKind.Constructor)) == 0 && 725(mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0 && // 'object~' 726(clause.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0) // 'object?' 729mergedKind &= ~TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (11)
194(args.declaredConstraints[typeParameterSymbol.Ordinal].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.Default)) == 0; 648switch (declaredConstraints[i].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.Default)) 650case TypeParameterConstraintKind.ReferenceType: 657case TypeParameterConstraintKind.ValueType: 664case TypeParameterConstraintKind.Default: 944public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 945=> ImmutableArray<TypeParameterConstraintKind>.Empty; 1058public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
342public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 343=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceTypeParameterSymbol.cs (44)
440protected bool? CalculateReferenceTypeConstraintIsNullable(TypeParameterConstraintKind constraints) 442if ((constraints & TypeParameterConstraintKind.ReferenceType) == 0) 447switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) 449case TypeParameterConstraintKind.NullableReferenceType: 451case TypeParameterConstraintKind.NotNullableReferenceType: 493var constraints = this.GetConstraintKinds(); 494return (constraints & TypeParameterConstraintKind.Constructor) != 0; 502var constraints = this.GetConstraintKinds(); 503return (constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0; 511var constraints = this.GetConstraintKinds(); 512return (constraints & TypeParameterConstraintKind.AllowByRefLike) != 0; 521var constraints = this.GetConstraintKinds(); 522return (constraints & TypeParameterConstraintKind.ValueTypeFromConstraintTypes) != 0; 530var constraints = this.GetConstraintKinds(); 531return (constraints & TypeParameterConstraintKind.ReferenceType) != 0; 539var constraints = this.GetConstraintKinds(); 540return (constraints & TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes) != 0; 556var constraints = this.GetConstraintKinds(); 557return (constraints & TypeParameterConstraintKind.NotNull) != 0; 565if ((this.GetConstraintKinds() & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0) 578var constraints = this.GetConstraintKinds(); 579return (constraints & TypeParameterConstraintKind.Unmanaged) != 0; 591if (constraintTypes.IsEmpty && GetConstraintKinds() == TypeParameterConstraintKind.None) 599private TypeParameterConstraintKind GetConstraintKinds() 635var constraints = this.GetConstraintKinds(); 636return (constraints & TypeParameterConstraintKind.Constructor) != 0; 644var constraints = this.GetConstraintKinds(); 645return (constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0; 653var constraints = this.GetConstraintKinds(); 654return (constraints & TypeParameterConstraintKind.AllowByRefLike) != 0; 663var constraints = this.GetConstraintKinds(); 664return (constraints & TypeParameterConstraintKind.ValueTypeFromConstraintTypes) != 0; 672var constraints = this.GetConstraintKinds(); 673return (constraints & TypeParameterConstraintKind.ReferenceType) != 0; 681var constraints = this.GetConstraintKinds(); 682return (constraints & TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes) != 0; 690var constraints = this.GetConstraintKinds(); 691return (constraints & TypeParameterConstraintKind.NotNull) != 0; 707if ((this.GetConstraintKinds() & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0) 720var constraints = this.GetConstraintKinds(); 721return (constraints & TypeParameterConstraintKind.Unmanaged) != 0; 735if (constraintTypes.IsEmpty && GetConstraintKinds() == TypeParameterConstraintKind.None) 743private TypeParameterConstraintKind GetConstraintKinds() 746return constraintKinds.IsEmpty ? TypeParameterConstraintKind.None : constraintKinds[Ordinal];
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (2)
785public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 786=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\TypeParameterConstraintClause.cs (22)
44/// <see cref="TypeParameterConstraintKind"/> mismatch is detected during merging process for partial type declarations. 75TypeParameterConstraintKind.None, 79TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType, 83TypeParameterConstraintKind constraints, 91case TypeParameterConstraintKind.None: 94case TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType: 103TypeParameterConstraintKind constraints, 107switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) 109case TypeParameterConstraintKind.None: 110case TypeParameterConstraintKind.ReferenceType: 111case TypeParameterConstraintKind.NullableReferenceType: 112case TypeParameterConstraintKind.NotNullableReferenceType: 119Debug.Assert((constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 120(constraints & ~(TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType | TypeParameterConstraintKind.Constructor | 121TypeParameterConstraintKind.Default | TypeParameterConstraintKind.PartialMismatch | 122TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes | 123TypeParameterConstraintKind.AllowByRefLike)) == 0); 129public readonly TypeParameterConstraintKind Constraints; 163if ((constraintClause.Constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0)
Symbols\Source\TypeParameterInfo.cs (2)
28public ImmutableArray<TypeParameterConstraintKind> LazyTypeParameterConstraintKinds; 34LazyTypeParameterConstraintKinds = ImmutableArray<TypeParameterConstraintKind>.Empty,
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (2)
55public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() => ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
205public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 206=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CompilationTestUtils.cs (2)
171var constraints = TypeParameterConstraintKind.None; 189var constraints = TypeParameterConstraintKind.None;