@@ -1213,7 +1213,7 @@ public override Binder VisitXmlNameAttribute(XmlNameAttributeSyntax parent)
1213
1213
{
1214
1214
case XmlNameAttributeElementKind . Parameter :
1215
1215
case XmlNameAttributeElementKind . ParameterReference :
1216
- result = GetParameterNameAttributeValueBinder ( memberSyntax , result ) ;
1216
+ result = GetParameterNameAttributeValueBinder ( memberSyntax , isParamRef : elementKind == XmlNameAttributeElementKind . ParameterReference , nextBinder : result ) ;
1217
1217
break ;
1218
1218
case XmlNameAttributeElementKind . TypeParameter :
1219
1219
result = GetTypeParameterNameAttributeValueBinder ( memberSyntax , includeContainingSymbols : false , nextBinder : result ) ;
@@ -1234,16 +1234,28 @@ public override Binder VisitXmlNameAttribute(XmlNameAttributeSyntax parent)
1234
1234
/// We're in a <param> or <paramref> element, so we want a binder that can see
1235
1235
/// the parameters of the associated member and nothing else.
1236
1236
/// </summary>
1237
- private Binder GetParameterNameAttributeValueBinder ( MemberDeclarationSyntax memberSyntax , Binder nextBinder )
1237
+ private Binder GetParameterNameAttributeValueBinder ( MemberDeclarationSyntax memberSyntax , bool isParamRef , Binder nextBinder )
1238
1238
{
1239
1239
if ( memberSyntax is BaseMethodDeclarationSyntax { ParameterList : { ParameterCount : > 0 } } baseMethodDeclSyntax )
1240
1240
{
1241
1241
Binder outerBinder = VisitCore ( memberSyntax . Parent ) ;
1242
1242
MethodSymbol method = GetMethodSymbol ( baseMethodDeclSyntax , outerBinder ) ;
1243
+
1244
+ if ( isParamRef && method . TryGetInstanceExtensionParameter ( out var _ ) )
1245
+ {
1246
+ nextBinder = new WithExtensionParameterBinder ( method . ContainingType , nextBinder ) ;
1247
+ }
1248
+
1243
1249
return new WithParametersBinder ( method . Parameters , nextBinder ) ;
1244
1250
}
1245
-
1246
- if ( memberSyntax is TypeDeclarationSyntax { ParameterList : { ParameterCount : > 0 } } typeDeclaration )
1251
+ else if ( memberSyntax is ExtensionDeclarationSyntax extensionDeclaration )
1252
+ {
1253
+ _ = extensionDeclaration . ParameterList ;
1254
+ Binder outerBinder = VisitCore ( memberSyntax ) ;
1255
+ SourceNamedTypeSymbol type = ( ( NamespaceOrTypeSymbol ) outerBinder . ContainingMemberOrLambda ) . GetSourceTypeMember ( ( TypeDeclarationSyntax ) memberSyntax ) ;
1256
+ return new WithExtensionParameterBinder ( type , nextBinder ) ;
1257
+ }
1258
+ else if ( memberSyntax is TypeDeclarationSyntax { ParameterList : { ParameterCount : > 0 } } typeDeclaration )
1247
1259
{
1248
1260
_ = typeDeclaration . ParameterList ;
1249
1261
Binder outerBinder = VisitCore ( memberSyntax ) ;
@@ -1268,6 +1280,11 @@ private Binder GetParameterNameAttributeValueBinder(MemberDeclarationSyntax memb
1268
1280
1269
1281
ImmutableArray < ParameterSymbol > parameters = property . Parameters ;
1270
1282
1283
+ if ( isParamRef && property . TryGetInstanceExtensionParameter ( out var _ ) )
1284
+ {
1285
+ nextBinder = new WithExtensionParameterBinder ( property . ContainingType , nextBinder ) ;
1286
+ }
1287
+
1271
1288
// BREAK: Dev11 also allows "value" for readonly properties, but that doesn't
1272
1289
// make sense and we don't have a symbol.
1273
1290
if ( ( object ) property . SetMethod != null )
@@ -1278,8 +1295,10 @@ private Binder GetParameterNameAttributeValueBinder(MemberDeclarationSyntax memb
1278
1295
1279
1296
if ( parameters . Any ( ) )
1280
1297
{
1281
- return new WithParametersBinder ( parameters , nextBinder ) ;
1298
+ nextBinder = new WithParametersBinder ( parameters , nextBinder ) ;
1282
1299
}
1300
+
1301
+ return nextBinder ;
1283
1302
}
1284
1303
else if ( memberKind == SyntaxKind . DelegateDeclaration )
1285
1304
{
0 commit comments