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