@@ -152,10 +152,11 @@ bool IdDependsOnImpl(ITypeSymbol type)
152152 /// <param name="cx">The extraction context.</param>
153153 /// <param name="trapFile">The trap builder used to store the result.</param>
154154 /// <param name="symbolBeingDefined">The outer symbol being defined (to avoid recursive ids).</param>
155- public static void BuildTypeId ( this ITypeSymbol type , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool getTupleAsTuple = true ) =>
156- type . BuildTypeId ( cx , trapFile , symbolBeingDefined , true , getTupleAsTuple ) ;
155+ /// <param name="constructUnderlyingTupleType">Whether to build a type ID for the underlying `System.ValueTuple` struct in the case of tuple types.</param>
156+ public static void BuildTypeId ( this ITypeSymbol type , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool constructUnderlyingTupleType = false ) =>
157+ type . BuildTypeId ( cx , trapFile , symbolBeingDefined , true , constructUnderlyingTupleType ) ;
157158
158- static void BuildTypeId ( this ITypeSymbol type , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool getTupleAsTuple )
159+ static void BuildTypeId ( this ITypeSymbol type , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool constructUnderlyingTupleType )
159160 {
160161 using ( cx . StackGuard )
161162 {
@@ -173,7 +174,7 @@ static void BuildTypeId(this ITypeSymbol type, Context cx, TextWriter trapFile,
173174 case TypeKind . Delegate :
174175 case TypeKind . Error :
175176 var named = ( INamedTypeSymbol ) type ;
176- named . BuildNamedTypeId ( cx , trapFile , symbolBeingDefined , addBaseClass , getTupleAsTuple ) ;
177+ named . BuildNamedTypeId ( cx , trapFile , symbolBeingDefined , addBaseClass , constructUnderlyingTupleType ) ;
177178 return ;
178179 case TypeKind . Pointer :
179180 var ptr = ( IPointerTypeSymbol ) type ;
@@ -195,7 +196,7 @@ static void BuildTypeId(this ITypeSymbol type, Context cx, TextWriter trapFile,
195196 }
196197 }
197198
198- static void BuildOrWriteId ( this ISymbol symbol , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool getTupleAsTuple = true )
199+ static void BuildOrWriteId ( this ISymbol symbol , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool constructUnderlyingTupleType = false )
199200 {
200201 // We need to keep track of the symbol being defined in order to avoid cyclic labels.
201202 // For example, in
@@ -214,8 +215,8 @@ static void BuildOrWriteId(this ISymbol symbol, Context cx, TextWriter trapFile,
214215 if ( SymbolEqualityComparer . Default . Equals ( symbol , symbolBeingDefined ) )
215216 trapFile . Write ( "__self__" ) ;
216217 else if ( symbol is ITypeSymbol type && type . IdDependsOn ( cx , symbolBeingDefined ) )
217- type . BuildTypeId ( cx , trapFile , symbolBeingDefined , addBaseClass , getTupleAsTuple ) ;
218- else if ( symbol is INamedTypeSymbol namedType && namedType . IsTupleType && ! getTupleAsTuple )
218+ type . BuildTypeId ( cx , trapFile , symbolBeingDefined , addBaseClass , constructUnderlyingTupleType ) ;
219+ else if ( symbol is INamedTypeSymbol namedType && namedType . IsTupleType && constructUnderlyingTupleType )
219220 trapFile . WriteSubId ( NamedType . CreateNamedTypeFromTupleType ( cx , namedType ) ) ;
220221 else
221222 trapFile . WriteSubId ( CreateEntity ( cx , symbol ) ) ;
@@ -264,9 +265,9 @@ private static void BuildAssembly(IAssemblySymbol asm, TextWriter trapFile, bool
264265 trapFile . Write ( "::" ) ;
265266 }
266267
267- static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool getTupleAsTuple )
268+ static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , TextWriter trapFile , ISymbol symbolBeingDefined , bool addBaseClass , bool constructUnderlyingTupleType )
268269 {
269- if ( getTupleAsTuple && named . IsTupleType )
270+ if ( ! constructUnderlyingTupleType && named . IsTupleType )
270271 {
271272 trapFile . Write ( '(' ) ;
272273 trapFile . BuildList ( "," , named . TupleElements ,
@@ -310,7 +311,7 @@ void AddContaining()
310311 }
311312 else
312313 {
313- named . ConstructedFrom . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , addBaseClass , getTupleAsTuple ) ;
314+ named . ConstructedFrom . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , addBaseClass , constructUnderlyingTupleType ) ;
314315 trapFile . Write ( '<' ) ;
315316 // Encode the nullability of the type arguments in the label.
316317 // Type arguments with different nullability can result in
@@ -362,7 +363,7 @@ static void BuildAnonymousName(this INamedTypeSymbol type, Context cx, TextWrite
362363 /// Constructs a display name string for this type symbol.
363364 /// </summary>
364365 /// <param name="trapFile">The trap builder used to store the result.</param>
365- public static void BuildDisplayName ( this ITypeSymbol type , Context cx , TextWriter trapFile , bool getTupleAsTuple = true )
366+ public static void BuildDisplayName ( this ITypeSymbol type , Context cx , TextWriter trapFile , bool constructUnderlyingTupleType = false )
366367 {
367368 using ( cx . StackGuard )
368369 {
@@ -386,7 +387,7 @@ public static void BuildDisplayName(this ITypeSymbol type, Context cx, TextWrite
386387 case TypeKind . Delegate :
387388 case TypeKind . Error :
388389 var named = ( INamedTypeSymbol ) type ;
389- named . BuildNamedTypeDisplayName ( cx , trapFile , getTupleAsTuple ) ;
390+ named . BuildNamedTypeDisplayName ( cx , trapFile , constructUnderlyingTupleType ) ;
390391 return ;
391392 case TypeKind . Pointer :
392393 var ptr = ( IPointerTypeSymbol ) type ;
@@ -405,9 +406,9 @@ public static void BuildDisplayName(this ITypeSymbol type, Context cx, TextWrite
405406 }
406407 }
407408
408- public static void BuildNamedTypeDisplayName ( this INamedTypeSymbol namedType , Context cx , TextWriter trapFile , bool getTupleAsTuple )
409+ public static void BuildNamedTypeDisplayName ( this INamedTypeSymbol namedType , Context cx , TextWriter trapFile , bool constructUnderlyingTupleType )
409410 {
410- if ( getTupleAsTuple && namedType . IsTupleType )
411+ if ( ! constructUnderlyingTupleType && namedType . IsTupleType )
411412 {
412413 trapFile . Write ( '(' ) ;
413414 trapFile . BuildList ( "," , namedType . TupleElements . Select ( f => f . Type ) ,
0 commit comments