262 references to TypeParameterConstraintKind
Microsoft.CodeAnalysis.CSharp (170)
Binder\Binder_Constraints.cs (27)
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; 300constraints |= TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType; 304(constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType)) != (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType)); 445TypeParameterConstraintKind constraints, 476if ((constraints & (TypeParameterConstraintKind.ReferenceType)) != 0) 493if ((constraints & TypeParameterConstraintKind.ValueType) != 0) 499else if ((constraints & TypeParameterConstraintKind.Unmanaged) != 0)
Lowering\SynthesizedMethodBaseSymbol.cs (2)
95public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 96=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\ConstraintsHelper.cs (10)
345internal static ImmutableArray<TypeParameterConstraintKind> MakeTypeParameterConstraintKinds( 354return ImmutableArray<TypeParameterConstraintKind>.Empty; 378if (clauses.All(clause => clause.Constraints == TypeParameterConstraintKind.None)) 380return ImmutableArray<TypeParameterConstraintKind>.Empty; 400TypeParameterConstraintKind constraintKind = constraint.Constraints; 402Debug.Assert((constraintKind & (TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes)) == 0); 404if ((constraintKind & TypeParameterConstraintKind.AllValueTypeKinds) == 0 && isValueTypeMap[typeParameter]) 406constraintKind |= TypeParameterConstraintKind.ValueTypeFromConstraintTypes; 411constraintKind |= TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes;
Symbols\Source\LambdaSymbol.cs (2)
408public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() => ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\LocalFunctionSymbol.cs (2)
27private ImmutableArray<TypeParameterConstraintKind> _lazyTypeParameterConstraintKinds; 461public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
Symbols\Source\SourceConstructorSymbolBase.cs (2)
150public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 151=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
160public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 161=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceDestructorSymbol.cs (2)
110public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 111=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceEventAccessorSymbol.cs (2)
212public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 213=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceMethodSymbol.cs (1)
29public abstract ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds();
Symbols\Source\SourceNamedTypeSymbol.cs (39)
38private ImmutableArray<TypeParameterConstraintKind> _lazyTypeParameterConstraintKinds; 300internal TypeParameterConstraintKind GetTypeParameterConstraintKind(int ordinal) 303return (constraintKinds.Length > 0) ? constraintKinds[ordinal] : TypeParameterConstraintKind.None; 306private ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 399private ImmutableArray<TypeParameterConstraintKind> MakeTypeParameterConstraintKinds() 458if (results.All(clause => clause.Constraints == TypeParameterConstraintKind.None)) 518bool report = (GetTypeParameterConstraintKind(i) & TypeParameterConstraintKind.PartialMismatch) != 0; 665TypeParameterConstraintKind mergedKind = constraint.Constraints; 675Debug.Assert((constraint.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) == 676(mergedKind & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull))); 677Debug.Assert((mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 678(constraint.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0); 679Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == (mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds) || 680(constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == TypeParameterConstraintKind.ReferenceType); 699static void mergeConstraints(ref TypeParameterConstraintKind mergedKind, ImmutableArray<TypeWithAnnotations> originalConstraintTypes, TypeParameterConstraintClause clause) 701if ((mergedKind & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) != (clause.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull))) 703mergedKind |= TypeParameterConstraintKind.PartialMismatch; 706if ((mergedKind & TypeParameterConstraintKind.ReferenceType) != 0 && (clause.Constraints & TypeParameterConstraintKind.ReferenceType) != 0) 709TypeParameterConstraintKind clause1Constraints = mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds; 710TypeParameterConstraintKind clause2Constraints = clause.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds; 713if (clause1Constraints == TypeParameterConstraintKind.ReferenceType) // Oblivious 716mergedKind = (mergedKind & (~TypeParameterConstraintKind.AllReferenceTypeKinds)) | clause2Constraints; 718else if (clause2Constraints != TypeParameterConstraintKind.ReferenceType) 721mergedKind |= TypeParameterConstraintKind.PartialMismatch; 729if (((mergedKind | clause.Constraints) & ~(TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType | TypeParameterConstraintKind.Constructor)) == 0 && 730(mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0 && // 'object~' 731(clause.Constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0) // 'object?' 734mergedKind &= ~TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (4)
40private ImmutableArray<TypeParameterConstraintKind> _lazyTypeParameterConstraintKinds; 206(args.declaredConstraints[typeParameterSymbol.Ordinal].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.Default)) == 0; 337public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds()
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (6)
95switch (declaredConstraints[i].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.ValueType | TypeParameterConstraintKind.Default)) 97case TypeParameterConstraintKind.ReferenceType: 104case TypeParameterConstraintKind.ValueType: 111case TypeParameterConstraintKind.Default:
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
338public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 339=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\SourceTypeParameterSymbol.cs (40)
435protected bool? CalculateReferenceTypeConstraintIsNullable(TypeParameterConstraintKind constraints) 437if ((constraints & TypeParameterConstraintKind.ReferenceType) == 0) 442switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) 444case TypeParameterConstraintKind.NullableReferenceType: 446case TypeParameterConstraintKind.NotNullableReferenceType: 488var constraints = this.GetConstraintKinds(); 489return (constraints & TypeParameterConstraintKind.Constructor) != 0; 497var constraints = this.GetConstraintKinds(); 498return (constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0; 507var constraints = this.GetConstraintKinds(); 508return (constraints & TypeParameterConstraintKind.ValueTypeFromConstraintTypes) != 0; 516var constraints = this.GetConstraintKinds(); 517return (constraints & TypeParameterConstraintKind.ReferenceType) != 0; 525var constraints = this.GetConstraintKinds(); 526return (constraints & TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes) != 0; 542var constraints = this.GetConstraintKinds(); 543return (constraints & TypeParameterConstraintKind.NotNull) != 0; 551if ((this.GetConstraintKinds() & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0) 564var constraints = this.GetConstraintKinds(); 565return (constraints & TypeParameterConstraintKind.Unmanaged) != 0; 577if (constraintTypes.IsEmpty && GetConstraintKinds() == TypeParameterConstraintKind.None) 585private TypeParameterConstraintKind GetConstraintKinds() 621var constraints = this.GetConstraintKinds(); 622return (constraints & TypeParameterConstraintKind.Constructor) != 0; 630var constraints = this.GetConstraintKinds(); 631return (constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0; 640var constraints = this.GetConstraintKinds(); 641return (constraints & TypeParameterConstraintKind.ValueTypeFromConstraintTypes) != 0; 649var constraints = this.GetConstraintKinds(); 650return (constraints & TypeParameterConstraintKind.ReferenceType) != 0; 658var constraints = this.GetConstraintKinds(); 659return (constraints & TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes) != 0; 667var constraints = this.GetConstraintKinds(); 668return (constraints & TypeParameterConstraintKind.NotNull) != 0; 684if ((this.GetConstraintKinds() & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) != 0) 697var constraints = this.GetConstraintKinds(); 698return (constraints & TypeParameterConstraintKind.Unmanaged) != 0; 712if (constraintTypes.IsEmpty && GetConstraintKinds() == TypeParameterConstraintKind.None) 720private TypeParameterConstraintKind GetConstraintKinds() 723return constraintKinds.IsEmpty ? TypeParameterConstraintKind.None : constraintKinds[Ordinal];
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (2)
798public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 799=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Source\TypeParameterConstraintClause.cs (21)
44/// <see cref="TypeParameterConstraintKind"/> mismatch is detected during merging process for partial type declarations. 73TypeParameterConstraintKind.None, 77TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType, 81TypeParameterConstraintKind constraints, 89case TypeParameterConstraintKind.None: 92case TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType: 101TypeParameterConstraintKind constraints, 105switch (constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) 107case TypeParameterConstraintKind.None: 108case TypeParameterConstraintKind.ReferenceType: 109case TypeParameterConstraintKind.NullableReferenceType: 110case TypeParameterConstraintKind.NotNullableReferenceType: 117Debug.Assert((constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 118(constraints & ~(TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType | TypeParameterConstraintKind.Constructor | TypeParameterConstraintKind.Default | 119TypeParameterConstraintKind.PartialMismatch | TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes)) == 0); 125public readonly TypeParameterConstraintKind Constraints; 159if ((constraintClause.Constraints & TypeParameterConstraintKind.AllValueTypeKinds) != 0)
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (2)
46public sealed override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() => ImmutableArray<TypeParameterConstraintKind>.Empty;
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
206public override ImmutableArray<TypeParameterConstraintKind> GetTypeParameterConstraintKinds() 207=> ImmutableArray<TypeParameterConstraintKind>.Empty;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (79)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (12)
1485CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.Constructor); 1490CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.ValueType, "I<int>"); 1494CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "A"); 1498CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "T"); 1534CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "T2"); 1536CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None); 1539CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "U2"); 1541CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None); 1546CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None); 1548CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "T4"); 1551CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None); 1553CompilationUtils.CheckConstraints(symbol, TypeParameterConstraintKind.None, "U4");
Symbols\GenericConstraintTests.cs (67)
36CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 39CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.ReferenceType, false, true, "object", "object"); 42CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 45CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "IA<T>"); 48CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.Constructor, false, false, "object", "object", "IB<T>", "IA<T>"); 51CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.Constructor, false, true, "A<int>", "A<int>", "A<int>"); 81CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T"); 85CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T"); 89CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, true, false, "ValueType", "int", "int"); 115CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, true, "C", "C", "C"); 155CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T"); 159CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "I<T>"); 164CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T"); 169CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "I<T>"); 5137CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T", "U"); 5140CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T", "I<U>", "I<object>"); 5143CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "I<T>", "I<U>"); 5146CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "T"); 5149CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "I<object>", "I<T>"); 5152CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "I<I<U>>"); 5249CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("O1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5250CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("O2").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5251CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("V1").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5252CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("V2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5253CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("V3").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5254CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("V4").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5255CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("V5").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "ValueType", "ValueType", "ValueType"); 5256CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("R1").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "A"); 5257CheckConstraints(@namespace.GetMember<NamedTypeSymbol>("R2").TypeParameters[0], TypeParameterConstraintKind.ReferenceType, false, true, "A", "A", "A"); 5293CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5294CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5296CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5297CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5299CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "ValueType", "ValueType", "ValueType"); 5300CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5474CheckConstraints(type.Interfaces()[0].GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5476CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5478CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5480CheckConstraints(type.Interfaces()[0].GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5482CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5484CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5486CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5488CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5490CheckConstraints(type.GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5492CheckConstraints(type.GetMethod("I<System.Object>.M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5494CheckConstraints(type.BaseType().GetMember<MethodSymbol>("M").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5525CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5527CheckConstraints(type.TypeParameters[0], TypeParameterConstraintKind.None, false, true, "C", "C", "C"); 5529CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5531CheckConstraints(method.TypeParameters[0], TypeParameterConstraintKind.None, false, true, "C", "C", "C"); 5593CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object"); 5594CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType"); 5596CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "ValueType", "ValueType", "ValueType"); 5597CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.ValueType, true, false, "ValueType", "ValueType", "ValueType"); 5599CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "IA"); 5600CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "IB"); 5601CheckConstraints(type.GetMember<MethodSymbol>("M3").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "A"); 5602CheckConstraints(type.GetMember<MethodSymbol>("M4").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "B", "B", "B"); 5604CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "IA"); 5605CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.None, false, false, "object", "object", "IB", "IA"); 5606CheckConstraints(type.GetMember<MethodSymbol>("M3").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "A", "IA"); 5607CheckConstraints(type.GetMember<MethodSymbol>("M4").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "B", "B", "B", "IA"); 5609CheckConstraints(type.GetMember<MethodSymbol>("M1").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "IA", "A"); 5610CheckConstraints(type.GetMember<MethodSymbol>("M2").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "IB", "A"); 5611CheckConstraints(type.GetMember<MethodSymbol>("M3").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "A", "A", "A"); 5612CheckConstraints(type.GetMember<MethodSymbol>("M4").TypeParameters[0], TypeParameterConstraintKind.None, false, true, "B", "B", "B", "A"); 5717TypeParameterConstraintKind constraints,
Microsoft.CodeAnalysis.CSharp.Test.Utilities (13)
CompilationTestUtils.cs (13)
82internal static void CheckConstraints(ITypeParameterSymbol symbol, TypeParameterConstraintKind constraints, params string[] constraintTypes) 169internal static TypeParameterConstraintKind GetTypeParameterConstraints(ITypeParameterSymbol typeParameter) 171var constraints = TypeParameterConstraintKind.None; 174constraints |= TypeParameterConstraintKind.Constructor; 178constraints |= TypeParameterConstraintKind.ReferenceType; 182constraints |= TypeParameterConstraintKind.ValueType; 187internal static TypeParameterConstraintKind GetTypeParameterConstraints(TypeParameterSymbol typeParameter) 189var constraints = TypeParameterConstraintKind.None; 192constraints |= TypeParameterConstraintKind.Constructor; 196constraints |= TypeParameterConstraintKind.ReferenceType; 200constraints |= TypeParameterConstraintKind.ValueType;