81 references to TypeParameterConstraintKind
Microsoft.CodeAnalysis.VisualBasic (37)
Binding\Binder_Constraints.vb (15)
24
Dim constraints =
TypeParameterConstraintKind
.None
44
ByRef constraints As
TypeParameterConstraintKind
,
52
If (constraints And
TypeParameterConstraintKind
.Constructor) <> 0 Then
54
ElseIf (constraints And
TypeParameterConstraintKind
.ValueType) <> 0 Then
57
constraints = constraints Or
TypeParameterConstraintKind
.Constructor
58
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.Constructor, syntax.GetLocation()))
62
If (constraints And
TypeParameterConstraintKind
.ReferenceType) <> 0 Then
64
ElseIf (constraints And
TypeParameterConstraintKind
.ValueType) <> 0 Then
67
constraints = constraints Or
TypeParameterConstraintKind
.ReferenceType
68
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.ReferenceType, syntax.GetLocation()))
72
If (constraints And
TypeParameterConstraintKind
.ValueType) <> 0 Then
74
ElseIf (constraints And
TypeParameterConstraintKind
.Constructor) <> 0 Then
76
ElseIf (constraints And
TypeParameterConstraintKind
.ReferenceType) <> 0 Then
79
constraints = constraints Or
TypeParameterConstraintKind
.ValueType
80
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.ValueType, syntax.GetLocation()))
Symbols\ConstraintsHelper.vb (3)
110
Case
TypeParameterConstraintKind
.ReferenceType
127
Case
TypeParameterConstraintKind
.ValueType
144
Case
TypeParameterConstraintKind
.None
Symbols\Metadata\PE\PETypeParameterSymbol.vb (3)
156
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.Constructor, Nothing))
160
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.ReferenceType, Nothing))
164
constraintsBuilder.Add(New TypeParameterConstraint(
TypeParameterConstraintKind
.ValueType, Nothing))
Symbols\Source\SourceNamedTypeSymbol.vb (2)
898
Private Shared Function GetConstraintKind(constraints As ImmutableArray(Of TypeParameterConstraint)) As
TypeParameterConstraintKind
899
Dim kind =
TypeParameterConstraintKind
.None
Symbols\TypeParameterConstraint.vb (14)
15
Public Sub New(kind As
TypeParameterConstraintKind
, loc As Location)
17
Debug.Assert((kind =
TypeParameterConstraintKind
.Constructor) OrElse
18
(kind =
TypeParameterConstraintKind
.ReferenceType) OrElse
19
(kind =
TypeParameterConstraintKind
.ValueType))
23
Me.New(
TypeParameterConstraintKind
.None, type, loc)
27
Private Sub New(kind As
TypeParameterConstraintKind
, type As TypeSymbol, loc As Location)
39
Public ReadOnly Kind As
TypeParameterConstraintKind
45
Return Kind =
TypeParameterConstraintKind
.Constructor
51
Return Kind =
TypeParameterConstraintKind
.ReferenceType
57
Return Kind =
TypeParameterConstraintKind
.ValueType
73
Private Shared Function ToSyntaxKind(kind As
TypeParameterConstraintKind
) As SyntaxKind
75
Case
TypeParameterConstraintKind
.Constructor
77
Case
TypeParameterConstraintKind
.ReferenceType
79
Case
TypeParameterConstraintKind
.ValueType
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (44)
SymbolsTests\GenericConstraintTests.vb (44)
3577
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "T", "U")
3580
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "T", "I(Of U)", "I(Of Object)")
3583
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "I(Of T)", "I(Of U)")
3586
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "T")
3589
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "I(Of Object)", "I(Of T)")
3592
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "I(Of I(Of U))")
3619
CheckConstraints(type.TypeParameters(0),
TypeParameterConstraintKind
.None)
3620
CheckConstraints(type.TypeParameters(1),
TypeParameterConstraintKind
.None, "T")
3621
CheckConstraints(type.TypeParameters(2),
TypeParameterConstraintKind
.None, "A", "B")
3624
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "T")
3625
CheckConstraints(method.TypeParameters(1),
TypeParameterConstraintKind
.None, "B", "A")
3741
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("O1").TypeParameters(0),
TypeParameterConstraintKind
.None)
3742
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("O2").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
3743
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("V1").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3744
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("V2").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3745
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("V3").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3746
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("V4").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3747
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("V5").TypeParameters(0),
TypeParameterConstraintKind
.None, "ValueType")
3748
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("R1").TypeParameters(0),
TypeParameterConstraintKind
.None, "A")
3749
CheckConstraints([namespace].GetMember(Of NamedTypeSymbol)("R2").TypeParameters(0),
TypeParameterConstraintKind
.ReferenceType, "A")
3790
CheckConstraints(type.GetMember(Of MethodSymbol)("M1").TypeParameters(0),
TypeParameterConstraintKind
.None)
3791
CheckConstraints(type.GetMember(Of MethodSymbol)("M2").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3793
CheckConstraints(type.GetMember(Of MethodSymbol)("M1").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
3794
CheckConstraints(type.GetMember(Of MethodSymbol)("M2").TypeParameters(0),
TypeParameterConstraintKind
.ValueType, "Object")
3796
CheckConstraints(type.GetMember(Of MethodSymbol)("M1").TypeParameters(0),
TypeParameterConstraintKind
.None, "ValueType")
3797
CheckConstraints(type.GetMember(Of MethodSymbol)("M2").TypeParameters(0),
TypeParameterConstraintKind
.ValueType)
3993
CheckConstraints(type.Interfaces(0).GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
3995
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None)
3997
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
3999
CheckConstraints(type.Interfaces(0).GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4001
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4003
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None)
4005
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4007
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4009
CheckConstraints(type.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4011
CheckConstraints(type.BaseType.GetMember(Of MethodSymbol)("M").TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4393
CheckConstraints(type.TypeParameters(0),
TypeParameterConstraintKind
.None)
4395
CheckConstraints(type.TypeParameters(0),
TypeParameterConstraintKind
.None, "C")
4397
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "Object")
4399
CheckConstraints(method.TypeParameters(0),
TypeParameterConstraintKind
.None, "C")
5553
Private Shared Sub CheckConstraints(typeParameter As TypeParameterSymbol, constraints As
TypeParameterConstraintKind
, ParamArray constraintTypeDescriptions As String())
5554
Assert.Equal((constraints And
TypeParameterConstraintKind
.Constructor) <> 0, typeParameter.HasConstructorConstraint)
5555
Assert.Equal((constraints And
TypeParameterConstraintKind
.ReferenceType) <> 0, typeParameter.HasReferenceTypeConstraint)
5556
Assert.Equal((constraints And
TypeParameterConstraintKind
.ValueType) <> 0, typeParameter.HasValueTypeConstraint)