@@ -128,19 +128,7 @@ static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan
128
128
// If the type is nested, recursively format the hierarchy as well
129
129
if ( type . IsNested )
130
130
{
131
- Type ? openDeclaringType = type . DeclaringType ! ;
132
- Type [ ] ? rootGenericArguments = typeArguments . Slice ( 0 , typeArguments . Length - genericTypeOffset ) . ToArray ( ) ;
133
-
134
- // If the declaring type is generic, we need to reconstruct the closed type
135
- // manually, as the declaring type instance doesn't retain type information.
136
- if ( rootGenericArguments . Length > 0 )
137
- {
138
- Type ? closedDeclaringType = openDeclaringType . GetGenericTypeDefinition ( ) . MakeGenericType ( rootGenericArguments ) ;
139
-
140
- return $ "{ FormatDisplayString ( closedDeclaringType , genericTypeOffset , typeArguments ) } .{ displayName } ";
141
- }
142
-
143
- return $ "{ FormatDisplayString ( openDeclaringType , genericTypeOffset , typeArguments ) } .{ displayName } ";
131
+ return $ "{ FormatDisplayString ( type . DeclaringType ! , genericTypeOffset , typeArguments ) } .{ displayName } ";
144
132
}
145
133
146
134
return $ "{ type . Namespace } .{ displayName } ";
@@ -149,21 +137,21 @@ static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan
149
137
// Atomically get or build the display string for the current type.
150
138
return DisplayNames . GetValue ( type , t =>
151
139
{
152
- // By-ref types are displayed as T&
153
- if ( t . IsByRef )
140
+ // By-ref types are displayed as T&
141
+ if ( t . IsByRef )
154
142
{
155
143
t = t . GetElementType ( ) ! ;
156
144
157
145
return $ "{ FormatDisplayString ( t , 0 , t . GetGenericArguments ( ) ) } &";
158
146
}
159
147
160
- // Pointer types are displayed as T*
161
- if ( t . IsPointer )
148
+ // Pointer types are displayed as T*
149
+ if ( t . IsPointer )
162
150
{
163
151
int depth = 0 ;
164
152
165
- // Calculate the pointer indirection level
166
- while ( t . IsPointer )
153
+ // Calculate the pointer indirection level
154
+ while ( t . IsPointer )
167
155
{
168
156
depth ++ ;
169
157
t = t . GetElementType ( ) ! ;
@@ -172,8 +160,8 @@ static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan
172
160
return $ "{ FormatDisplayString ( t , 0 , t . GetGenericArguments ( ) ) } { new string ( '*' , depth ) } ";
173
161
}
174
162
175
- // Standard path for concrete types
176
- return FormatDisplayString ( t , 0 , t . GetGenericArguments ( ) ) ;
163
+ // Standard path for concrete types
164
+ return FormatDisplayString ( t , 0 , t . GetGenericArguments ( ) ) ;
177
165
} ) ;
178
166
}
179
167
}
0 commit comments