diff --git a/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj b/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj
index d38c84664a0098de3257da90517667208a123a16..a5021d6b0bd3d22440a89c4f06126fe741134d7b 100644
--- a/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj
+++ b/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj
@@ -813,6 +813,13 @@
+
+
+
+
+
+
+
@@ -824,6 +831,7 @@
+
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/EventSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/EventSymbol.vb
index db68a7e07867c7f676ed24a058975e51f5ea1064..4229ed41e5f74c0cd8047a4135341ff5e65b49be 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/EventSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/EventSymbol.vb
@@ -255,6 +255,25 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ '''
+ ''' Is this an event of a tuple type?
+ '''
+ Public Overridable ReadOnly Property IsTupleEvent() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ '''
+ ''' If this is an event of a tuple type, return corresponding underlying event from the
+ ''' tuple underlying type. Otherwise, Nothing.
+ '''
+ Public Overridable ReadOnly Property TupleUnderlyingEvent() As EventSymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
Private ReadOnly Property IEventSymbol_Type As ITypeSymbol Implements IEventSymbol.Type
Get
Return Me.Type
@@ -313,7 +332,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Return visitor.VisitEvent(Me)
End Function
- Public NotOverridable Overrides Function Equals(obj As Object) As Boolean
+ Public Overrides Function Equals(obj As Object) As Boolean
Dim other As EventSymbol = TryCast(obj, EventSymbol)
If Nothing Is other Then
Return False
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb
index fb181c68caeb1c26cebd8040f8d28eb7d34e608f..ab72f4e4c92076bb4f98bc166a11dbce56794123 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb
@@ -326,6 +326,26 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ '''
+ ''' Is this a field of a tuple type?
+ '''
+ Public Overridable ReadOnly Property IsTupleField() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ '''
+ ''' If this is a field of a tuple type, return corresponding underlying field from the
+ ''' tuple underlying type. Otherwise, null. In case of a malformed underlying type
+ ''' the corresponding underlying field might be missing, return null in this case too.
+ '''
+ Public Overridable ReadOnly Property TupleUnderlyingField() As FieldSymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
Friend Function AsMember(newOwner As NamedTypeSymbol) As FieldSymbol
Debug.Assert(Me Is Me.OriginalDefinition)
Debug.Assert(newOwner.OriginalDefinition Is Me.ContainingSymbol.OriginalDefinition)
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/MethodSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/MethodSymbol.vb
index 03745051ee6d40ddc6b9dbcb4ab8b679de6711ae..b9973eb11792047e47b334ed84f9d8386a5bed03 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/MethodSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/MethodSymbol.vb
@@ -781,6 +781,25 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ '''
+ ''' Is this a method of a tuple type?
+ '''
+ Public Overridable ReadOnly Property IsTupleMethod() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ '''
+ ''' If this is a method of a tuple type, return corresponding underlying method from the
+ ''' tuple underlying type. Otherwise, Nothing.
+ '''
+ Public Overridable ReadOnly Property TupleUnderlyingMethod() As MethodSymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
#Region "IMethodSymbol"
Private ReadOnly Property IMethodSymbol_Arity As Integer Implements IMethodSymbol.Arity
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/NamedTypeSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/NamedTypeSymbol.vb
index 03fbd0f8af50d70974819c3a10f3e509a10c76ef..073431981035b72df1c833bfa794f7891466c1eb 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/NamedTypeSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/NamedTypeSymbol.vb
@@ -1201,21 +1201,21 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
- Public ReadOnly Property TupleElementTypes As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TupleElementTypes
+ Private ReadOnly Property INamedTypeSymbol_TupleElementTypes As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TupleElementTypes
Get
- Return Nothing
+ Return StaticCast(Of ITypeSymbol).From(TupleElementTypes())
End Get
End Property
- Public ReadOnly Property TupleElementNames As ImmutableArray(Of String) Implements INamedTypeSymbol.TupleElementNames
+ Public ReadOnly Property INamedTypeSymbol_TupleElementNames As ImmutableArray(Of String) Implements INamedTypeSymbol.TupleElementNames
Get
- Return Nothing
+ Return TupleElementNames
End Get
End Property
- Public ReadOnly Property TupleUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.TupleUnderlyingType
+ Public ReadOnly Property INamedTypeSymbol_TupleUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.TupleUnderlyingType
Get
- Return Nothing
+ Return TupleUnderlyingType
End Get
End Property
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb
index 0463133340ef272c018b84349842d6f6a3ca314f..e3134190421fc7cc3eb4f6ec5131400a5c2a6ba2 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb
@@ -408,6 +408,26 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ '''
+ ''' Is this a property of a tuple type?
+ '''
+ Public Overridable ReadOnly Property IsTupleProperty() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+
+ '''
+ ''' If this is a property of a tuple type, return corresponding underlying property from the
+ ''' tuple underlying type. Otherwise, Nothing.
+ '''
+ Public Overridable ReadOnly Property TupleUnderlyingProperty() As PropertySymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
'''
''' Clone the property parameters for the accessor method. The
''' parameters are cloned (rather than referenced from the property)
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleErrorFieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleErrorFieldSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..d10618e79e2d694336165c0a061c4161a5022207
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleErrorFieldSymbol.vb
@@ -0,0 +1,100 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+Imports Microsoft.CodeAnalysis
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents a field of a tuple type (such as (int, byte).Item1)
+ ''' that doesn't have a corresponding backing field within the tuple underlying type.
+ ''' Created in response to an error condition.
+ '''
+ Friend Class TupleErrorFieldSymbol
+ Inherits SynthesizedFieldSymbol
+
+ '''
+ ''' If this field represents a tuple element (including the name match),
+ ''' id is an index of the element (zero-based).
+ ''' Otherwise, (-1 - [index in members array]);
+ '''
+ Private _tupleFieldId As Integer
+
+ Private _locations As ImmutableArray(Of Location)
+
+ Private _useSiteDiagnosticInfo As DiagnosticInfo
+
+ Public Overrides ReadOnly Property IsTupleField() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ '''
+ ''' If this field represents a tuple element (including the name match),
+ ''' id is an index of the element (zero-based).
+ ''' Otherwise, (-1 - [index in members array]);
+ '''
+ Public ReadOnly Property TupleFieldId() As Integer
+ Get
+ Return Me._tupleFieldId
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingField() As FieldSymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Locations() As ImmutableArray(Of Location)
+ Get
+ Return Me._locations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaringSyntaxReferences() As ImmutableArray(Of SyntaxReference)
+ Get
+ Return Symbol.GetDeclaringSyntaxReferenceHelper(Of VisualBasicSyntaxNode)(Me._locations)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsImplicitlyDeclared() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public Sub New(container As NamedTypeSymbol, name As String, tupleFieldId As Integer, location As Location, type As TypeSymbol, useSiteDiagnosticInfo As DiagnosticInfo)
+ MyBase.New(container, container, type, name)
+ Debug.Assert(name <> Nothing)
+ Me._locations = (If((location Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(location)))
+ Me._useSiteDiagnosticInfo = useSiteDiagnosticInfo
+ Me._tupleFieldId = tupleFieldId
+ End Sub
+
+ Public Overrides ReadOnly Property Type As TypeSymbol
+ Get
+ Return Me._type
+ End Get
+ End Property
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Return Me._useSiteDiagnosticInfo
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Hash.Combine(Me.ContainingType.GetHashCode(), Me._tupleFieldId.GetHashCode())
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TupleErrorFieldSymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TupleErrorFieldSymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._tupleFieldId = other._tupleFieldId AndAlso Me.ContainingType Is other.ContainingType)
+ End Function
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleEventSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleEventSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..7c2edf22f4c2a5f0255ccf53e624f27b6d2e3791
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleEventSymbol.vb
@@ -0,0 +1,106 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+Imports Microsoft.CodeAnalysis
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents an event of a tuple type (such as (int, byte).SomeEvent)
+ ''' that is backed by an event within the tuple underlying type.
+ '''
+ Friend Class TupleEventSymbol
+ Inherits WrappedEventSymbol
+
+ Private _containingType As TupleTypeSymbol
+
+ Public Overrides ReadOnly Property IsTupleEvent() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingEvent() As EventSymbol
+ Get
+ Return Me._underlyingEvent
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._containingType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Type() As TypeSymbol
+ Get
+ Return Me._underlyingEvent.Type
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property AddMethod() As MethodSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of MethodSymbol)(Me._underlyingEvent.AddMethod)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property RemoveMethod() As MethodSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of MethodSymbol)(Me._underlyingEvent.RemoveMethod)
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property AssociatedField() As FieldSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of FieldSymbol)(Me._underlyingEvent.AssociatedField)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property RaiseMethod As MethodSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of MethodSymbol)(Me._underlyingEvent.RaiseMethod)
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsExplicitInterfaceImplementation() As Boolean
+ Get
+ Return Me._underlyingEvent.IsExplicitInterfaceImplementation
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ExplicitInterfaceImplementations() As ImmutableArray(Of EventSymbol)
+ Get
+ Return Me._underlyingEvent.ExplicitInterfaceImplementations
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingEvent As EventSymbol)
+ MyBase.New(underlyingEvent)
+ Me._containingType = container
+ End Sub
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Dim useSiteDiagnostic As DiagnosticInfo = MyBase.GetUseSiteErrorInfo
+ MyBase.MergeUseSiteErrorInfo(useSiteDiagnostic, Me._underlyingEvent.GetUseSiteErrorInfo())
+ Return useSiteDiagnostic
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Me._underlyingEvent.GetHashCode()
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TupleEventSymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TupleEventSymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._containingType Is other._containingType AndAlso Me._underlyingEvent Is other._underlyingEvent)
+ End Function
+
+ Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingEvent.GetAttributes()
+ End Function
+ End Class
+End Namespace
\ No newline at end of file
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleFieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleFieldSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..82d1fe05f1eb098a6c9aea17e4c91b3815b24fdf
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleFieldSymbol.vb
@@ -0,0 +1,185 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+Imports Microsoft.CodeAnalysis
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents a non-element field of a tuple type (such as (int, byte).Rest)
+ ''' that is backed by a real field within the tuple underlying type.
+ '''
+ Friend Class TupleFieldSymbol
+ Inherits WrappedFieldSymbol
+
+ Protected _containingTuple As TupleTypeSymbol
+
+ Private _tupleFieldId As Integer
+
+ Public Overrides ReadOnly Property IsTupleField() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingField() As FieldSymbol
+ Get
+ Return Me._underlyingField
+ End Get
+ End Property
+
+ Public ReadOnly Property TupleFieldId() As Integer
+ Get
+ Return Me._tupleFieldId
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property AssociatedSymbol() As Symbol
+ Get
+ Return Me._containingTuple.GetTupleMemberSymbolForUnderlyingMember(Of Symbol)(Me._underlyingField.AssociatedSymbol)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._containingTuple
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property CustomModifiers() As ImmutableArray(Of CustomModifier)
+ Get
+ Return Me._underlyingField.CustomModifiers
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Type As TypeSymbol
+ Get
+ Return Me._underlyingField.Type
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingField As FieldSymbol, tupleFieldId As Integer)
+ MyBase.New(underlyingField)
+ Me._containingTuple = container
+ Me._tupleFieldId = tupleFieldId
+ End Sub
+
+ Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingField.GetAttributes()
+ End Function
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Dim useSiteDiagnostic As DiagnosticInfo = MyBase.GetUseSiteErrorInfo
+ MyBase.MergeUseSiteErrorInfo(useSiteDiagnostic, Me._underlyingField.GetUseSiteErrorInfo())
+ Return useSiteDiagnostic
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Hash.Combine(Me._containingTuple.GetHashCode(), Me._tupleFieldId.GetHashCode())
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TupleFieldSymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TupleFieldSymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._tupleFieldId = other._tupleFieldId AndAlso Me._containingTuple Is other._containingTuple)
+ End Function
+ End Class
+
+ '''
+ ''' Represents an element field of a tuple type (such as (int, byte).Item1)
+ ''' that is backed by a real field with the same name within the tuple underlying type.
+ '''
+ Friend Class TupleElementFieldSymbol
+ Inherits TupleFieldSymbol
+
+ Private _locations As ImmutableArray(Of Location)
+
+ Public Overrides ReadOnly Property Locations() As ImmutableArray(Of Location)
+ Get
+ Return Me._locations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaringSyntaxReferences() As ImmutableArray(Of SyntaxReference)
+ Get
+ Return Symbol.GetDeclaringSyntaxReferenceHelper(Of VisualBasicSyntaxNode)(Me._locations)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsImplicitlyDeclared() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property TypeLayoutOffset() As Integer?
+ Get
+ Dim flag As Boolean = Me._underlyingField.ContainingType IsNot Me._containingTuple.TupleUnderlyingType
+ Dim result As Integer?
+ If flag Then
+ result = Nothing
+ Else
+ result = MyBase.TypeLayoutOffset
+ End If
+ Return result
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property AssociatedSymbol() As Symbol
+ Get
+ Dim flag As Boolean = Me._underlyingField.ContainingType IsNot Me._containingTuple.TupleUnderlyingType
+ Dim result As Symbol
+ If flag Then
+ result = Nothing
+ Else
+ result = MyBase.AssociatedSymbol
+ End If
+ Return result
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingField As FieldSymbol, tupleFieldId As Integer, location As Location)
+ MyBase.New(container, underlyingField, tupleFieldId)
+ Me._locations = (If((location Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(location)))
+ End Sub
+ End Class
+
+ '''
+ ''' Represents an element field of a tuple type (such as (int a, byte b).a, or (int a, byte b).b)
+ ''' that is backed by a real field with a different name within the tuple underlying type.
+ '''
+ Friend Class TupleRenamedElementFieldSymbol
+ Inherits TupleElementFieldSymbol
+
+ Private _name As String
+
+ Public Overrides ReadOnly Property Name() As String
+ Get
+ Return Me._name
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property TypeLayoutOffset() As Integer?
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property AssociatedSymbol() As Symbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingField As FieldSymbol, name As String, tupleElementOrdinal As Integer, location As Location)
+ MyBase.New(container, underlyingField, tupleElementOrdinal, location)
+ Debug.Assert(name <> Nothing)
+ Debug.Assert(name <> underlyingField.Name)
+ Me._name = name
+ End Sub
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleMethodSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleMethodSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..2cd2306c0bfcf0ef2e549e6ddd2975da81f363ea
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleMethodSymbol.vb
@@ -0,0 +1,151 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+Imports Microsoft.CodeAnalysis
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents a method of a tuple type (such as (int, byte).ToString())
+ ''' that is backed by a method within the tuple underlying type.
+ '''
+ Friend Class TupleMethodSymbol
+ Inherits WrappedMethodSymbol
+
+ Private _containingType As TupleTypeSymbol
+
+ Private _underlyingMethod As MethodSymbol
+
+ Private _typeParameters As ImmutableArray(Of TypeParameterSymbol)
+
+ Private _lazyParameters As ImmutableArray(Of ParameterSymbol)
+
+ Public Overrides ReadOnly Property IsTupleMethod() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingMethod() As MethodSymbol
+ Get
+ Return Me._underlyingMethod.ConstructedFrom
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property UnderlyingMethod() As MethodSymbol
+ Get
+ Return Me._underlyingMethod
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property AssociatedSymbol() As Symbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of Symbol)(Me._underlyingMethod.ConstructedFrom.AssociatedSymbol)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._containingType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ExplicitInterfaceImplementations() As ImmutableArray(Of MethodSymbol)
+ Get
+ Return Me._underlyingMethod.ConstructedFrom.ExplicitInterfaceImplementations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Parameters() As ImmutableArray(Of ParameterSymbol)
+ Get
+ Dim isDefault As Boolean = Me._lazyParameters.IsDefault
+ If isDefault Then
+ InterlockedOperations.Initialize(Of ParameterSymbol)(Me._lazyParameters, Me.CreateParameters())
+ End If
+ Return Me._lazyParameters
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsSub() As Boolean
+ Get
+ Return Me._underlyingMethod.IsSub
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ReturnType() As TypeSymbol
+ Get
+ Return Me._underlyingMethod.ReturnType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ReturnTypeCustomModifiers() As ImmutableArray(Of CustomModifier)
+ Get
+ Return Me._underlyingMethod.ReturnTypeCustomModifiers
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TypeArguments() As ImmutableArray(Of TypeSymbol)
+ Get
+ Return StaticCast(Of TypeSymbol).From(Me._typeParameters)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TypeParameters() As ImmutableArray(Of TypeParameterSymbol)
+ Get
+ Return Me._typeParameters
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingMethod As MethodSymbol)
+ Debug.Assert(underlyingMethod.ConstructedFrom Is underlyingMethod)
+ Me._containingType = container
+ Me._underlyingMethod = underlyingMethod
+
+ ' PROTOTYPE: tuples Should alpha rename typeparameters in case a tuple method has any.
+ Me._typeParameters = Me._underlyingMethod.TypeParameters
+ End Sub
+
+ Private Function CreateParameters() As ImmutableArray(Of ParameterSymbol)
+ Dim parameters As ImmutableArray(Of ParameterSymbol) = Me._underlyingMethod.Parameters
+ Dim instance As ArrayBuilder(Of ParameterSymbol) = ArrayBuilder(Of ParameterSymbol).GetInstance(parameters.Length)
+ Dim enumerator As ImmutableArray(Of ParameterSymbol).Enumerator = parameters.GetEnumerator()
+ While enumerator.MoveNext()
+ Dim current As ParameterSymbol = enumerator.Current
+ instance.Add(New TupleParameterSymbol(Me, current))
+ End While
+ Return instance.ToImmutableAndFree()
+ End Function
+
+ Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingMethod.GetAttributes()
+ End Function
+
+ Public Overrides Function GetReturnTypeAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingMethod.GetReturnTypeAttributes()
+ End Function
+
+ Friend Overrides Function CalculateLocalSyntaxOffset(localPosition As Integer, localTree As SyntaxTree) As Integer
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Dim useSiteDiagnostic As DiagnosticInfo = MyBase.GetUseSiteErrorInfo()
+ MyBase.MergeUseSiteErrorInfo(useSiteDiagnostic, Me._underlyingMethod.GetUseSiteErrorInfo())
+ Return useSiteDiagnostic
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Me._underlyingMethod.ConstructedFrom.GetHashCode()
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TupleMethodSymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TupleMethodSymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._containingType Is other._containingType AndAlso Me._underlyingMethod.ConstructedFrom Is other._underlyingMethod.ConstructedFrom)
+ End Function
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleParameterSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleParameterSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..fc23ff0d2ba4cfa2deb0cf900e1a1193a1578ada
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleParameterSymbol.vb
@@ -0,0 +1,42 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents a parameter of a method or a property of a tuple type
+ '''
+ Friend Class TupleParameterSymbol
+ Inherits WrappedParameterSymbol
+
+ Private _container As Symbol
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._container
+ End Get
+ End Property
+
+ Public Sub New(container As Symbol, underlyingParameter As ParameterSymbol)
+ MyBase.New(underlyingParameter)
+
+ Debug.Assert(container IsNot Nothing)
+ Me._container = container
+ End Sub
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Me._underlyingParameter.GetHashCode()
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TupleParameterSymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TupleParameterSymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._container Is other._container AndAlso Me._underlyingParameter Is other._underlyingParameter)
+ End Function
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TuplePropertySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TuplePropertySymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..a3054de6d1a038c3937fb5d588e292d2ae44532f
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TuplePropertySymbol.vb
@@ -0,0 +1,135 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+Imports Microsoft.CodeAnalysis
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents a property of a tuple type (such as (int, byte).SomeProperty)
+ ''' that is backed by a property within the tuple underlying type.
+ '''
+ Friend NotInheritable Class TuplePropertySymbol
+ Inherits WrappedPropertySymbol
+
+ Private _containingType As TupleTypeSymbol
+
+ Private _lazyParameters As ImmutableArray(Of ParameterSymbol)
+
+ Public Overrides ReadOnly Property IsTupleProperty() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingProperty() As PropertySymbol
+ Get
+ Return Me._underlyingProperty
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Type() As TypeSymbol
+ Get
+ Return Me._underlyingProperty.Type
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TypeCustomModifiers() As ImmutableArray(Of CustomModifier)
+ Get
+ Return Me._underlyingProperty.TypeCustomModifiers
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Parameters() As ImmutableArray(Of ParameterSymbol)
+ Get
+ Dim isDefault As Boolean = Me._lazyParameters.IsDefault
+ If isDefault Then
+ InterlockedOperations.Initialize(Of ParameterSymbol)(Me._lazyParameters, Me.CreateParameters())
+ End If
+ Return Me._lazyParameters
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property GetMethod() As MethodSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of MethodSymbol)(Me._underlyingProperty.GetMethod)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property SetMethod() As MethodSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of MethodSymbol)(Me._underlyingProperty.SetMethod)
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property AssociatedField As FieldSymbol
+ Get
+ Return Me._containingType.GetTupleMemberSymbolForUnderlyingMember(Of FieldSymbol)(Me._underlyingProperty.AssociatedField)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ExplicitInterfaceImplementations() As ImmutableArray(Of PropertySymbol)
+ Get
+ Return Me._underlyingProperty.ExplicitInterfaceImplementations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._containingType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOverloads As Boolean
+ Get
+ Return Me._underlyingProperty.IsOverloads
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsMyGroupCollectionProperty As Boolean
+ Get
+ Return Me._underlyingProperty.IsMyGroupCollectionProperty
+ End Get
+ End Property
+
+ Public Sub New(container As TupleTypeSymbol, underlyingProperty As PropertySymbol)
+ MyBase.New(underlyingProperty)
+ Me._containingType = container
+ End Sub
+
+ Private Function CreateParameters() As ImmutableArray(Of ParameterSymbol)
+ Dim parameters As ImmutableArray(Of ParameterSymbol) = Me._underlyingProperty.Parameters
+ Dim instance As ArrayBuilder(Of ParameterSymbol) = ArrayBuilder(Of ParameterSymbol).GetInstance(parameters.Length)
+ Dim enumerator As ImmutableArray(Of ParameterSymbol).Enumerator = parameters.GetEnumerator()
+ While enumerator.MoveNext()
+ Dim current As ParameterSymbol = enumerator.Current
+ instance.Add(New TupleParameterSymbol(Me, current))
+ End While
+ Return instance.ToImmutableAndFree()
+ End Function
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Dim useSiteDiagnostic As DiagnosticInfo = MyBase.GetUseSiteErrorInfo
+ MyBase.MergeUseSiteErrorInfo(useSiteDiagnostic, Me._underlyingProperty.GetUseSiteErrorInfo())
+ Return useSiteDiagnostic
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Me._underlyingProperty.GetHashCode()
+ End Function
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return Me.Equals(TryCast(obj, TuplePropertySymbol))
+ End Function
+
+ Public Overloads Function Equals(other As TuplePropertySymbol) As Boolean
+ Dim flag As Boolean = other Is Me
+ Return flag OrElse (other IsNot Nothing AndAlso Me._containingType Is other._containingType AndAlso Me._underlyingProperty Is other._underlyingProperty)
+ End Function
+
+ Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingProperty.GetAttributes()
+ End Function
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleTypeSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleTypeSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..c2f272f057d13d9566397eca791464004e23d42d
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleTypeSymbol.vb
@@ -0,0 +1,980 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Runtime.InteropServices
+Imports System.Threading
+Imports Microsoft.CodeAnalysis.Collections
+Imports Microsoft.CodeAnalysis.RuntimeMembers
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ Friend Class TupleTypeSymbol
+ Inherits WrappedNamedTypeSymbol
+
+ Private _locations As ImmutableArray(Of Location)
+
+ Private _elementLocations As ImmutableArray(Of Location)
+
+ Private _elementNames As ImmutableArray(Of String)
+
+ Private _elementTypes As ImmutableArray(Of TypeSymbol)
+
+ Private _lazyMembers As ImmutableArray(Of Symbol)
+
+ Private _lazyFields As ImmutableArray(Of FieldSymbol)
+
+ Private _lazyUnderlyingDefinitionToMemberMap As SmallDictionary(Of Symbol, Symbol)
+
+ Friend Const RestPosition As Integer = 8
+
+ Friend Const TupleTypeName As String = "ValueTuple"
+
+ Private Shared tupleTypes As WellKnownType() = New WellKnownType() {WellKnownType.System_ValueTuple_T1, WellKnownType.System_ValueTuple_T2, WellKnownType.System_ValueTuple_T3, WellKnownType.System_ValueTuple_T4, WellKnownType.System_ValueTuple_T5, WellKnownType.System_ValueTuple_T6, WellKnownType.System_ValueTuple_T7, WellKnownType.System_ValueTuple_TRest}
+
+ Private Shared tupleCtors As WellKnownMember() = New WellKnownMember() {WellKnownMember.System_ValueTuple_T1__ctor, WellKnownMember.System_ValueTuple_T2__ctor, WellKnownMember.System_ValueTuple_T3__ctor, WellKnownMember.System_ValueTuple_T4__ctor, WellKnownMember.System_ValueTuple_T5__ctor, WellKnownMember.System_ValueTuple_T6__ctor, WellKnownMember.System_ValueTuple_T7__ctor, WellKnownMember.System_ValueTuple_TRest__ctor}
+
+ Private Shared tupleMembers As WellKnownMember()() = New WellKnownMember()() {
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T1__Item1},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T2__Item1, WellKnownMember.System_ValueTuple_T2__Item2},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T3__Item1, WellKnownMember.System_ValueTuple_T3__Item2, WellKnownMember.System_ValueTuple_T3__Item3},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T4__Item1, WellKnownMember.System_ValueTuple_T4__Item2, WellKnownMember.System_ValueTuple_T4__Item3, WellKnownMember.System_ValueTuple_T4__Item4},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T5__Item1, WellKnownMember.System_ValueTuple_T5__Item2, WellKnownMember.System_ValueTuple_T5__Item3, WellKnownMember.System_ValueTuple_T5__Item4, WellKnownMember.System_ValueTuple_T5__Item5},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T6__Item1, WellKnownMember.System_ValueTuple_T6__Item2, WellKnownMember.System_ValueTuple_T6__Item3, WellKnownMember.System_ValueTuple_T6__Item4, WellKnownMember.System_ValueTuple_T6__Item5, WellKnownMember.System_ValueTuple_T6__Item6},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_T7__Item1, WellKnownMember.System_ValueTuple_T7__Item2, WellKnownMember.System_ValueTuple_T7__Item3, WellKnownMember.System_ValueTuple_T7__Item4, WellKnownMember.System_ValueTuple_T7__Item5, WellKnownMember.System_ValueTuple_T7__Item6, WellKnownMember.System_ValueTuple_T7__Item7},
+ New WellKnownMember() {WellKnownMember.System_ValueTuple_TRest__Item1, WellKnownMember.System_ValueTuple_TRest__Item2, WellKnownMember.System_ValueTuple_TRest__Item3, WellKnownMember.System_ValueTuple_TRest__Item4, WellKnownMember.System_ValueTuple_TRest__Item5, WellKnownMember.System_ValueTuple_TRest__Item6, WellKnownMember.System_ValueTuple_TRest__Item7, WellKnownMember.System_ValueTuple_TRest__Rest}}
+
+ Public Overrides ReadOnly Property IsTupleType() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleUnderlyingType() As NamedTypeSymbol
+ Get
+ Return Me._underlyingType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleElementTypes() As ImmutableArray(Of TypeSymbol)
+ Get
+ Return Me._elementTypes
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TupleElementNames() As ImmutableArray(Of String)
+ Get
+ Return Me._elementNames
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsReferenceType() As Boolean
+ Get
+ Return Not Me._underlyingType.IsErrorType() AndAlso Me._underlyingType.IsReferenceType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsValueType() As Boolean
+ Get
+ Return Me._underlyingType.IsValueType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsImplicitlyDeclared() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public ReadOnly Property TupleElementFields() As ImmutableArray(Of FieldSymbol)
+ Get
+ Dim isDefault As Boolean = Me._lazyFields.IsDefault
+ If isDefault Then
+ ImmutableInterlocked.InterlockedInitialize(Of FieldSymbol)(Me._lazyFields, Me.CollectTupleElementFields())
+ End If
+ Return Me._lazyFields
+ End Get
+ End Property
+
+ Friend ReadOnly Property UnderlyingDefinitionToMemberMap() As SmallDictionary(Of Symbol, Symbol)
+ Get
+ If Me._lazyUnderlyingDefinitionToMemberMap Is Nothing Then
+ Me._lazyUnderlyingDefinitionToMemberMap = Me.ComputeDefinitionToMemberMap()
+ End If
+ Return Me._lazyUnderlyingDefinitionToMemberMap
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property EnumUnderlyingType() As NamedTypeSymbol
+ Get
+ Return Me._underlyingType.EnumUnderlyingType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Kind() As SymbolKind
+ Get
+ Return SymbolKind.NamedType
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TypeKind() As TypeKind
+ Get
+ Return If((Me._underlyingType.TypeKind = TypeKind.[Class]), TypeKind.[Class], TypeKind.Struct)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ContainingSymbol() As Symbol
+ Get
+ Return Me._underlyingType.ContainingSymbol
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Locations() As ImmutableArray(Of Location)
+ Get
+ Return Me._locations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaringSyntaxReferences() As ImmutableArray(Of SyntaxReference)
+ Get
+ Return Symbol.GetDeclaringSyntaxReferenceHelper(Of VisualBasicSyntaxNode)(Me._locations)
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaredAccessibility() As Accessibility
+ Get
+ Dim result As Accessibility
+ If Me._underlyingType.IsErrorType() Then
+ result = Accessibility.[Public]
+ Else
+ result = Me._underlyingType.DeclaredAccessibility
+ End If
+ Return result
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsMustInherit() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsNotInheritable() As Boolean
+ Get
+ Return True
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Arity() As Integer
+ Get
+ Return 0
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property TypeParameters() As ImmutableArray(Of TypeParameterSymbol)
+ Get
+ Return ImmutableArray(Of TypeParameterSymbol).Empty
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property TypeArgumentsCustomModifiers() As ImmutableArray(Of ImmutableArray(Of CustomModifier))
+ Get
+ Return ImmutableArray(Of ImmutableArray(Of CustomModifier)).Empty
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasTypeArgumentsCustomModifiers() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property TypeArgumentsNoUseSiteDiagnostics() As ImmutableArray(Of TypeSymbol)
+ Get
+ Return ImmutableArray(Of TypeSymbol).Empty
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property ConstructedFrom() As NamedTypeSymbol
+ Get
+ Return Me
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property MightContainExtensionMethods() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Name() As String
+ Get
+ Return String.Empty
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property MangleName() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Iterator Property MemberNames() As IEnumerable(Of String)
+ Get
+ Dim [set] = PooledHashSet(Of String).GetInstance()
+ For Each member In GetMembers()
+ Dim name = member.Name
+ If [set].Add(name) Then
+ Yield name
+ End If
+ Next
+
+ [set].Free()
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasSpecialName() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsComImport() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsWindowsRuntimeImport() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property ShouldAddWinRTMembers() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsSerializable() As Boolean
+ Get
+ Return Me._underlyingType.IsSerializable
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property Layout() As TypeLayout
+ Get
+ Return Me._underlyingType.Layout
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property MarshallingCharSet() As CharSet
+ Get
+ Return Me._underlyingType.MarshallingCharSet
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasDeclarativeSecurity() As Boolean
+ Get
+ Return Me._underlyingType.HasDeclarativeSecurity
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsInterface() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property IsExtensibleInterfaceNoUseSiteDiagnostics As Boolean
+ Get
+ Return Me._underlyingType.IsExtensibleInterfaceNoUseSiteDiagnostics
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property CanConstruct As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property TypeSubstitution As TypeSubstitution
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Private Sub New(locationOpt As Location, underlyingType As NamedTypeSymbol, elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String), elementTypes As ImmutableArray(Of TypeSymbol))
+ Me.New(If((locationOpt Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(locationOpt)), underlyingType, elementLocations, elementNames, elementTypes)
+ End Sub
+
+ Private Sub New(locations As ImmutableArray(Of Location), underlyingType As NamedTypeSymbol, elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String), elementTypes As ImmutableArray(Of TypeSymbol))
+ MyBase.New(underlyingType)
+ Debug.Assert(elementLocations.IsDefault OrElse elementNames.IsDefault OrElse elementLocations.Length = elementNames.Length)
+ Debug.Assert(elementLocations.IsDefault OrElse elementLocations.Length = elementTypes.Length)
+ Debug.Assert(elementNames.IsDefault OrElse elementNames.Length = elementTypes.Length)
+ Debug.Assert(Not underlyingType.IsTupleType)
+ Me._elementLocations = elementLocations
+ Me._elementNames = elementNames
+ Me._elementTypes = elementTypes
+ Me._locations = locations
+ End Sub
+
+ Friend Shared Function Create(locationOpt As Location, elementTypes As ImmutableArray(Of TypeSymbol), elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String), compilation As VisualBasicCompilation, Optional syntax As VisualBasicSyntaxNode = Nothing, Optional diagnostics As DiagnosticBag = Nothing) As NamedTypeSymbol
+ Debug.Assert(elementNames.IsDefault OrElse elementTypes.Length = elementNames.Length)
+ Dim length As Integer = elementTypes.Length
+
+ If length <= 1 Then
+ Throw ExceptionUtilities.Unreachable
+ End If
+
+ Dim tupleUnderlyingType As NamedTypeSymbol = TupleTypeSymbol.GetTupleUnderlyingType(elementTypes, syntax, compilation, diagnostics)
+ Return TupleTypeSymbol.Create(locationOpt, tupleUnderlyingType, elementLocations, elementNames)
+ End Function
+
+ Public Shared Function Create(tupleCompatibleType As NamedTypeSymbol) As TupleTypeSymbol
+ Return TupleTypeSymbol.Create(ImmutableArray(Of Location).Empty, tupleCompatibleType, Nothing, Nothing)
+ End Function
+
+ Public Shared Function Create(locationOpt As Location, tupleCompatibleType As NamedTypeSymbol, elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String)) As TupleTypeSymbol
+ Return TupleTypeSymbol.Create(If((locationOpt Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(locationOpt)), tupleCompatibleType, elementLocations, elementNames)
+ End Function
+
+ Public Shared Function Create(locations As ImmutableArray(Of Location), tupleCompatibleType As NamedTypeSymbol, elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String)) As TupleTypeSymbol
+ Debug.Assert(tupleCompatibleType.IsTupleCompatible())
+
+ Dim elementTypes As ImmutableArray(Of TypeSymbol)
+ If tupleCompatibleType.Arity = TupleTypeSymbol.RestPosition Then
+ tupleCompatibleType = TupleTypeSymbol.EnsureRestExtensionsAreTuples(tupleCompatibleType)
+ Dim tupleElementTypes As ImmutableArray(Of TypeSymbol) = tupleCompatibleType.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1).TupleElementTypes
+ Dim instance As ArrayBuilder(Of TypeSymbol) = ArrayBuilder(Of TypeSymbol).GetInstance(TupleTypeSymbol.RestPosition - 1 + tupleElementTypes.Length)
+ instance.AddRange(tupleCompatibleType.TypeArgumentsNoUseSiteDiagnostics, TupleTypeSymbol.RestPosition - 1)
+ instance.AddRange(tupleElementTypes)
+ elementTypes = instance.ToImmutableAndFree()
+ Else
+ elementTypes = tupleCompatibleType.TypeArgumentsNoUseSiteDiagnostics
+ End If
+
+ Return New TupleTypeSymbol(locations, tupleCompatibleType, elementLocations, elementNames, elementTypes)
+ End Function
+
+ Private Shared Function EnsureRestExtensionsAreTuples(tupleCompatibleType As NamedTypeSymbol) As NamedTypeSymbol
+ If Not tupleCompatibleType.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1).IsTupleType Then
+ Dim nonTupleTypeChain As ArrayBuilder(Of NamedTypeSymbol) = ArrayBuilder(Of NamedTypeSymbol).GetInstance()
+ Dim namedTypeSymbol As NamedTypeSymbol = tupleCompatibleType
+
+ Do
+ nonTupleTypeChain.Add(namedTypeSymbol)
+ namedTypeSymbol = CType(namedTypeSymbol.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1), NamedTypeSymbol)
+ Loop While namedTypeSymbol.Arity = TupleTypeSymbol.RestPosition
+
+ If Not namedTypeSymbol.IsTupleType Then
+ nonTupleTypeChain.Add(namedTypeSymbol)
+ End If
+
+ Debug.Assert(nonTupleTypeChain.Count > 1)
+ tupleCompatibleType = nonTupleTypeChain.Pop()
+
+ Dim typeArgumentsBuilder As ArrayBuilder(Of TypeWithModifiers) = ArrayBuilder(Of TypeWithModifiers).GetInstance(TupleTypeSymbol.RestPosition)
+ Do
+ Dim extensionTuple As TupleTypeSymbol = TupleTypeSymbol.Create(CType(Nothing, Location), tupleCompatibleType, Nothing, Nothing)
+ tupleCompatibleType = nonTupleTypeChain.Pop()
+ tupleCompatibleType = TupleTypeSymbol.ReplaceRestExtensionType(tupleCompatibleType, typeArgumentsBuilder, extensionTuple)
+ Loop While nonTupleTypeChain.Count <> 0
+
+ typeArgumentsBuilder.Free()
+ nonTupleTypeChain.Free()
+ End If
+ Return tupleCompatibleType
+ End Function
+
+ Private Shared Function ReplaceRestExtensionType(tupleCompatibleType As NamedTypeSymbol, typeArgumentsBuilder As ArrayBuilder(Of TypeWithModifiers), extensionTuple As TupleTypeSymbol) As NamedTypeSymbol
+ Dim modifiers As ImmutableArray(Of ImmutableArray(Of CustomModifier)) = Nothing
+ Dim hasTypeArgumentsCustomModifiers As Boolean = tupleCompatibleType.HasTypeArgumentsCustomModifiers
+
+ If hasTypeArgumentsCustomModifiers Then
+ modifiers = tupleCompatibleType.TypeArgumentsCustomModifiers
+ End If
+
+ Dim typeArgumentsNoUseSiteDiagnostics As ImmutableArray(Of TypeSymbol) = tupleCompatibleType.TypeArgumentsNoUseSiteDiagnostics
+ typeArgumentsBuilder.Clear()
+
+ For i As Integer = 0 To TupleTypeSymbol.RestPosition - 1 - 1
+ If Not modifiers.IsDefault AndAlso Not modifiers(i).IsDefaultOrEmpty Then
+ typeArgumentsBuilder.Add(New TypeWithModifiers(typeArgumentsNoUseSiteDiagnostics(i), modifiers(i)))
+ Else
+ typeArgumentsBuilder.Add(New TypeWithModifiers(typeArgumentsNoUseSiteDiagnostics(i)))
+ End If
+ Next
+
+ If modifiers.IsDefault AndAlso Not modifiers(TupleTypeSymbol.RestPosition - 1).IsDefaultOrEmpty Then
+ typeArgumentsBuilder.Add(New TypeWithModifiers(extensionTuple, modifiers(TupleTypeSymbol.RestPosition - 1)))
+ Else
+ typeArgumentsBuilder.Add(New TypeWithModifiers(extensionTuple))
+ End If
+
+ Dim definition = tupleCompatibleType.ConstructedFrom
+ Dim subst = TypeSubstitution.Create(definition, definition.TypeParameters, typeArgumentsBuilder.ToImmutable(), False)
+ Return definition.Construct(subst)
+ End Function
+
+ Friend Function WithUnderlyingType(newUnderlyingType As NamedTypeSymbol) As TupleTypeSymbol
+ Debug.Assert(Not newUnderlyingType.IsTupleType AndAlso newUnderlyingType.IsTupleOrCompatibleWithTupleOfCardinality(Me._elementTypes.Length))
+ Return TupleTypeSymbol.Create(Me._locations, newUnderlyingType, Me._elementLocations, Me._elementNames)
+ End Function
+
+ Friend Function WithElementNames(newElementNames As ImmutableArray(Of String)) As TupleTypeSymbol
+ Debug.Assert(newElementNames.IsDefault OrElse Me._elementTypes.Length = newElementNames.Length)
+
+ If Me._elementNames.IsDefault Then
+ If newElementNames.IsDefault Then
+ Return Me
+ End If
+ Else
+ If Not newElementNames.IsDefault AndAlso Me._elementNames.SequenceEqual(newElementNames) Then
+ Return Me
+ End If
+ End If
+
+ Return New TupleTypeSymbol(CType(Nothing, Location), Me._underlyingType, Nothing, newElementNames, Me._elementTypes)
+ End Function
+
+ Friend Shared Sub GetUnderlyingTypeChain(underlyingTupleType As NamedTypeSymbol, underlyingTupleTypeChain As ArrayBuilder(Of NamedTypeSymbol))
+ Dim namedTypeSymbol As NamedTypeSymbol = underlyingTupleType
+ While True
+ underlyingTupleTypeChain.Add(namedTypeSymbol)
+
+ If namedTypeSymbol.Arity <> TupleTypeSymbol.RestPosition Then
+ Exit While
+ End If
+ namedTypeSymbol = namedTypeSymbol.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1).TupleUnderlyingType
+ End While
+ End Sub
+
+ Friend Shared Sub AddElementTypes(underlyingTupleType As NamedTypeSymbol, tupleElementTypes As ArrayBuilder(Of TypeSymbol))
+ Dim namedTypeSymbol As NamedTypeSymbol = underlyingTupleType
+ While True
+ Dim isTupleType As Boolean = namedTypeSymbol.IsTupleType
+ If isTupleType Then
+ Exit While
+ End If
+
+ Dim length As Integer = Math.Min(namedTypeSymbol.Arity, TupleTypeSymbol.RestPosition - 1)
+ tupleElementTypes.AddRange(namedTypeSymbol.TypeArgumentsNoUseSiteDiagnostics, length)
+ If namedTypeSymbol.Arity <> TupleTypeSymbol.RestPosition Then
+ Return
+ End If
+ namedTypeSymbol = CType(namedTypeSymbol.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1), NamedTypeSymbol)
+ End While
+ tupleElementTypes.AddRange(namedTypeSymbol.TupleElementTypes)
+ End Sub
+
+ Private Shared Function GetNestedTupleUnderlyingType(topLevelUnderlyingType As NamedTypeSymbol, depth As Integer) As NamedTypeSymbol
+ Dim namedTypeSymbol As NamedTypeSymbol = topLevelUnderlyingType
+ For i As Integer = 0 To depth - 1
+ namedTypeSymbol = namedTypeSymbol.TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1).TupleUnderlyingType
+ Next
+ Return namedTypeSymbol
+ End Function
+
+ Private Shared Function NumberOfValueTuples(numElements As Integer, ByRef remainder As Integer) As Integer
+ remainder = (numElements - 1) Mod TupleTypeSymbol.RestPosition - 1 + 1
+ Return (numElements - 1) \ TupleTypeSymbol.RestPosition - 1 + 1
+ End Function
+
+ Private Shared Function GetTupleUnderlyingType(elementTypes As ImmutableArray(Of TypeSymbol), syntax As VisualBasicSyntaxNode, compilation As VisualBasicCompilation, diagnostics As DiagnosticBag) As NamedTypeSymbol
+ Dim numElements As Integer = elementTypes.Length
+ Dim remainder As Integer
+ Dim chainLength As Integer = TupleTypeSymbol.NumberOfValueTuples(numElements, remainder)
+
+ Dim wellKnownType As NamedTypeSymbol = compilation.GetWellKnownType(TupleTypeSymbol.GetTupleType(remainder))
+
+ If diagnostics IsNot Nothing AndAlso syntax IsNot Nothing Then
+ Binder.ReportUseSiteError(diagnostics, syntax, wellKnownType)
+ End If
+
+ Dim namedTypeSymbol As NamedTypeSymbol = wellKnownType.Construct(ImmutableArray.Create(Of TypeSymbol)(elementTypes, (chainLength - 1) * TupleTypeSymbol.RestPosition - 1, remainder))
+ Dim [loop] As Integer = chainLength - 1
+ If [loop] > 0 Then
+ Dim wellKnownType2 As NamedTypeSymbol = compilation.GetWellKnownType(TupleTypeSymbol.GetTupleType(TupleTypeSymbol.RestPosition))
+
+ If diagnostics IsNot Nothing AndAlso syntax IsNot Nothing Then
+ Binder.ReportUseSiteError(diagnostics, syntax, wellKnownType2)
+ End If
+ Do
+ Dim typeArguments As ImmutableArray(Of TypeSymbol) = ImmutableArray.Create(Of TypeSymbol)(elementTypes, ([loop] - 1) * TupleTypeSymbol.RestPosition - 1, TupleTypeSymbol.RestPosition - 1).Add(namedTypeSymbol)
+ namedTypeSymbol = wellKnownType2.Construct(typeArguments)
+ [loop] -= 1
+ Loop While [loop] > 0
+ End If
+ Return namedTypeSymbol
+ End Function
+
+ Friend Shared Sub VerifyTupleTypePresent(cardinality As Integer, syntax As VisualBasicSyntaxNode, compilation As VisualBasicCompilation, diagnostics As DiagnosticBag)
+ Debug.Assert(diagnostics IsNot Nothing AndAlso syntax IsNot Nothing)
+ Dim arity As Integer
+ Dim num As Integer = TupleTypeSymbol.NumberOfValueTuples(cardinality, arity)
+ Dim wellKnownType As NamedTypeSymbol = compilation.GetWellKnownType(TupleTypeSymbol.GetTupleType(arity))
+ Binder.ReportUseSiteError(diagnostics, syntax, wellKnownType)
+
+ If num > 1 Then
+ Dim wellKnownType2 As NamedTypeSymbol = compilation.GetWellKnownType(TupleTypeSymbol.GetTupleType(TupleTypeSymbol.RestPosition))
+ Binder.ReportUseSiteError(diagnostics, syntax, wellKnownType2)
+ End If
+ End Sub
+
+ Private Shared Function GetTupleType(arity As Integer) As WellKnownType
+ If arity > TupleTypeSymbol.RestPosition Then
+ Throw ExceptionUtilities.Unreachable
+ End If
+
+ Return TupleTypeSymbol.tupleTypes(arity - 1)
+ End Function
+
+ Friend Shared Function GetTupleCtor(arity As Integer) As WellKnownMember
+ If arity > TupleTypeSymbol.RestPosition Then
+ Throw ExceptionUtilities.Unreachable
+ End If
+
+ Return TupleTypeSymbol.tupleCtors(arity - 1)
+ End Function
+
+ Friend Shared Function GetTupleTypeMember(arity As Integer, position As Integer) As WellKnownMember
+ Return TupleTypeSymbol.tupleMembers(arity - 1)(position - 1)
+ End Function
+
+ Friend Shared Function TupleMemberName(position As Integer) As String
+ Return "Item" & position
+ End Function
+
+ ' PROTOTYPE: case sensitivity
+ Private Shared Function IsElementNameForbidden(name As String) As Boolean
+ Return name = "CompareTo" OrElse name = "Deconstruct" OrElse name = "Equals" OrElse name = "GetHashCode" OrElse name = "Rest" OrElse name = "ToString"
+ End Function
+
+ ' PROTOTYPE: case sensitivity
+ Friend Shared Function IsElementNameReserved(name As String) As Integer
+ Dim result As Integer
+ If TupleTypeSymbol.IsElementNameForbidden(name) Then
+ result = 0
+ Else
+ If name.StartsWith("Item", StringComparison.Ordinal) Then
+ Dim s As String = name.Substring(4)
+ Dim num As Integer
+
+ If Integer.TryParse(s, num) Then
+ If num > 0 AndAlso String.Equals(name, TupleTypeSymbol.TupleMemberName(num), StringComparison.Ordinal) Then
+ result = num
+ Return result
+ End If
+ End If
+ End If
+ result = -1
+ End If
+ Return result
+ End Function
+
+ Friend Shared Function GetWellKnownMemberInType(type As NamedTypeSymbol, relativeMember As WellKnownMember) As Symbol
+ Debug.Assert(relativeMember >= WellKnownMember.System_Math__RoundDouble AndAlso relativeMember < WellKnownMember.Count)
+ Debug.Assert(type.IsDefinition)
+ Dim descriptor As MemberDescriptor = WellKnownMembers.GetDescriptor(relativeMember)
+ Return VisualBasicCompilation.GetRuntimeMember(type, descriptor, VisualBasicCompilation.SpecialMembersSignatureComparer.Instance, Nothing)
+ End Function
+
+ Friend Shared Function GetWellKnownMemberInType(type As NamedTypeSymbol, relativeMember As WellKnownMember, diagnostics As DiagnosticBag, syntax As SyntaxNode) As Symbol
+ Dim wellKnownMemberInType As Symbol = TupleTypeSymbol.GetWellKnownMemberInType(type, relativeMember)
+
+ If wellKnownMemberInType Is Nothing Then
+ Dim descriptor As MemberDescriptor = WellKnownMembers.GetDescriptor(relativeMember)
+ Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_MissingRuntimeHelper, type.Name & "."c & descriptor.Name)
+ Else
+ Dim useSiteDiagnostic As DiagnosticInfo = wellKnownMemberInType.GetUseSiteErrorInfo
+ If useSiteDiagnostic IsNot Nothing AndAlso useSiteDiagnostic.Severity = DiagnosticSeverity.[Error] Then
+ diagnostics.Add(useSiteDiagnostic, syntax.GetLocation())
+ End If
+ End If
+ Return wellKnownMemberInType
+ End Function
+
+ Private Function CollectTupleElementFields() As ImmutableArray(Of FieldSymbol)
+ Dim builder = ArrayBuilder(Of FieldSymbol).GetInstance(_elementTypes.Length)
+
+ For Each member In GetMembers()
+ If member.Kind <> SymbolKind.Field Then
+ Continue For
+ End If
+
+ Dim index = If(TryCast(member, TupleFieldSymbol)?.TupleFieldId,
+ DirectCast(member, TupleErrorFieldSymbol).TupleFieldId)
+
+ If index >= 0 Then
+ Debug.Assert(builder(index) Is Nothing)
+ builder(index) = DirectCast(member, FieldSymbol)
+ End If
+ Next
+
+ Debug.Assert(builder.All(Function(symbol) symbol IsNot Nothing))
+
+ Return builder.ToImmutableAndFree()
+ End Function
+
+ Public Overrides Function GetMembers() As ImmutableArray(Of Symbol)
+ Dim isDefault As Boolean = Me._lazyMembers.IsDefault
+ If isDefault Then
+ ImmutableInterlocked.InterlockedInitialize(Of Symbol)(Me._lazyMembers, Me.CreateMembers())
+ End If
+ Return Me._lazyMembers
+ End Function
+
+ Private Function CreateMembers() As ImmutableArray(Of Symbol)
+ Dim namesOfVirtualFields = ArrayBuilder(Of String).GetInstance(_elementTypes.Length)
+
+ If _elementNames.IsDefault Then
+ For i As Integer = 1 To _elementTypes.Length - 1
+ namesOfVirtualFields.Add(TupleMemberName(i))
+ Next
+ Else
+ namesOfVirtualFields.AddRange(_elementNames)
+ End If
+
+ Dim members = ArrayBuilder(Of Symbol).GetInstance(Math.Max(_elementTypes.Length, _underlyingType.OriginalDefinition.GetMembers().Length))
+
+ Dim currentUnderlying As NamedTypeSymbol = _underlyingType
+ Dim currentNestingLevel = 0
+
+ Dim currentFieldsForElements = ArrayBuilder(Of FieldSymbol).GetInstance(currentUnderlying.Arity)
+
+ ' Lookup field definitions that we are interested in
+ CollectTargetTupleFields(currentUnderlying, currentFieldsForElements)
+
+ Dim underlyingMembers As ImmutableArray(Of Symbol) = currentUnderlying.OriginalDefinition.GetMembers()
+
+ Do
+ For Each member In underlyingMembers
+ Select Case member.Kind
+ Case SymbolKind.Method
+ If currentNestingLevel = 0 Then
+ members.Add(New TupleMethodSymbol(Me, DirectCast(member, MethodSymbol).AsMember(currentUnderlying)))
+ End If
+
+ Case SymbolKind.Field
+ Dim field = DirectCast(member, FieldSymbol)
+
+ Dim tupleFieldIndex = currentFieldsForElements.IndexOf(field, ReferenceEqualityComparer.Instance)
+ If tupleFieldIndex = 0 Then
+ ' This Is a tuple backing field
+ Dim FieldSymbol = field.AsMember(currentUnderlying)
+
+ If currentNestingLevel <> 0 Then
+ ' This is a matching field, but it is in the extension tuple
+ tupleFieldIndex += (RestPosition - 1) * currentNestingLevel
+
+
+ Dim defaultName As String = TupleMemberName(tupleFieldIndex + 1)
+ ' Add a field with default name if the given name Is different
+ If namesOfVirtualFields(tupleFieldIndex) <> defaultName Then
+ ' The name given doesn't match default name ItemTupleTypeSymbol.RestPosition, etc.
+ members.Add(New TupleRenamedElementFieldSymbol(Me, FieldSymbol, defaultName, -members.Count - 1, Nothing))
+ End If
+
+ ' Add a field with the given name
+ Dim Location = If(_elementLocations.IsDefault, Nothing, _elementLocations(tupleFieldIndex))
+
+ If field.Name = namesOfVirtualFields(tupleFieldIndex) Then
+ members.Add(New TupleElementFieldSymbol(Me, FieldSymbol, tupleFieldIndex, Location))
+ Else
+ members.Add(New TupleRenamedElementFieldSymbol(Me, FieldSymbol, namesOfVirtualFields(tupleFieldIndex), tupleFieldIndex, Location))
+ End If
+ ElseIf field.Name = namesOfVirtualFields(tupleFieldIndex) Then
+ members.Add(New TupleElementFieldSymbol(Me, FieldSymbol, tupleFieldIndex,
+ If(_elementLocations.IsDefault, Nothing, _elementLocations(tupleFieldIndex))))
+ Else
+ ' Add a field with default name
+ members.Add(New TupleFieldSymbol(Me, FieldSymbol, -members.Count - 1))
+
+ ' Add a field with the given name
+ members.Add(New TupleRenamedElementFieldSymbol(Me, FieldSymbol, namesOfVirtualFields(tupleFieldIndex), tupleFieldIndex,
+ If(_elementLocations.IsDefault, Nothing, _elementLocations(tupleFieldIndex))))
+ End If
+
+ namesOfVirtualFields(tupleFieldIndex) = Nothing ' mark as handled
+
+ ElseIf currentNestingLevel = 0 Then
+ ' field at the top level didn't match a tuple backing field, simply add.
+ members.Add(New TupleFieldSymbol(Me, field.AsMember(currentUnderlying), -members.Count - 1))
+ End If
+
+ Case SymbolKind.NamedType
+ ' We are dropping nested types, if any. Pending real need.
+
+ Case SymbolKind.Property
+ If currentNestingLevel = 0 Then
+ members.Add(New TuplePropertySymbol(Me, DirectCast(member, PropertySymbol).AsMember(currentUnderlying)))
+ End If
+
+ Case SymbolKind.Event
+ If currentNestingLevel = 0 Then
+ members.Add(New TupleEventSymbol(Me, DirectCast(member, EventSymbol).AsMember(currentUnderlying)))
+ End If
+
+ Case Else
+ If currentNestingLevel = 0 Then
+ Throw ExceptionUtilities.UnexpectedValue(member.Kind)
+ End If
+ End Select
+ Next
+
+ If currentUnderlying.Arity <> RestPosition Then
+ Exit Do
+ End If
+
+ Dim oldUnderlying = currentUnderlying
+ currentUnderlying = oldUnderlying.TypeArgumentsNoUseSiteDiagnostics(RestPosition - 1).TupleUnderlyingType
+ currentNestingLevel += 1
+
+ If currentUnderlying.Arity <> RestPosition Then
+ ' refresh members And target fields
+ underlyingMembers = currentUnderlying.OriginalDefinition.GetMembers()
+ currentFieldsForElements.Clear()
+ CollectTargetTupleFields(currentUnderlying, currentFieldsForElements)
+ Else
+ Debug.Assert(oldUnderlying.OriginalDefinition Is currentUnderlying.OriginalDefinition)
+ End If
+ Loop
+
+ currentFieldsForElements.Free()
+
+ ' At the end, add remaining virtual fields
+ For i As Integer = 0 To namesOfVirtualFields.Count - 1
+ Dim Name As String = namesOfVirtualFields(i)
+ If Name IsNot Nothing Then
+ ' We couldn't find a backing field for this vitual field. It will be an error to access it.
+ Dim fieldRemainder As Integer ' one - based
+ Dim fieldChainLength = NumberOfValueTuples(i + 1, fieldRemainder)
+ Dim container As NamedTypeSymbol = GetNestedTupleUnderlyingType(_underlyingType, fieldChainLength - 1).OriginalDefinition
+
+ Dim DiagnosticInfo = If(container.IsErrorType(),
+ Nothing,
+ ErrorFactory.ErrorInfo(ERRID.ERR_MissingRuntimeHelper,
+ container.Name & "." & TupleMemberName(fieldRemainder)))
+
+ Dim defaultName As String = TupleMemberName(i + 1)
+ ' Add a field with default name if the given name Is different
+ If Name <> defaultName Then
+ members.Add(New TupleErrorFieldSymbol(Me, defaultName, -members.Count - 1, Nothing, _elementTypes(i), DiagnosticInfo))
+ End If
+
+ members.Add(New TupleErrorFieldSymbol(Me, Name, i,
+ If(_elementLocations.IsDefault, Nothing, _elementLocations(i)),
+ _elementTypes(i),
+ DiagnosticInfo))
+ End If
+ Next
+
+ Return members.ToImmutableAndFree()
+ End Function
+
+ Private Shared Sub CollectTargetTupleFields(underlying As NamedTypeSymbol, fieldsForElements As ArrayBuilder(Of FieldSymbol))
+ underlying = underlying.OriginalDefinition
+ Dim num As Integer = Math.Min(underlying.Arity, TupleTypeSymbol.RestPosition - 1)
+ For i As Integer = 0 To num - 1
+ Dim tupleTypeMember As WellKnownMember = TupleTypeSymbol.GetTupleTypeMember(underlying.Arity, i + 1)
+ fieldsForElements.Add(CType(TupleTypeSymbol.GetWellKnownMemberInType(underlying, tupleTypeMember), FieldSymbol))
+ Next
+ End Sub
+
+ Private Function ComputeDefinitionToMemberMap() As SmallDictionary(Of Symbol, Symbol)
+ Dim smallDictionary As SmallDictionary(Of Symbol, Symbol) = New SmallDictionary(Of Symbol, Symbol)(ReferenceEqualityComparer.Instance)
+ Dim originalDefinition As NamedTypeSymbol = Me._underlyingType.OriginalDefinition
+ Dim members As ImmutableArray(Of Symbol) = Me.GetMembers()
+ Dim i As Integer = members.Length - 1
+ While i >= 0
+ Dim symbol As Symbol = members(i)
+ Dim kind As SymbolKind = symbol.Kind
+ Select Case kind
+ Case SymbolKind.[Event]
+ Dim tupleUnderlyingEvent As EventSymbol = (DirectCast(symbol, EventSymbol)).TupleUnderlyingEvent
+ Dim associatedField As FieldSymbol = tupleUnderlyingEvent.AssociatedField
+
+ If associatedField IsNot Nothing Then
+ Debug.Assert(associatedField.ContainingSymbol Is Me._underlyingType)
+ Debug.Assert(Me._underlyingType.GetMembers(associatedField.Name).IndexOf(associatedField) < 0)
+ smallDictionary.Add(associatedField.OriginalDefinition, New TupleFieldSymbol(Me, associatedField, -i - 1))
+ End If
+
+ smallDictionary.Add(tupleUnderlyingEvent.OriginalDefinition, symbol)
+
+ Case SymbolKind.Field
+ Dim tupleUnderlyingField As FieldSymbol = (DirectCast(symbol, FieldSymbol)).TupleUnderlyingField
+ If tupleUnderlyingField IsNot Nothing Then
+ smallDictionary(tupleUnderlyingField.OriginalDefinition) = symbol
+ End If
+
+ Case SymbolKind.Method
+ smallDictionary.Add((DirectCast(symbol, MethodSymbol)).TupleUnderlyingMethod.OriginalDefinition, symbol)
+
+ Case SymbolKind.Property
+ smallDictionary.Add((DirectCast(symbol, PropertySymbol)).TupleUnderlyingProperty.OriginalDefinition, symbol)
+
+ Case Else
+ Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
+ End Select
+
+ i -= 1
+ End While
+
+ Return smallDictionary
+ End Function
+
+ Public Function GetTupleMemberSymbolForUnderlyingMember(Of TMember As Symbol)(underlyingMemberOpt As TMember) As TMember
+ Dim result As TMember
+ If underlyingMemberOpt Is Nothing Then
+ result = Nothing
+ Else
+ Dim originalDefinition As Symbol = underlyingMemberOpt.OriginalDefinition
+ If originalDefinition.ContainingType Is Me._underlyingType.OriginalDefinition Then
+ Dim symbol As Symbol = Nothing
+
+ If Me.UnderlyingDefinitionToMemberMap.TryGetValue(originalDefinition, symbol) Then
+ result = CType((CObj(symbol)), TMember)
+ Return result
+ End If
+ End If
+ result = Nothing
+ End If
+ Return result
+ End Function
+
+ Public Overrides Function GetMembers(name As String) As ImmutableArray(Of Symbol)
+ Return Me.GetMembers().WhereAsArray(Function(m As Symbol) m.Name = name)
+ End Function
+
+ Public Overrides Function GetTypeMembers() As ImmutableArray(Of NamedTypeSymbol)
+ ' do Not support nested types at the moment
+ Debug.Assert(Not GetMembers().Any(Function(m) m.Kind = SymbolKind.NamedType))
+ Return ImmutableArray(Of NamedTypeSymbol).Empty
+ End Function
+
+ Public Overrides Function GetTypeMembers(name As String) As ImmutableArray(Of NamedTypeSymbol)
+ ' do Not support nested types at the moment
+ Debug.Assert(Not GetMembers().Any(Function(m) m.Kind = SymbolKind.NamedType))
+ Return ImmutableArray(Of NamedTypeSymbol).Empty
+ End Function
+
+ Public Overrides Function GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of NamedTypeSymbol)
+ ' do Not support nested types at the moment
+ Debug.Assert(Not GetMembers().Any(Function(m) m.Kind = SymbolKind.NamedType))
+ Return ImmutableArray(Of NamedTypeSymbol).Empty
+ End Function
+
+ Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
+ Return Me._underlyingType.GetAttributes()
+ End Function
+
+ ' PROTOTYPE: where is this used?
+ ' should we ignore names
+ ' do we need to be case-insensitive when we compare names
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Dim otherTuple = TryCast(obj, TupleTypeSymbol)
+ If otherTuple Is Nothing Then
+ Return False
+ End If
+
+ Dim otherUnderlying = otherTuple.TupleUnderlyingType
+ If (Me.TupleUnderlyingType <> otherUnderlying) Then
+ Return False
+ End If
+
+ Dim myNames = Me.TupleElementNames
+ Dim otherNames = otherTuple.TupleElementNames
+
+ If myNames.IsDefaultOrEmpty AndAlso otherNames.IsDefaultOrEmpty Then
+ Return True
+ End If
+
+ Return myNames.SequenceEqual(otherNames)
+ End Function
+
+ Public Overrides Function GetHashCode() As Integer
+ Return Me._underlyingType.GetHashCode()
+ End Function
+
+ Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
+ Return Me._underlyingType.GetUseSiteErrorInfo()
+ End Function
+
+ Friend Overrides Function GetUnificationUseSiteDiagnosticRecursive(owner As Symbol, ByRef checkedTypes As HashSet(Of TypeSymbol)) As DiagnosticInfo
+ Return Me._underlyingType.GetUnificationUseSiteDiagnosticRecursive(owner, checkedTypes)
+ End Function
+
+ Friend Overrides Function GetAttributeUsageInfo() As AttributeUsageInfo
+ Return AttributeUsageInfo.Null
+ End Function
+
+ Friend Overrides Function GetAppliedConditionalSymbols() As ImmutableArray(Of String)
+ Return ImmutableArray(Of String).Empty
+ End Function
+
+ Friend Overrides Function GetFieldsToEmit() As IEnumerable(Of FieldSymbol)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetEventsToEmit() As IEnumerable(Of EventSymbol)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetMethodsToEmit() As IEnumerable(Of MethodSymbol)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetPropertiesToEmit() As IEnumerable(Of PropertySymbol)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetInterfacesToEmit() As IEnumerable(Of NamedTypeSymbol)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function GetCustomAttributesToEmit(compilationState As ModuleCompilationState) As IEnumerable(Of VisualBasicAttributeData)
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Public Shared Function TransformToTupleIfCompatible(target As TypeSymbol) As TypeSymbol
+ Dim result As TypeSymbol
+ If target.IsTupleCompatible() Then
+ result = TupleTypeSymbol.Create(CType(target, NamedTypeSymbol))
+ Else
+ result = target
+ End If
+ Return result
+ End Function
+
+ Public Overrides Function Construct(typeArguments As ImmutableArray(Of TypeSymbol)) As NamedTypeSymbol
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function InternalSubstituteTypeParameters(substitution As TypeSubstitution) As TypeWithModifiers
+ Throw ExceptionUtilities.Unreachable
+ End Function
+
+ Friend Overrides Function MakeDeclaredBase(basesBeingResolved As ConsList(Of Symbol), diagnostics As DiagnosticBag) As NamedTypeSymbol
+ Return Me._underlyingType.MakeDeclaredBase(basesBeingResolved, diagnostics)
+ End Function
+
+ Friend Overrides Function MakeDeclaredInterfaces(basesBeingResolved As ConsList(Of Symbol), diagnostics As DiagnosticBag) As ImmutableArray(Of NamedTypeSymbol)
+ Return Me._underlyingType.MakeDeclaredInterfaces(basesBeingResolved, diagnostics)
+ End Function
+
+ Friend Overrides Function MakeAcyclicBaseType(diagnostics As DiagnosticBag) As NamedTypeSymbol
+ Return Me._underlyingType.MakeAcyclicBaseType(diagnostics)
+ End Function
+
+ Friend Overrides Function MakeAcyclicInterfaces(diagnostics As DiagnosticBag) As ImmutableArray(Of NamedTypeSymbol)
+ Return Me._underlyingType.MakeAcyclicInterfaces(diagnostics)
+ End Function
+
+ Friend Overrides Sub GenerateDeclarationErrors(cancellationToken As CancellationToken)
+ Me._underlyingType.GenerateDeclarationErrors(cancellationToken)
+ End Sub
+ End Class
+End Namespace
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/TypeSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/TypeSymbol.vb
index 294bf7ac302a014a8e70ee2b9ae53b7c9d3ac824..2de5222b8540dccd508341e6a7264e4bb395fb79 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/TypeSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/TypeSymbol.vb
@@ -399,6 +399,62 @@ Done:
Return result
End Function
+ Public Overridable ReadOnly Property IsTupleType() As Boolean
+ Get
+ Return False
+ End Get
+ End Property
+
+ Public Overridable ReadOnly Property TupleUnderlyingType() As NamedTypeSymbol
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Public Overridable ReadOnly Property TupleElementTypes() As ImmutableArray(Of TypeSymbol)
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ Public Overridable ReadOnly Property TupleElementNames() As ImmutableArray(Of String)
+ Get
+ Return Nothing
+ End Get
+ End Property
+
+ '''
+ ''' Verify if the given type can be used to back a tuple type
+ ''' and return cardinality of that tuple type in .
+ '''
+ ''' If method returns true, contains cardinality of the compatible tuple type.
+ '''
+ Public Overridable Function IsTupleCompatible( ByRef tupleCardinality As Integer) As Boolean
+ tupleCardinality = 0
+ Return False
+ End Function
+
+ '''
+ ''' Verify if the given type can be used to back a tuple type.
+ '''
+ Public Function IsTupleCompatible() As Boolean
+ Dim countOfItems As Integer
+ Return IsTupleCompatible(countOfItems)
+ End Function
+
+ '''
+ ''' Verify if the given type is a tuple of a given cardinality, or can be used to back a tuple type
+ ''' with the given cardinality.
+ '''
+ Public Function IsTupleOrCompatibleWithTupleOfCardinality(targetCardinality As Integer) As Boolean
+ If (IsTupleType) Then
+ Return TupleElementTypes.Length = targetCardinality
+ End If
+
+ Dim countOfItems As Integer
+ Return IsTupleCompatible(countOfItems) AndAlso countOfItems = targetCardinality
+ End Function
+
#Region "Use-Site Diagnostics"
'''
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedEventSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedEventSymbol.vb
new file mode 100644
index 0000000000000000000000000000000000000000..735d8b773ddaa9ddfcf318bc923152b51f198a59
--- /dev/null
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedEventSymbol.vb
@@ -0,0 +1,120 @@
+' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+Imports System.Collections.Immutable
+Imports System.Globalization
+Imports System.Threading
+
+Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
+ '''
+ ''' Represents an event that is based on another event.
+ ''' When inheriting from this class, one shouldn't assume that
+ ''' the default behavior it has is appropriate for every case.
+ ''' That behavior should be carefully reviewed and derived type
+ ''' should override behavior as appropriate.
+ '''
+ Friend MustInherit Class WrappedEventSymbol
+ Inherits EventSymbol
+
+ Protected _underlyingEvent As EventSymbol
+
+ Public ReadOnly Property UnderlyingEvent() As EventSymbol
+ Get
+ Return Me._underlyingEvent
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsImplicitlyDeclared() As Boolean
+ Get
+ Return Me._underlyingEvent.IsImplicitlyDeclared
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasSpecialName() As Boolean
+ Get
+ Return Me._underlyingEvent.HasSpecialName
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Name() As String
+ Get
+ Return Me._underlyingEvent.Name
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property Locations() As ImmutableArray(Of Location)
+ Get
+ Return Me._underlyingEvent.Locations
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaringSyntaxReferences() As ImmutableArray(Of SyntaxReference)
+ Get
+ Return Me._underlyingEvent.DeclaringSyntaxReferences
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property DeclaredAccessibility() As Accessibility
+ Get
+ Return Me._underlyingEvent.DeclaredAccessibility
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsShared() As Boolean
+ Get
+ Return Me._underlyingEvent.IsShared
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOverridable() As Boolean
+ Get
+ Return Me._underlyingEvent.IsOverridable
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOverrides() As Boolean
+ Get
+ Return Me._underlyingEvent.IsOverrides
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsMustOverride() As Boolean
+ Get
+ Return Me._underlyingEvent.IsMustOverride
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsNotOverridable() As Boolean
+ Get
+ Return Me._underlyingEvent.IsNotOverridable
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property ObsoleteAttributeData() As ObsoleteAttributeData
+ Get
+ Return Me._underlyingEvent.ObsoleteAttributeData
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsWindowsRuntimeEvent() As Boolean
+ Get
+ Return Me._underlyingEvent.IsWindowsRuntimeEvent
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasRuntimeSpecialName() As Boolean
+ Get
+ Return Me._underlyingEvent.HasRuntimeSpecialName
+ End Get
+ End Property
+
+ Public Sub New(underlyingEvent As EventSymbol)
+ Debug.Assert(underlyingEvent IsNot Nothing)
+ Me._underlyingEvent = underlyingEvent
+ End Sub
+
+ Public Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String
+ Return Me._underlyingEvent.GetDocumentationCommentXml(preferredCulture, expandIncludes, cancellationToken)
+ End Function
+ End Class
+End Namespace
+
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedMethodSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedMethodSymbol.vb
index df7d41e50e055d89db3126ae1c05445dc331c919..742423d7bccd1b69e224ee0803ead0b0df2b2c94 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedMethodSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedMethodSymbol.vb
@@ -205,6 +205,42 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ Friend Overrides ReadOnly Property IsMethodKindBasedOnSyntax As Boolean
+ Get
+ Return Me.UnderlyingMethod.IsMethodKindBasedOnSyntax
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsIterator As Boolean
+ Get
+ Return Me.UnderlyingMethod.IsIterator
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property Syntax As VisualBasicSyntaxNode
+ Get
+ Return Me.UnderlyingMethod.Syntax
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOverloads As Boolean
+ Get
+ Return Me.UnderlyingMethod.IsOverloads
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property GenerateDebugInfoImpl As Boolean
+ Get
+ Return Me.UnderlyingMethod.GenerateDebugInfoImpl
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOverridable As Boolean
+ Get
+ Return Me.UnderlyingMethod.IsOverridable
+ End Get
+ End Property
+
Friend Overrides Function IsMetadataNewSlot(Optional ignoreInterfaceImplementationChanges As Boolean = False) As Boolean
Return Me.UnderlyingMethod.IsMetadataNewSlot(ignoreInterfaceImplementationChanges)
End Function
diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedParameterSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedParameterSymbol.vb
index 4085c8e5fcb0ca27d87f51d690a159ddc73332e9..3bb9178af3e46cbe02654eb1d498d4bff5959e08 100644
--- a/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedParameterSymbol.vb
+++ b/src/Compilers/VisualBasic/Portable/Symbols/Wrapped/WrappedParameterSymbol.vb
@@ -150,6 +150,36 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
+ Friend Overrides ReadOnly Property IsExplicitByRef As Boolean
+ Get
+ Return Me._underlyingParameter.IsExplicitByRef
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property IsOptional As Boolean
+ Get
+ Return Me._underlyingParameter.IsOptional
+ End Get
+ End Property
+
+ Public Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
+ Get
+ Return Me._underlyingParameter.HasExplicitDefaultValue
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
+ Get
+ Return Me._underlyingParameter.ExplicitDefaultConstantValue(inProgress)
+ End Get
+ End Property
+
+ Friend Overrides ReadOnly Property HasOptionCompare As Boolean
+ Get
+ Return Me._underlyingParameter.HasOptionCompare
+ End Get
+ End Property
+
Protected Sub New(underlyingParameter As ParameterSymbol)
Debug.Assert(underlyingParameter IsNot Nothing)
Me._underlyingParameter = underlyingParameter