diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx
index b0f30fbd477f1..1c9445c1a6c37 100644
--- a/src/Compilers/CSharp/Portable/CSharpResources.resx
+++ b/src/Compilers/CSharp/Portable/CSharpResources.resx
@@ -7478,4 +7478,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
Struct primary constructor parameter '{0}' of type '{1}' causes a cycle in the struct layout
+
+ Unexpected parameter list.
+
\ No newline at end of file
diff --git a/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs b/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs
index b68b62370e935..c42239750ea9b 100644
--- a/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs
+++ b/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs
@@ -633,9 +633,14 @@ private SingleNamespaceOrTypeDeclaration VisitTypeDeclaration(TypeDeclarationSyn
{
if (node.ParameterList != null)
{
- Debug.Assert(node.Kind() is not SyntaxKind.InterfaceDeclaration);
-
- MessageID.IDS_FeaturePrimaryConstructors.CheckFeatureAvailability(diagnostics, node.ParameterList);
+ if (node.Kind() is SyntaxKind.InterfaceDeclaration)
+ {
+ diagnostics.Add(ErrorCode.ERR_UnexpectedParameterList, node.ParameterList.GetLocation());
+ }
+ else
+ {
+ MessageID.IDS_FeaturePrimaryConstructors.CheckFeatureAvailability(diagnostics, node.ParameterList);
+ }
}
else if (node.OpenBraceToken == default && node.CloseBraceToken == default && node.SemicolonToken != default)
{
diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
index 90b23d879d63f..dcfe91ad48aa0 100644
--- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
+++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
@@ -2180,6 +2180,7 @@ internal enum ErrorCode
ERR_RefReadonlyPrimaryConstructorParameter2 = 9514,
ERR_RefReturnPrimaryConstructorParameter = 9515,
ERR_StructLayoutCyclePrimaryConstructorParameter = 9516,
+ ERR_UnexpectedParameterList = 9517,
#endregion
diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs b/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
index df781c42c4342..498112f9b37e7 100644
--- a/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
+++ b/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
@@ -2298,6 +2298,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
case ErrorCode.ERR_RefReadonlyPrimaryConstructorParameter2:
case ErrorCode.ERR_RefReturnPrimaryConstructorParameter:
case ErrorCode.ERR_StructLayoutCyclePrimaryConstructorParameter:
+ case ErrorCode.ERR_UnexpectedParameterList:
return false;
default:
// NOTE: All error codes must be explicitly handled in this switch statement
diff --git a/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4 b/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4
index b2dfe38064cc3..48aae47778699 100644
--- a/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4
+++ b/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4
@@ -320,7 +320,7 @@ class_declaration
;
interface_declaration
- : attribute_list* modifier* 'interface' identifier_token type_parameter_list? base_list? type_parameter_constraint_clause* '{'? member_declaration* '}'? ';'?
+ : attribute_list* modifier* 'interface' identifier_token type_parameter_list? parameter_list? base_list? type_parameter_constraint_clause* '{'? member_declaration* '}'? ';'?
;
record_declaration
diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs
index 7d9dc1e331a4e..557c6d14838ca 100644
--- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs
+++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs
@@ -21483,6 +21483,8 @@ protected TypeDeclarationSyntax(ObjectReader reader)
public abstract TypeParameterListSyntax? TypeParameterList { get; }
+ public abstract ParameterListSyntax? ParameterList { get; }
+
/// Gets the type constraint list.
public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses { get; }
@@ -21693,7 +21695,7 @@ internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
- public new ParameterListSyntax? ParameterList => this.parameterList;
+ public override ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
@@ -22045,7 +22047,7 @@ internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
- public new ParameterListSyntax? ParameterList => this.parameterList;
+ public override ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
@@ -22202,6 +22204,7 @@ internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax
internal readonly SyntaxToken keyword;
internal readonly SyntaxToken identifier;
internal readonly TypeParameterListSyntax? typeParameterList;
+ internal readonly ParameterListSyntax? parameterList;
internal readonly BaseListSyntax? baseList;
internal readonly GreenNode? constraintClauses;
internal readonly SyntaxToken? openBraceToken;
@@ -22209,10 +22212,10 @@ internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax
internal readonly SyntaxToken? closeBraceToken;
internal readonly SyntaxToken? semicolonToken;
- internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
+ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations)
: base(kind, diagnostics, annotations)
{
- this.SlotCount = 11;
+ this.SlotCount = 12;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
@@ -22232,6 +22235,11 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
+ if (parameterList != null)
+ {
+ this.AdjustFlagsAndWidth(parameterList);
+ this.parameterList = parameterList;
+ }
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
@@ -22264,11 +22272,11 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
}
}
- internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
+ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context)
: base(kind)
{
this.SetFactoryContext(context);
- this.SlotCount = 11;
+ this.SlotCount = 12;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
@@ -22288,6 +22296,11 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
+ if (parameterList != null)
+ {
+ this.AdjustFlagsAndWidth(parameterList);
+ this.parameterList = parameterList;
+ }
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
@@ -22320,10 +22333,10 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
}
}
- internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
+ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
: base(kind)
{
- this.SlotCount = 11;
+ this.SlotCount = 12;
if (attributeLists != null)
{
this.AdjustFlagsAndWidth(attributeLists);
@@ -22343,6 +22356,11 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
this.AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
+ if (parameterList != null)
+ {
+ this.AdjustFlagsAndWidth(parameterList);
+ this.parameterList = parameterList;
+ }
if (baseList != null)
{
this.AdjustFlagsAndWidth(baseList);
@@ -22381,6 +22399,7 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
public override SyntaxToken Keyword => this.keyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
+ public override ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
@@ -22396,12 +22415,13 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
2 => this.keyword,
3 => this.identifier,
4 => this.typeParameterList,
- 5 => this.baseList,
- 6 => this.constraintClauses,
- 7 => this.openBraceToken,
- 8 => this.members,
- 9 => this.closeBraceToken,
- 10 => this.semicolonToken,
+ 5 => this.parameterList,
+ 6 => this.baseList,
+ 7 => this.constraintClauses,
+ 8 => this.openBraceToken,
+ 9 => this.members,
+ 10 => this.closeBraceToken,
+ 11 => this.semicolonToken,
_ => null,
};
@@ -22410,11 +22430,11 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists,
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this);
public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this);
- public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
+ public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
- if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
+ if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
- var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
+ var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var diags = GetDiagnostics();
if (diags?.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
@@ -22428,15 +22448,15 @@ public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalS
}
internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics)
- => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
+ => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations());
internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations)
- => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
+ => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations);
internal InterfaceDeclarationSyntax(ObjectReader reader)
: base(reader)
{
- this.SlotCount = 11;
+ this.SlotCount = 12;
var attributeLists = (GreenNode?)reader.ReadValue();
if (attributeLists != null)
{
@@ -22461,6 +22481,12 @@ internal InterfaceDeclarationSyntax(ObjectReader reader)
AdjustFlagsAndWidth(typeParameterList);
this.typeParameterList = typeParameterList;
}
+ var parameterList = (ParameterListSyntax?)reader.ReadValue();
+ if (parameterList != null)
+ {
+ AdjustFlagsAndWidth(parameterList);
+ this.parameterList = parameterList;
+ }
var baseList = (BaseListSyntax?)reader.ReadValue();
if (baseList != null)
{
@@ -22507,6 +22533,7 @@ internal override void WriteTo(ObjectWriter writer)
writer.WriteValue(this.keyword);
writer.WriteValue(this.identifier);
writer.WriteValue(this.typeParameterList);
+ writer.WriteValue(this.parameterList);
writer.WriteValue(this.baseList);
writer.WriteValue(this.constraintClauses);
writer.WriteValue(this.openBraceToken);
@@ -22739,7 +22766,7 @@ internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre
public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword;
public override SyntaxToken Identifier => this.identifier;
public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList;
- public new ParameterListSyntax? ParameterList => this.parameterList;
+ public override ParameterListSyntax? ParameterList => this.parameterList;
public override BaseListSyntax? BaseList => this.baseList;
public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses);
public override SyntaxToken? OpenBraceToken => this.openBraceToken;
@@ -35462,7 +35489,7 @@ public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
- => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
+ => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken));
@@ -39148,7 +39175,7 @@ public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.I
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
- public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
+ public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
@@ -39184,7 +39211,7 @@ public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Sy
}
#endif
- return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
+ return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context);
}
public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
@@ -44275,7 +44302,7 @@ public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.S
return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
- public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
+ public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
{
#if DEBUG
if (keyword == null) throw new ArgumentNullException(nameof(keyword));
@@ -44311,7 +44338,7 @@ public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnal
}
#endif
- return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
+ return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken);
}
public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken)
diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs
index 8de77a9a5a756..193d98ab9667a 100644
--- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs
+++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs
@@ -1933,7 +1933,7 @@ public partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken));
public override SyntaxNode? VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
- => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken));
+ => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken));
public override SyntaxNode? VisitRecordDeclaration(RecordDeclarationSyntax node)
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.ClassOrStructKeyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken));
@@ -4891,7 +4891,7 @@ public static StructDeclarationSyntax StructDeclaration(SyntaxListCreates a new InterfaceDeclarationSyntax instance.
- public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
+ public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword));
if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier));
@@ -4913,7 +4913,7 @@ public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed();
+ return (InterfaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.InterfaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed();
}
/// Creates a new RecordDeclarationSyntax instance.
diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs
index d6a04806fa1f6..1bcc2221579c5 100644
--- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs
+++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs
@@ -10088,6 +10088,13 @@ internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode
public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items);
internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items);
+ public abstract ParameterListSyntax? ParameterList { get; }
+ public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList);
+ internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList);
+
+ public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items);
+ internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items);
+
/// Gets the type constraint list.
public abstract SyntaxList ConstraintClauses { get; }
public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses);
@@ -10152,7 +10159,7 @@ public override SyntaxTokenList Modifiers
public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4);
- public new ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5);
+ public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5);
public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6);
@@ -10236,7 +10243,8 @@ public ClassDeclarationSyntax Update(SyntaxList attributeLi
public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList);
public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
- public ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList);
+ public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList);
public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses);
@@ -10260,7 +10268,8 @@ public ClassDeclarationSyntax Update(SyntaxList attributeLi
var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList();
return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items)));
}
- public ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
+ internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items);
+ public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
{
var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList();
return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items)));
@@ -10316,7 +10325,7 @@ public override SyntaxTokenList Modifiers
public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4);
- public new ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5);
+ public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5);
public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6);
@@ -10400,7 +10409,8 @@ public StructDeclarationSyntax Update(SyntaxList attributeL
public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList);
public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
- public StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList);
+ public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList);
public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses);
@@ -10424,7 +10434,8 @@ public StructDeclarationSyntax Update(SyntaxList attributeL
var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList();
return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items)));
}
- public StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
+ internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items);
+ public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
{
var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList();
return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items)));
@@ -10452,6 +10463,7 @@ public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax
{
private SyntaxNode? attributeLists;
private TypeParameterListSyntax? typeParameterList;
+ private ParameterListSyntax? parameterList;
private BaseListSyntax? baseList;
private SyntaxNode? constraintClauses;
private SyntaxNode? members;
@@ -10479,27 +10491,29 @@ public override SyntaxTokenList Modifiers
public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4);
- public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 5);
+ public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5);
- public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6));
+ public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6);
+
+ public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7));
public override SyntaxToken OpenBraceToken
{
get
{
var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken;
- return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default;
+ return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default;
}
}
- public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 8));
+ public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9));
public override SyntaxToken CloseBraceToken
{
get
{
var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken;
- return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default;
+ return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default;
}
}
@@ -10508,7 +10522,7 @@ public override SyntaxToken SemicolonToken
get
{
var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken;
- return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default;
+ return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default;
}
}
@@ -10517,9 +10531,10 @@ public override SyntaxToken SemicolonToken
{
0 => GetRedAtZero(ref this.attributeLists)!,
4 => GetRed(ref this.typeParameterList, 4),
- 5 => GetRed(ref this.baseList, 5),
- 6 => GetRed(ref this.constraintClauses, 6)!,
- 8 => GetRed(ref this.members, 8)!,
+ 5 => GetRed(ref this.parameterList, 5),
+ 6 => GetRed(ref this.baseList, 6),
+ 7 => GetRed(ref this.constraintClauses, 7)!,
+ 9 => GetRed(ref this.members, 9)!,
_ => null,
};
@@ -10528,20 +10543,21 @@ public override SyntaxToken SemicolonToken
{
0 => this.attributeLists,
4 => this.typeParameterList,
- 5 => this.baseList,
- 6 => this.constraintClauses,
- 8 => this.members,
+ 5 => this.parameterList,
+ 6 => this.baseList,
+ 7 => this.constraintClauses,
+ 9 => this.members,
_ => null,
};
public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this);
public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this);
- public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
+ public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
{
- if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
+ if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken)
{
- var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
+ var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
var annotations = GetAnnotations();
return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode;
}
@@ -10550,27 +10566,29 @@ public InterfaceDeclarationSyntax Update(SyntaxList attribu
}
internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists);
- public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers);
- public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword);
- public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier);
- public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList);
- public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList);
+ public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList);
- public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses);
- public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken);
- public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members);
- public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken);
- public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken);
+ public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken);
- public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken);
+ public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken);
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items);
public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items));
@@ -10582,6 +10600,12 @@ public InterfaceDeclarationSyntax Update(SyntaxList attribu
var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList();
return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items)));
}
+ internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items);
+ public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
+ {
+ var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList();
+ return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items)));
+ }
internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items);
public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items)
{
@@ -10641,7 +10665,7 @@ public SyntaxToken ClassOrStructKeyword
public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5);
- public new ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6);
+ public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6);
public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7);
@@ -10726,7 +10750,8 @@ public RecordDeclarationSyntax Update(SyntaxList attributeL
public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList);
public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
- public RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
+ internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList);
+ public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList);
public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken);
internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses);
@@ -10750,7 +10775,8 @@ public RecordDeclarationSyntax Update(SyntaxList attributeL
var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList();
return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items)));
}
- public RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
+ internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items);
+ public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
{
var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList();
return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items)));
diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
index c198dd459306e..bfeb9ecb15c17 100644
--- a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
+++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
@@ -1457,7 +1457,7 @@ private TypeDeclarationSyntax ParseClassOrStructOrInterfaceDeclaration(SyntaxLis
var name = this.ParseIdentifierToken();
var typeParameters = this.ParseTypeParameterList();
- var paramList = CurrentToken.Kind == SyntaxKind.OpenParenToken && keyword.Kind is not SyntaxKind.InterfaceKeyword
+ var paramList = CurrentToken.Kind == SyntaxKind.OpenParenToken
? ParseParenthesizedParameterList() : null;
var baseList = this.ParseBaseList();
@@ -1641,13 +1641,13 @@ static TypeDeclarationSyntax constructTypeDeclaration(ContextAwareSyntax syntaxF
semicolon);
case SyntaxKind.InterfaceKeyword:
- RoslynDebug.Assert(paramList is null);
return syntaxFactory.InterfaceDeclaration(
attributes,
modifiersList,
keyword,
name,
typeParameters,
+ paramList,
baseList,
constraintsList,
openBrace,
diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
index 156b59ccf661b..2e9137c94473c 100644
--- a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
+++ b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
@@ -1,14 +1,23 @@
static Microsoft.CodeAnalysis.CSharpExtensions.ContainsDirective(this Microsoft.CodeAnalysis.SyntaxNode! node, Microsoft.CodeAnalysis.CSharp.SyntaxKind kind) -> bool
Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.AddParameterListParameters(params Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax![]! items) -> Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax!
-Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+override Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax!
Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.WithParameterList(Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList) -> Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax!
Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.AddParameterListParameters(params Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax![]! items) -> Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax!
-Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+override Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax!
Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.WithParameterList(Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList) -> Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax!
-Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+abstract Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax.WithParameterList(Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList) -> Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax!
+Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax.AddParameterListParameters(params Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax![]! items) -> Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax!
+override Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax!
+Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.WithParameterList(Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList) -> Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax!
+Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.AddParameterListParameters(params Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax![]! items) -> Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax!
+*REMOVED*Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
+override Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax.ParameterList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax?
static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ClassDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxList members) -> Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax!
static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ClassDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax!
static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.StructDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxList members) -> Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax!
static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.StructDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax!
+static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.InterfaceDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax? typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax? parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax? baseList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SyntaxList members, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax!
diff --git a/src/Compilers/CSharp/Portable/Syntax/ClassDeclarationSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/ClassDeclarationSyntax.cs
index 39f43ff2b4686..e8e8472e24320 100644
--- a/src/Compilers/CSharp/Portable/Syntax/ClassDeclarationSyntax.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/ClassDeclarationSyntax.cs
@@ -10,15 +10,5 @@ public ClassDeclarationSyntax Update(SyntaxList attributeLi
{
return Update(attributeLists, modifiers, keyword, identifier, typeParameterList, ParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
}
-
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
- }
-}
-
-namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
-{
- partial class ClassDeclarationSyntax
- {
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
}
}
diff --git a/src/Compilers/CSharp/Portable/Syntax/InterfaceDeclarationSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/InterfaceDeclarationSyntax.cs
index 9353afe22016e..336fd48735e3e 100644
--- a/src/Compilers/CSharp/Portable/Syntax/InterfaceDeclarationSyntax.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/InterfaceDeclarationSyntax.cs
@@ -6,14 +6,9 @@ namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
partial class InterfaceDeclarationSyntax
{
- protected override ParameterListSyntax? ParameterListCore => null;
- }
-}
-
-namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
-{
- partial class InterfaceDeclarationSyntax
- {
- protected override ParameterListSyntax? ParameterListCore => null;
+ public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
+ {
+ return Update(attributeLists, modifiers, keyword, identifier, typeParameterList, ParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
+ }
}
}
diff --git a/src/Compilers/CSharp/Portable/Syntax/RecordDeclarationSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/RecordDeclarationSyntax.cs
index ee360bb646ccc..d5e6554b9eaa5 100644
--- a/src/Compilers/CSharp/Portable/Syntax/RecordDeclarationSyntax.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/RecordDeclarationSyntax.cs
@@ -16,16 +16,6 @@ public RecordDeclarationSyntax Update(SyntaxList attributeL
return Update(attributeLists, modifiers, keyword, this.ClassOrStructKeyword, identifier,
typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
}
-
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
- }
-}
-
-namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
-{
- partial class RecordDeclarationSyntax
- {
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
}
}
diff --git a/src/Compilers/CSharp/Portable/Syntax/StructDeclarationSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/StructDeclarationSyntax.cs
index 0a6490ab26747..a9b137418e5c2 100644
--- a/src/Compilers/CSharp/Portable/Syntax/StructDeclarationSyntax.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/StructDeclarationSyntax.cs
@@ -10,15 +10,5 @@ public StructDeclarationSyntax Update(SyntaxList attributeL
{
return Update(attributeLists, modifiers, keyword, identifier, typeParameterList, ParameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
}
-
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
- }
-}
-
-namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
-{
- partial class StructDeclarationSyntax
- {
- protected override ParameterListSyntax? ParameterListCore => ParameterList;
}
}
diff --git a/src/Compilers/CSharp/Portable/Syntax/Syntax.xml b/src/Compilers/CSharp/Portable/Syntax/Syntax.xml
index 1845c79ddb63b..6ae52c8520b6f 100644
--- a/src/Compilers/CSharp/Portable/Syntax/Syntax.xml
+++ b/src/Compilers/CSharp/Portable/Syntax/Syntax.xml
@@ -3344,6 +3344,7 @@
+
Gets the type constraint list.
@@ -3372,7 +3373,7 @@
-
+
@@ -3403,7 +3404,7 @@
-
+
@@ -3434,6 +3435,7 @@
+
@@ -3463,7 +3465,7 @@
-
+
diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
index e0947db83f2e0..c4868337108cf 100644
--- a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
@@ -2888,6 +2888,12 @@ public static StructDeclarationSyntax StructDeclaration(SyntaxToken identifier)
public static StructDeclarationSyntax StructDeclaration(string identifier)
=> SyntaxFactory.StructDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.StructKeyword), SyntaxFactory.Identifier(identifier), null, null, null, default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default);
+ /// Creates a new InterfaceDeclarationSyntax instance.
+ public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken)
+ {
+ return InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
+ }
+
/// Creates a new InterfaceDeclarationSyntax instance.
public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxList members)
=> SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), identifier, typeParameterList, baseList, constraintClauses, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default);
diff --git a/src/Compilers/CSharp/Portable/Syntax/TypeDeclarationSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/TypeDeclarationSyntax.cs
index dc6bd3e383d17..58a8383b2bdee 100644
--- a/src/Compilers/CSharp/Portable/Syntax/TypeDeclarationSyntax.cs
+++ b/src/Compilers/CSharp/Portable/Syntax/TypeDeclarationSyntax.cs
@@ -30,10 +30,6 @@ public int Arity
public new TypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers)
=> (TypeDeclarationSyntax)WithModifiersCore(modifiers);
- public ParameterListSyntax? ParameterList => ParameterListCore;
-
- protected abstract ParameterListSyntax? ParameterListCore { get; }
-
internal PrimaryConstructorBaseTypeSyntax? PrimaryConstructorBaseTypeIfClass
{
get
@@ -49,16 +45,6 @@ internal PrimaryConstructorBaseTypeSyntax? PrimaryConstructorBaseTypeIfClass
}
}
-namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
-{
- partial class TypeDeclarationSyntax
- {
- public ParameterListSyntax? ParameterList => ParameterListCore;
-
- protected abstract ParameterListSyntax? ParameterListCore { get; }
- }
-}
-
namespace Microsoft.CodeAnalysis.CSharp
{
public static partial class SyntaxFactory
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
index 2053c71b995eb..d97bbedd5585c 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
@@ -1697,6 +1697,11 @@
Před vrácením řízení volajícímu se musí plně přiřadit pole {0}. Zvažte aktualizaci jazykové verze {1} na automatické výchozí nastavení pole.
+
+
+ Unexpected parameter list.
+
+
{0} má atribut UnmanagedCallersOnly a nedá se volat napřímo. Pro tuto metodu získejte ukazatel na funkci.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
index 8acecbb9f4b85..63960c2cab45c 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
@@ -1697,6 +1697,11 @@
Das Feld "{0}" muss vollständig zugewiesen werden, bevor das Steuerelement an den Aufrufer zurückgegeben wird. Aktualisieren Sie ggf. auf die Sprachversion "{1}", um das Feld automatisch als Standard zu verwenden.
+
+
+ Unexpected parameter list.
+
+
"{0}" ist mit dem Attribut "UnmanagedCallersOnly" versehen und kann nicht direkt aufgerufen werden. Rufen Sie einen Funktionszeiger auf diese Methode ab.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
index 95f4e37dedd00..98e26c51e5a2c 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
@@ -1697,6 +1697,11 @@
El campo '{0}' debe estar totalmente asignado antes de que el control se devuelva al autor de la llamada. Considere la posibilidad de actualizar a la versión de idioma "{1}" para establecer automáticamente el valor predeterminado del campo.
+
+
+ Unexpected parameter list.
+
+
"{0}" tiene un atributo "UnmanagedCallersOnly" y no se le puede llamar directamente. Obtenga un puntero de función a este método.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
index e3f4df0c4b22b..eb473d1b0e17b 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
@@ -1697,6 +1697,11 @@
Le champ '{0}' doit être entièrement attribué avant que le contrôle soit retourné à l’appelant. Envisagez de mettre à jour la version de langue «{1}» pour définir automatiquement le champ par défaut.
+
+
+ Unexpected parameter list.
+
+
'{0}' est attribué avec 'UnmanagedCallersOnly' et ne peut pas être appelé directement. Obtenez un pointeur de fonction vers cette méthode.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
index 2afb256b9a457..96e5b0010677a 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
@@ -1697,6 +1697,11 @@
Il campo '{0}' deve essere assegnato completamente prima che il controllo sia restituito al chiamante. Provare a eseguire l'aggiornamento alla versione del linguaggio '{1}' per impostare automaticamente il campo come predefinito.
+
+
+ Unexpected parameter list.
+
+
'{0}', a cui è assegnato l'attributo 'UnmanagedCallersOnly', non può essere chiamato direttamente. Ottenere un puntatore a funzione per questo metodo.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
index da891e9fbecd0..d7a7b6c660cce 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
@@ -1697,6 +1697,11 @@
コントロールを呼び出し元に返す前に、フィールド '{0}' を完全に割り当てる必要があります。プロパティを自動既定値にするため '{1}' 言語バージョンに更新することを検討してください。
+
+
+ Unexpected parameter list.
+
+
'{0}' は 'UnmanagedCallersOnly' 属性が設定されているため、直接呼び出すことはできません。このメソッドへの関数ポインターを取得してください。
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
index 84371fc4edcd3..c3d4b6835ed57 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
@@ -1697,6 +1697,11 @@
제어가 호출자에게 반환되기 전에 필드 '{0}'이(가) 완전히 할당되어야 합니다. 필드를 자동으로 기본 설정하려면 언어 버전 '{1}'으로 업데이트하는 것이 좋습니다.
+
+
+ Unexpected parameter list.
+
+
'{0}'에는 'UnmanagedCallersOnly' 특성을 지정할 수 없으며 이 항목은 직접 호출할 수 없습니다. 이 메서드에 대한 함수 포인터를 가져오세요.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
index f010cce374a13..941e195165867 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
@@ -1697,6 +1697,11 @@
Pole „{0}” musi być w pełni przypisane, zanim kontrolka zostanie zwrócona do obiektu wywołującego. Rozważ zaktualizowanie pola do wersji językowej „{1}”, aby automatycznie ustawić domyślne pole.
+
+
+ Unexpected parameter list.
+
+
Element „{0}” ma atrybut „UnmanagedCallersOnly” i nie można go wywołać bezpośrednio. Uzyskaj wskaźnik funkcji do tej metody.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
index a490adb1780e1..2ee1e032c653a 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
@@ -1697,6 +1697,11 @@
O campo '{0}' deve ser totalmente atribuída antes que o controle seja devolvido ao chamador. Considere atualizar para a versão de linguagem '{1}' para auto-padrão do campo.
+
+
+ Unexpected parameter list.
+
+
'{0}' foi atribuído com 'UnmanagedCallersOnly' e não pode ser chamado diretamente. Obtenha um ponteiro de função para esse método.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
index 705056943a4f4..9c732bf8321f2 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
@@ -1697,6 +1697,11 @@
Поле '{0}' должно быть полностью назначенным перед возвратом контроля вызывающему элементу. Попробуйте обновить поле до языковой версии "{1}", чтобы автоматически применить значение по умолчанию.
+
+
+ Unexpected parameter list.
+
+
"{0}" имеет атрибут "UnmanagedCallersOnly" и не может вызываться напрямую. Получите указатель на функцию для этого метода.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
index ea4e6d5e2dd79..e3c18bcef17bb 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
@@ -1697,6 +1697,11 @@
Denetim çağırana döndürülmeden önce '{0}' alanı tam olarak atanmalıdır. Alanı otomatik olarak varsayılan durumuna getirmek için '{1}' dil sürümüne güncelleştirmeyi düşünün.
+
+
+ Unexpected parameter list.
+
+
'{0}', 'UnmanagedCallersOnly' ile ilişkilendirilmiş ve doğrudan çağrılamaz. Bu yöntem için bir işlev işaretçisi edinin.
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
index 63cdd5468898c..8b5b2b0f2ddeb 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
@@ -1697,6 +1697,11 @@
必须先完全分配字段 '{0}' ,然后才能将控件返回给调用方。请考虑更新到语言版本 '{1}' 以自动默认字段。
+
+
+ Unexpected parameter list.
+
+
“{0}”使用 "UnmanagedCallersOnly" 进行特性化,无法直接调用。请获取指向此方法的函数指针。
diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
index 577633b9b702c..de8359ca3dafc 100644
--- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
+++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
@@ -1697,6 +1697,11 @@
在控制項傳回呼叫者之前,必須先完全指派欄位 '{0}'。請考慮更新至語言版本 '{1}' 以自動預設欄位。
+
+
+ Unexpected parameter list.
+
+
'{0}' 使用 'UnmanagedCallersOnly' 屬性化,因此無法直接呼叫。取得此方法的函式指標。
diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PrimaryConstructorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PrimaryConstructorTests.cs
index 5d6603e9b5400..0f731ca131dad 100644
--- a/src/Compilers/CSharp/Test/Semantic/Semantics/PrimaryConstructorTests.cs
+++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PrimaryConstructorTests.cs
@@ -7698,9 +7698,11 @@ public void ParameterCapturing_001()
var source = @"
class Base
{
+ public System.Func Z;
public Base(int x, int y, System.Func z)
{
System.Console.Write(z() - 1);
+ Z = z;
}
}
@@ -7733,6 +7735,7 @@ static void Main()
System.Console.Write(c1.M1());
System.Console.Write(c1.P1);
System.Console.Write(c1.P2);
+ System.Console.Write(c1.Z());
}
}
";
@@ -7752,14 +7755,14 @@ static void Main()
Assert.Contains(symbol, model.LookupSymbols(p1.SpanStart, name: "p1"));
}
- var verifier = CompileAndVerify(comp, expectedOutput: @"122123124125", verify: Verification.Fails).VerifyDiagnostics(
- // (15,50): warning CS9502: Parameter 'int p1' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.
+ var verifier = CompileAndVerify(comp, expectedOutput: @"122123124125125", verify: Verification.Fails).VerifyDiagnostics(
+ // (17,50): warning CS9502: Parameter 'int p1' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.
// partial class C1 (int p1, int p2, int p3) : Base(p1, p2, () => p1)
- Diagnostic(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, "p1").WithArguments("int p1").WithLocation(15, 50)
+ Diagnostic(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, "p1").WithArguments("int p1").WithLocation(17, 50)
);
verifier.VerifyTypeIL("C1", @"
- .class private auto ansi beforefieldinit C1
+.class private auto ansi beforefieldinit C1
extends Base
{
// Nested Types
@@ -7776,7 +7779,7 @@ .field public class C1 '<>4__this'
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
- // Method begins at RVA 0x2203
+ // Method begins at RVA 0x221b
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
@@ -7786,7 +7789,7 @@ .maxstack 8
.method assembly hidebysig
instance void '<.ctor>b__0' () cil managed
{
- // Method begins at RVA 0x220c
+ // Method begins at RVA 0x2224
// Code size 17 (0x11)
.maxstack 3
.locals init (
@@ -7805,7 +7808,7 @@ [0] int32
.method assembly hidebysig
instance int32 '<.ctor>b__1' () cil managed
{
- // Method begins at RVA 0x2229
+ // Method begins at RVA 0x2241
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
@@ -7834,7 +7837,7 @@ instance void .ctor (
int32 p3
) cil managed
{
- // Method begins at RVA 0x207c
+ // Method begins at RVA 0x2084
// Code size 98 (0x62)
.maxstack 5
.locals init (
@@ -7884,7 +7887,7 @@ [0] class C1/'<>c__DisplayClass1_0'
.method public hidebysig specialname
instance int32 get_P1 () cil managed
{
- // Method begins at RVA 0x20ea
+ // Method begins at RVA 0x20f2
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
@@ -7894,7 +7897,7 @@ .maxstack 8
.method public hidebysig specialname
instance int32 get_P2 () cil managed
{
- // Method begins at RVA 0x20f4
+ // Method begins at RVA 0x20fc
// Code size 18 (0x12)
.maxstack 3
.locals init (
@@ -7914,7 +7917,7 @@ [0] int32
.method public hidebysig
instance int32 M1 () cil managed
{
- // Method begins at RVA 0x2114
+ // Method begins at RVA 0x211c
// Code size 18 (0x12)
.maxstack 3
.locals init (
@@ -7936,7 +7939,7 @@ instance void add_E1 (
class [mscorlib]System.Action 'value'
) cil managed
{
- // Method begins at RVA 0x2132
+ // Method begins at RVA 0x213a
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
@@ -7952,7 +7955,7 @@ instance void remove_E1 (
class [mscorlib]System.Action 'value'
) cil managed
{
- // Method begins at RVA 0x2142
+ // Method begins at RVA 0x214a
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
@@ -7967,7 +7970,7 @@ class [mscorlib]System.Action 'value'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
- // Method begins at RVA 0x214c
+ // Method begins at RVA 0x2154
// Code size 41 (0x29)
.maxstack 3
.locals init (
@@ -8006,7 +8009,7 @@ class [mscorlib]System.Action 'value'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
- // Method begins at RVA 0x2184
+ // Method begins at RVA 0x218c
// Code size 41 (0x29)
.maxstack 3
.locals init (
@@ -8040,7 +8043,7 @@ [2] class [mscorlib]System.Action
.method public hidebysig
instance class [mscorlib]System.Action M2 () cil managed
{
- // Method begins at RVA 0x21b9
+ // Method begins at RVA 0x21c1
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.0
@@ -8054,7 +8057,7 @@ .method private hidebysig
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
- // Method begins at RVA 0x21c7
+ // Method begins at RVA 0x21cf
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
@@ -8071,7 +8074,7 @@ .method private hidebysig
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
- // Method begins at RVA 0x2132
+ // Method begins at RVA 0x213a
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
@@ -14763,6 +14766,265 @@ class C1 (dynamic p1)
).VerifyDiagnostics();
}
+ [Fact]
+ public void ParameterCapturing_151_LambdasCaptureOnlyCapturedParameter()
+ {
+ var source = @"
+class Base
+{
+ public System.Func Z;
+ public Base(int x, int y, System.Func z)
+ {
+ System.Console.Write(z() - 1);
+ Z = z;
+ }
+}
+
+partial class C1
+{
+ public int F1 = p2 + 1;
+}
+
+partial class C1 (int p1, int p2) : Base(p1, p2, () => p1)
+{
+ public int F2 = p2 + 2;
+ public int P1 => p1;
+}
+
+partial class C1
+{
+ public int F3 = p2 + 3;
+ public int P2 => ++p1;
+ public int M1() { return p1++; }
+ event System.Action E1 { add { p1++; } remove { void local() { p1--; } local(); }}
+ public System.Action M2() => () => p1++;
+}
+
+class Program
+{
+ static void Main()
+ {
+ var c1 = new C1(123,-1);
+ System.Console.Write(c1.M1());
+ System.Console.Write(c1.P1);
+ System.Console.Write(c1.P2);
+ System.Console.Write(c1.Z());
+ }
+}
+";
+ var comp = CreateCompilation(source, options: TestOptions.ReleaseExe);
+
+ var verifier = CompileAndVerify(comp, expectedOutput: @"122123124125125", verify: Verification.Fails).VerifyDiagnostics(
+ // (17,42): warning CS9502: Parameter 'int p1' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.
+ // partial class C1 (int p1, int p2) : Base(p1, p2, () => p1)
+ Diagnostic(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, "p1").WithArguments("int p1").WithLocation(17, 42)
+ );
+
+ verifier.VerifyTypeIL("C1", @"
+.class private auto ansi beforefieldinit C1
+ extends Base
+{
+ // Fields
+ .field public int32 F1
+ .field private int32 'PC__BackingField'
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
+ 01 00 00 00
+ )
+ .field public int32 F2
+ .field public int32 F3
+ // Methods
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor (
+ int32 p1,
+ int32 p2
+ ) cil managed
+ {
+ // Method begins at RVA 0x2083
+ // Code size 60 (0x3c)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: stfld int32 C1::'PC__BackingField'
+ IL_0007: ldarg.0
+ IL_0008: ldarg.2
+ IL_0009: ldc.i4.1
+ IL_000a: add
+ IL_000b: stfld int32 C1::F1
+ IL_0010: ldarg.0
+ IL_0011: ldarg.2
+ IL_0012: ldc.i4.2
+ IL_0013: add
+ IL_0014: stfld int32 C1::F2
+ IL_0019: ldarg.0
+ IL_001a: ldarg.2
+ IL_001b: ldc.i4.3
+ IL_001c: add
+ IL_001d: stfld int32 C1::F3
+ IL_0022: ldarg.0
+ IL_0023: ldarg.0
+ IL_0024: ldfld int32 C1::'PC__BackingField'
+ IL_0029: ldarg.2
+ IL_002a: ldarg.0
+ IL_002b: ldftn instance int32 C1::'<.ctor>b__1_0'()
+ IL_0031: newobj instance void class [mscorlib]System.Func`1::.ctor(object, native int)
+ IL_0036: call instance void Base::.ctor(int32, int32, class [mscorlib]System.Func`1)
+ IL_003b: ret
+ } // end of method C1::.ctor
+ .method public hidebysig specialname
+ instance int32 get_P1 () cil managed
+ {
+ // Method begins at RVA 0x20c0
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 C1::'PC__BackingField'
+ IL_0006: ret
+ } // end of method C1::get_P1
+ .method public hidebysig specialname
+ instance int32 get_P2 () cil managed
+ {
+ // Method begins at RVA 0x20c8
+ // Code size 18 (0x12)
+ .maxstack 3
+ .locals init (
+ [0] int32
+ )
+ IL_0000: ldarg.0
+ IL_0001: ldarg.0
+ IL_0002: ldfld int32 C1::'PC__BackingField'
+ IL_0007: ldc.i4.1
+ IL_0008: add
+ IL_0009: stloc.0
+ IL_000a: ldloc.0
+ IL_000b: stfld int32 C1::'PC__BackingField'
+ IL_0010: ldloc.0
+ IL_0011: ret
+ } // end of method C1::get_P2
+ .method public hidebysig
+ instance int32 M1 () cil managed
+ {
+ // Method begins at RVA 0x20e8
+ // Code size 18 (0x12)
+ .maxstack 3
+ .locals init (
+ [0] int32
+ )
+ IL_0000: ldarg.0
+ IL_0001: ldarg.0
+ IL_0002: ldfld int32 C1::'PC__BackingField'
+ IL_0007: stloc.0
+ IL_0008: ldloc.0
+ IL_0009: ldc.i4.1
+ IL_000a: add
+ IL_000b: stfld int32 C1::'PC__BackingField'
+ IL_0010: ldloc.0
+ IL_0011: ret
+ } // end of method C1::M1
+ .method private hidebysig specialname
+ instance void add_E1 (
+ class [mscorlib]System.Action 'value'
+ ) cil managed
+ {
+ // Method begins at RVA 0x2106
+ // Code size 15 (0xf)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.0
+ IL_0002: ldfld int32 C1::'PC__BackingField'
+ IL_0007: ldc.i4.1
+ IL_0008: add
+ IL_0009: stfld int32 C1::'PC__BackingField'
+ IL_000e: ret
+ } // end of method C1::add_E1
+ .method private hidebysig specialname
+ instance void remove_E1 (
+ class [mscorlib]System.Action 'value'
+ ) cil managed
+ {
+ // Method begins at RVA 0x2116
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void C1::'g__local|12_0'()
+ IL_0006: ret
+ } // end of method C1::remove_E1
+ .method public hidebysig
+ instance class [mscorlib]System.Action M2 () cil managed
+ {
+ // Method begins at RVA 0x211e
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldftn instance void C1::'b__13_0'()
+ IL_0007: newobj instance void [mscorlib]System.Action::.ctor(object, native int)
+ IL_000c: ret
+ } // end of method C1::M2
+ .method private hidebysig
+ instance int32 '<.ctor>b__1_0' () cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
+ 01 00 00 00
+ )
+ // Method begins at RVA 0x20c0
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 C1::'PC__BackingField'
+ IL_0006: ret
+ } // end of method C1::'<.ctor>b__1_0'
+ .method private hidebysig
+ instance void 'g__local|12_0' () cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
+ 01 00 00 00
+ )
+ // Method begins at RVA 0x212c
+ // Code size 15 (0xf)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.0
+ IL_0002: ldfld int32 C1::'PC__BackingField'
+ IL_0007: ldc.i4.1
+ IL_0008: sub
+ IL_0009: stfld int32 C1::'PC__BackingField'
+ IL_000e: ret
+ } // end of method C1::'g__local|12_0'
+ .method private hidebysig
+ instance void 'b__13_0' () cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
+ 01 00 00 00
+ )
+ // Method begins at RVA 0x2106
+ // Code size 15 (0xf)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.0
+ IL_0002: ldfld int32 C1::'PC__BackingField'
+ IL_0007: ldc.i4.1
+ IL_0008: add
+ IL_0009: stfld int32 C1::'PC__BackingField'
+ IL_000e: ret
+ } // end of method C1::'b__13_0'
+ // Events
+ .event [mscorlib]System.Action E1
+ {
+ .addon instance void C1::add_E1(class [mscorlib]System.Action)
+ .removeon instance void C1::remove_E1(class [mscorlib]System.Action)
+ }
+ // Properties
+ .property instance int32 P1()
+ {
+ .get instance int32 C1::get_P1()
+ }
+ .property instance int32 P2()
+ {
+ .get instance int32 C1::get_P2()
+ }
+} // end of class C1
+".Replace("[mscorlib]", ExecutionConditionUtil.IsDesktop ? "[mscorlib]" : "[netstandard]"));
+ }
+
[Fact]
public void CycleDueToIndexerNameAttribute_01()
{
diff --git a/src/Compilers/CSharp/Test/Syntax/Generated/Syntax.Test.xml.Generated.cs b/src/Compilers/CSharp/Test/Syntax/Generated/Syntax.Test.xml.Generated.cs
index c39dd3caad8c0..9ad6b1a531116 100644
--- a/src/Compilers/CSharp/Test/Syntax/Generated/Syntax.Test.xml.Generated.cs
+++ b/src/Compilers/CSharp/Test/Syntax/Generated/Syntax.Test.xml.Generated.cs
@@ -494,7 +494,7 @@ private static Syntax.InternalSyntax.StructDeclarationSyntax GenerateStructDecla
=> InternalSyntaxFactory.StructDeclaration(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), InternalSyntaxFactory.Token(SyntaxKind.StructKeyword), InternalSyntaxFactory.Identifier("Identifier"), null, null, null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, null);
private static Syntax.InternalSyntax.InterfaceDeclarationSyntax GenerateInterfaceDeclaration()
- => InternalSyntaxFactory.InterfaceDeclaration(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), InternalSyntaxFactory.Token(SyntaxKind.InterfaceKeyword), InternalSyntaxFactory.Identifier("Identifier"), null, null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, null);
+ => InternalSyntaxFactory.InterfaceDeclaration(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), InternalSyntaxFactory.Token(SyntaxKind.InterfaceKeyword), InternalSyntaxFactory.Identifier("Identifier"), null, null, null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, null);
private static Syntax.InternalSyntax.RecordDeclarationSyntax GenerateRecordDeclaration()
=> InternalSyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), InternalSyntaxFactory.Identifier("Keyword"), null, InternalSyntaxFactory.Identifier("Identifier"), null, null, null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(), null, null);
@@ -2747,6 +2747,7 @@ public void TestInterfaceDeclarationFactoryAndProperties()
Assert.Equal(SyntaxKind.InterfaceKeyword, node.Keyword.Kind);
Assert.Equal(SyntaxKind.IdentifierToken, node.Identifier.Kind);
Assert.Null(node.TypeParameterList);
+ Assert.Null(node.ParameterList);
Assert.Null(node.BaseList);
Assert.Equal(default, node.ConstraintClauses);
Assert.Null(node.OpenBraceToken);
@@ -10468,7 +10469,7 @@ private static StructDeclarationSyntax GenerateStructDeclaration()
=> SyntaxFactory.StructDeclaration(new SyntaxList(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.StructKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList(), default(SyntaxToken), new SyntaxList(), default(SyntaxToken), default(SyntaxToken));
private static InterfaceDeclarationSyntax GenerateInterfaceDeclaration()
- => SyntaxFactory.InterfaceDeclaration(new SyntaxList(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(BaseListSyntax), new SyntaxList(), default(SyntaxToken), new SyntaxList(), default(SyntaxToken), default(SyntaxToken));
+ => SyntaxFactory.InterfaceDeclaration(new SyntaxList(), new SyntaxTokenList(), SyntaxFactory.Token(SyntaxKind.InterfaceKeyword), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList(), default(SyntaxToken), new SyntaxList(), default(SyntaxToken), default(SyntaxToken));
private static RecordDeclarationSyntax GenerateRecordDeclaration()
=> SyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, new SyntaxList(), new SyntaxTokenList(), SyntaxFactory.Identifier("Keyword"), default(SyntaxToken), SyntaxFactory.Identifier("Identifier"), default(TypeParameterListSyntax), default(ParameterListSyntax), default(BaseListSyntax), new SyntaxList(), default(SyntaxToken), new SyntaxList(), default(SyntaxToken), default(SyntaxToken));
@@ -12721,13 +12722,14 @@ public void TestInterfaceDeclarationFactoryAndProperties()
Assert.Equal(SyntaxKind.InterfaceKeyword, node.Keyword.Kind());
Assert.Equal(SyntaxKind.IdentifierToken, node.Identifier.Kind());
Assert.Null(node.TypeParameterList);
+ Assert.Null(node.ParameterList);
Assert.Null(node.BaseList);
Assert.Equal(default, node.ConstraintClauses);
Assert.Equal(SyntaxKind.None, node.OpenBraceToken.Kind());
Assert.Equal(default, node.Members);
Assert.Equal(SyntaxKind.None, node.CloseBraceToken.Kind());
Assert.Equal(SyntaxKind.None, node.SemicolonToken.Kind());
- var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithKeyword(node.Keyword).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithBaseList(node.BaseList).WithConstraintClauses(node.ConstraintClauses).WithOpenBraceToken(node.OpenBraceToken).WithMembers(node.Members).WithCloseBraceToken(node.CloseBraceToken).WithSemicolonToken(node.SemicolonToken);
+ var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithKeyword(node.Keyword).WithIdentifier(node.Identifier).WithTypeParameterList(node.TypeParameterList).WithParameterList(node.ParameterList).WithBaseList(node.BaseList).WithConstraintClauses(node.ConstraintClauses).WithOpenBraceToken(node.OpenBraceToken).WithMembers(node.Members).WithCloseBraceToken(node.CloseBraceToken).WithSemicolonToken(node.SemicolonToken);
Assert.Equal(node, newNode);
}
diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/RecordParsing.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/RecordParsing.cs
index b0ee3be84433e..aacdd3b77a7d0 100644
--- a/src/Compilers/CSharp/Test/Syntax/Parsing/RecordParsing.cs
+++ b/src/Compilers/CSharp/Test/Syntax/Parsing/RecordParsing.cs
@@ -2,6 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable disable
+
+using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
@@ -325,45 +328,55 @@ public void RecordParsing07()
{
var text = "interface P(int x, int y);";
var tree = ParseTree(text, options: TestOptions.Regular8);
- tree.GetDiagnostics().Verify(
- // (1,12): error CS1514: { expected
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_LbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS1513: } expected
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_RbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS8803: Top-level statements must precede namespace and type declarations.
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType, "(int x, int y);").WithLocation(1, 12));
+ tree.GetDiagnostics().Verify();
- CreateCompilation(text, parseOptions: TestOptions.Regular8).VerifyDiagnostics(
- // (1,12): error CS1514: { expected
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_LbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS1513: } expected
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_RbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS8803: Top-level statements must precede namespace and type declarations.
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType, "(int x, int y);").WithLocation(1, 12),
- // (1,12): error CS8400: Feature 'top-level statements' is not available in C# 8.0. Please use language version 9.0 or greater.
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion8, "(int x, int y);").WithArguments("top-level statements", "9.0").WithLocation(1, 12),
- // (1,12): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_IllegalStatement, "(int x, int y)").WithLocation(1, 12),
- // (1,13): error CS8185: A declaration is not allowed in this context.
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int x").WithLocation(1, 13),
- // (1,13): error CS0165: Use of unassigned local variable 'x'
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_UseDefViolation, "int x").WithArguments("x").WithLocation(1, 13),
- // (1,20): error CS8185: A declaration is not allowed in this context.
- // interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_DeclarationExpressionNotPermitted, "int y").WithLocation(1, 20),
- // (1,20): error CS0165: Use of unassigned local variable 'y'
+ tree = ParseTree(text, options: TestOptions.RegularPreview);
+ tree.GetDiagnostics().Verify();
+
+ var comp = CreateCompilation(text).VerifyDiagnostics(
+ // (1,12): error CS9517: Unexpected parameter list.
// interface P(int x, int y);
- Diagnostic(ErrorCode.ERR_UseDefViolation, "int y").WithArguments("y").WithLocation(1, 20));
+ Diagnostic(ErrorCode.ERR_UnexpectedParameterList, "(int x, int y)").WithLocation(1, 12)
+ );
+
+ Assert.Empty(comp.GetTypeByMetadataName("P").GetMembers());
+ Assert.Null(((SourceMemberContainerTypeSymbol)comp.GetTypeByMetadataName("P")).PrimaryConstructor);
+
+ UsingNode(text);
+
+ N(SyntaxKind.CompilationUnit);
+ {
+ N(SyntaxKind.InterfaceDeclaration);
+ {
+ N(SyntaxKind.InterfaceKeyword);
+ N(SyntaxKind.IdentifierToken, "P");
+ N(SyntaxKind.ParameterList);
+ {
+ N(SyntaxKind.OpenParenToken);
+ N(SyntaxKind.Parameter);
+ {
+ N(SyntaxKind.PredefinedType);
+ {
+ N(SyntaxKind.IntKeyword);
+ }
+ N(SyntaxKind.IdentifierToken, "x");
+ }
+ N(SyntaxKind.CommaToken);
+ N(SyntaxKind.Parameter);
+ {
+ N(SyntaxKind.PredefinedType);
+ {
+ N(SyntaxKind.IntKeyword);
+ }
+ N(SyntaxKind.IdentifierToken, "y");
+ }
+ N(SyntaxKind.CloseParenToken);
+ }
+ N(SyntaxKind.SemicolonToken);
+ }
+ N(SyntaxKind.EndOfFileToken);
+ }
+ EOF();
}
[Fact]
@@ -2391,23 +2404,7 @@ public void Base_03()
public void Base_04()
{
var text = "interface C(int X, int Y) : B;";
- UsingTree(text,
- // (1,12): error CS1514: { expected
- // interface C(int X, int Y) : B;
- Diagnostic(ErrorCode.ERR_LbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS1513: } expected
- // interface C(int X, int Y) : B;
- Diagnostic(ErrorCode.ERR_RbraceExpected, "(").WithLocation(1, 12),
- // (1,12): error CS8803: Top-level statements must precede namespace and type declarations.
- // interface C(int X, int Y) : B;
- Diagnostic(ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType, "(int X, int Y) ").WithLocation(1, 12),
- // (1,27): error CS1002: ; expected
- // interface C(int X, int Y) : B;
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ":").WithLocation(1, 27),
- // (1,27): error CS1022: Type or namespace definition, or end-of-file expected
- // interface C(int X, int Y) : B;
- Diagnostic(ErrorCode.ERR_EOFExpected, ":").WithLocation(1, 27)
- );
+ UsingTree(text);
N(SyntaxKind.CompilationUnit);
{
@@ -2415,60 +2412,40 @@ public void Base_04()
{
N(SyntaxKind.InterfaceKeyword);
N(SyntaxKind.IdentifierToken, "C");
- M(SyntaxKind.OpenBraceToken);
- M(SyntaxKind.CloseBraceToken);
- }
- N(SyntaxKind.GlobalStatement);
- {
- N(SyntaxKind.ExpressionStatement);
+ N(SyntaxKind.ParameterList);
{
- N(SyntaxKind.TupleExpression);
+ N(SyntaxKind.OpenParenToken);
+ N(SyntaxKind.Parameter);
{
- N(SyntaxKind.OpenParenToken);
- N(SyntaxKind.Argument);
+ N(SyntaxKind.PredefinedType);
{
- N(SyntaxKind.DeclarationExpression);
- {
- N(SyntaxKind.PredefinedType);
- {
- N(SyntaxKind.IntKeyword);
- }
- N(SyntaxKind.SingleVariableDesignation);
- {
- N(SyntaxKind.IdentifierToken, "X");
- }
- }
+ N(SyntaxKind.IntKeyword);
}
- N(SyntaxKind.CommaToken);
- N(SyntaxKind.Argument);
+ N(SyntaxKind.IdentifierToken, "X");
+ }
+ N(SyntaxKind.CommaToken);
+ N(SyntaxKind.Parameter);
+ {
+ N(SyntaxKind.PredefinedType);
{
- N(SyntaxKind.DeclarationExpression);
- {
- N(SyntaxKind.PredefinedType);
- {
- N(SyntaxKind.IntKeyword);
- }
- N(SyntaxKind.SingleVariableDesignation);
- {
- N(SyntaxKind.IdentifierToken, "Y");
- }
- }
+ N(SyntaxKind.IntKeyword);
}
- N(SyntaxKind.CloseParenToken);
+ N(SyntaxKind.IdentifierToken, "Y");
}
- M(SyntaxKind.SemicolonToken);
+ N(SyntaxKind.CloseParenToken);
}
- }
- N(SyntaxKind.GlobalStatement);
- {
- N(SyntaxKind.ExpressionStatement);
+ N(SyntaxKind.BaseList);
{
- N(SyntaxKind.IdentifierName);
+ N(SyntaxKind.ColonToken);
+ N(SyntaxKind.SimpleBaseType);
{
- N(SyntaxKind.IdentifierToken, "B");
+ N(SyntaxKind.IdentifierName);
+ {
+ N(SyntaxKind.IdentifierToken, "B");
+ }
}
- N(SyntaxKind.SemicolonToken);
}
+ N(SyntaxKind.SemicolonToken);
}
N(SyntaxKind.EndOfFileToken);
}
@@ -2937,16 +2914,7 @@ public void RecordInterfaceParsing()
Diagnostic(ErrorCode.ERR_LbraceExpected, "interface").WithLocation(1, 8),
// (1,8): error CS1513: } expected
// record interface C(int X, int Y);
- Diagnostic(ErrorCode.ERR_RbraceExpected, "interface").WithLocation(1, 8),
- // (1,19): error CS1514: { expected
- // record interface C(int X, int Y);
- Diagnostic(ErrorCode.ERR_LbraceExpected, "(").WithLocation(1, 19),
- // (1,19): error CS1513: } expected
- // record interface C(int X, int Y);
- Diagnostic(ErrorCode.ERR_RbraceExpected, "(").WithLocation(1, 19),
- // (1,19): error CS8803: Top-level statements must precede namespace and type declarations.
- // record interface C(int X, int Y);
- Diagnostic(ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType, "(int X, int Y);").WithLocation(1, 19)
+ Diagnostic(ErrorCode.ERR_RbraceExpected, "interface").WithLocation(1, 8)
);
N(SyntaxKind.CompilationUnit);
@@ -2962,49 +2930,29 @@ public void RecordInterfaceParsing()
{
N(SyntaxKind.InterfaceKeyword);
N(SyntaxKind.IdentifierToken, "C");
- M(SyntaxKind.OpenBraceToken);
- M(SyntaxKind.CloseBraceToken);
- }
- N(SyntaxKind.GlobalStatement);
- {
- N(SyntaxKind.ExpressionStatement);
+ N(SyntaxKind.ParameterList);
{
- N(SyntaxKind.TupleExpression);
+ N(SyntaxKind.OpenParenToken);
+ N(SyntaxKind.Parameter);
{
- N(SyntaxKind.OpenParenToken);
- N(SyntaxKind.Argument);
+ N(SyntaxKind.PredefinedType);
{
- N(SyntaxKind.DeclarationExpression);
- {
- N(SyntaxKind.PredefinedType);
- {
- N(SyntaxKind.IntKeyword);
- }
- N(SyntaxKind.SingleVariableDesignation);
- {
- N(SyntaxKind.IdentifierToken, "X");
- }
- }
+ N(SyntaxKind.IntKeyword);
}
- N(SyntaxKind.CommaToken);
- N(SyntaxKind.Argument);
+ N(SyntaxKind.IdentifierToken, "X");
+ }
+ N(SyntaxKind.CommaToken);
+ N(SyntaxKind.Parameter);
+ {
+ N(SyntaxKind.PredefinedType);
{
- N(SyntaxKind.DeclarationExpression);
- {
- N(SyntaxKind.PredefinedType);
- {
- N(SyntaxKind.IntKeyword);
- }
- N(SyntaxKind.SingleVariableDesignation);
- {
- N(SyntaxKind.IdentifierToken, "Y");
- }
- }
+ N(SyntaxKind.IntKeyword);
}
- N(SyntaxKind.CloseParenToken);
+ N(SyntaxKind.IdentifierToken, "Y");
}
- N(SyntaxKind.SemicolonToken);
+ N(SyntaxKind.CloseParenToken);
}
+ N(SyntaxKind.SemicolonToken);
}
N(SyntaxKind.EndOfFileToken);
}
diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs
index 597fe8a2bd609..602b594308b7f 100644
--- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs
+++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs
@@ -3097,8 +3097,10 @@ public void TestSpacingOnPrimaryConstructor()
{
TestNormalizeDeclaration("class C ( int I , int J ) ; ", "class C(int I, int J);");
TestNormalizeDeclaration("struct S ( int I , int J ) ; ", "struct S(int I, int J);");
+ TestNormalizeDeclaration("interface S ( int I , int J ) ; ", "interface S(int I, int J);");
TestNormalizeDeclaration("class C ( ) ; ", "class C();");
TestNormalizeDeclaration("struct S ( ) ; ", "struct S();");
+ TestNormalizeDeclaration("interface S ( ) ; ", "interface S();");
}
[Fact]
diff --git a/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs b/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs
index 67b165d591c5b..b96baa239135c 100644
--- a/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs
+++ b/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs
@@ -258,7 +258,7 @@ private static bool CanHaveSemicolon(SyntaxNode currentNode)
return true;
}
- if (currentNode is TypeDeclarationSyntax { OpenBraceToken.IsMissing: true } and (RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax))
+ if (currentNode is TypeDeclarationSyntax { OpenBraceToken.IsMissing: true })
{
return true;
}
@@ -350,6 +350,7 @@ private static bool TryGetCaretPositionToMove(SyntaxNode statementNode, Snapshot
case SyntaxKind.RecordStructDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.StructDeclaration:
+ case SyntaxKind.InterfaceDeclaration:
// These statement types end in a semicolon.
// if the original caret was inside any delimiters, `caret` will be after the outermost delimiter
targetPosition = caret;
diff --git a/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveToNewFile.cs b/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveToNewFile.cs
index 0061f1f9e479e..b30dc33ac7cbb 100644
--- a/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveToNewFile.cs
+++ b/src/EditorFeatures/CSharpTest/CodeActions/MoveType/MoveTypeTests.MoveToNewFile.cs
@@ -1465,6 +1465,26 @@ struct CacheContext(String Message);
await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText);
}
+ [WpfFact]
+ public async Task MoveInterfaceToNewFilePreserveUsings_PrimaryConstructor()
+ {
+ var code =
+@"using System;
+
+[||]interface CacheContext(String Message);
+
+class Program { }";
+ var codeAfterMove = @"using System;
+
+class Program { }";
+
+ var expectedDocumentName = "CacheContext.cs";
+ var destinationDocumentText = @"interface CacheContext(String Message);
+";
+
+ await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText);
+ }
+
[WpfFact]
public async Task MoveClassInTopLevelStatements()
{
diff --git a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
index 917dbf5756dba..98ecde26641c3 100644
--- a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
+++ b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs
@@ -65,6 +65,9 @@ internal static int MethodM(int a, int b)
[InlineData("public struct C(int X, $$int Y)", "public struct C(int X, int Y)")]
[InlineData("public struct C(int X, int$$ Y)", "public struct C(int X, int Y)")]
[InlineData("public struct C(int X, int Y$$)", "public struct C(int X, int Y)")]
+ [InlineData("public interface C(int X, $$int Y)", "public interface C(int X, int Y)")]
+ [InlineData("public interface C(int X, int$$ Y)", "public interface C(int X, int Y)")]
+ [InlineData("public interface C(int X, int Y$$)", "public interface C(int X, int Y)")]
public void ParameterList_CouldBeHandled(string signature, string expectedSignature)
{
var code = $@"
diff --git a/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
index 09376560f6c02..bb457b200a56c 100644
--- a/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
+++ b/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
@@ -144,7 +144,7 @@ public async Task Bar()
}
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
- public async Task ExtractInterface_Invocation_FromInterface()
+ public async Task ExtractInterface_Invocation_FromInterface_01()
{
var markup = @"
using System;
@@ -156,6 +156,19 @@ interface IMyInterface
await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "IMyInterface1");
}
+ [WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
+ public async Task ExtractInterface_Invocation_FromInterface_02()
+ {
+ var markup = @"
+using System;
+interface IMyInterface()
+{
+ $$void Goo();
+}";
+
+ await TestExtractInterfaceCommandCSharpAsync(markup, expectedSuccess: true, expectedMemberName: "Goo", expectedInterfaceName: "IMyInterface1");
+ }
+
[WpfFact, Trait(Traits.Feature, Traits.Features.ExtractInterface)]
public async Task ExtractInterface_Invocation_FromStruct()
{
diff --git a/src/EditorFeatures/CSharpTest/Wrapping/ParameterWrappingTests.cs b/src/EditorFeatures/CSharpTest/Wrapping/ParameterWrappingTests.cs
index bbade6637f682..a68f1a89c8dd7 100644
--- a/src/EditorFeatures/CSharpTest/Wrapping/ParameterWrappingTests.cs
+++ b/src/EditorFeatures/CSharpTest/Wrapping/ParameterWrappingTests.cs
@@ -960,6 +960,15 @@ await TestInRegularAndScript1Async(
string S);");
}
+ [Fact]
+ public async Task TestInterface_Semicolon()
+ {
+ await TestInRegularAndScript1Async(
+"interface R([||]int I, string S);",
+@"interface R(int I,
+ string S);");
+ }
+
[Fact]
public async Task TestRecord_Braces()
{
@@ -978,6 +987,15 @@ await TestInRegularAndScript1Async(
string S) { }");
}
+ [Fact]
+ public async Task TestInterface_Braces()
+ {
+ await TestInRegularAndScript1Async(
+"interface R([||]int I, string S) { }",
+@"interface R(int I,
+ string S) { }");
+ }
+
[Fact]
public async Task TestRecordStruct_Semicolon()
{
diff --git a/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb b/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
index 5b0a685890d72..15ead3a0da332 100644
--- a/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
+++ b/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
@@ -2036,6 +2036,36 @@ class [|C|]
End Using
End Function
+
+
+ Public Async Function RenameInterfaceWithNoBody1(host As RenameTestHost) As Task
+ Using workspace = CreateWorkspaceWithWaiter(
+
+
+
+ interface [|$$Goo|](int a);
+ class C
+ {
+ [|Goo|] g;
+ }
+
+
+ , host)
+
+ Dim session = StartSession(workspace)
+
+ ' Type a bit in the file
+ Dim caretPosition = workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value
+ Dim textBuffer = workspace.Documents.Single().GetTextBuffer()
+
+ textBuffer.Insert(caretPosition, "Bar")
+
+ session.Commit()
+
+ Await VerifyTagsAreCorrect(workspace)
+ End Using
+ End Function
+
Public Async Function RenameRecordWithBody(host As RenameTestHost) As Task
@@ -2126,6 +2156,36 @@ class [|C|]
End Using
End Function
+
+
+ Public Async Function RenameInterfaceWithBody(host As RenameTestHost) As Task
+ Using workspace = CreateWorkspaceWithWaiter(
+
+
+
+ interface [|$$Goo|](int a) { }
+ class C
+ {
+ [|Goo|] g;
+ }
+
+
+ , host)
+
+ Dim session = StartSession(workspace)
+
+ ' Type a bit in the file
+ Dim caretPosition = workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value
+ Dim textBuffer = workspace.Documents.Single().GetTextBuffer()
+
+ textBuffer.Insert(caretPosition, "Bar")
+
+ session.Commit()
+
+ Await VerifyTagsAreCorrect(workspace)
+ End Using
+ End Function
+
Public Async Function RenameRecordConstructorCalled(host As RenameTestHost) As Task
diff --git a/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs b/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs
index 88d050877a9c6..2ff2d971e204f 100644
--- a/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs
+++ b/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs
@@ -311,22 +311,10 @@ public override async Task ChangeSignatureAsync(
return method.WithParameterList(method.ParameterList.WithParameters(updatedParameters).WithAdditionalAnnotations(changeSignatureFormattingAnnotation));
}
- if (updatedNode is RecordDeclarationSyntax { ParameterList: not null } record)
+ if (updatedNode is TypeDeclarationSyntax { ParameterList: not null } typeWithParameters)
{
- var updatedParameters = UpdateDeclaration(record.ParameterList.Parameters, signaturePermutation, CreateNewParameterSyntax);
- return record.WithParameterList(record.ParameterList.WithParameters(updatedParameters).WithAdditionalAnnotations(changeSignatureFormattingAnnotation));
- }
-
- if (updatedNode is ClassDeclarationSyntax { ParameterList: not null } @class)
- {
- var updatedParameters = UpdateDeclaration(@class.ParameterList.Parameters, signaturePermutation, CreateNewParameterSyntax);
- return @class.WithParameterList(@class.ParameterList.WithParameters(updatedParameters).WithAdditionalAnnotations(changeSignatureFormattingAnnotation));
- }
-
- if (updatedNode is StructDeclarationSyntax { ParameterList: not null } @struct)
- {
- var updatedParameters = UpdateDeclaration(@struct.ParameterList.Parameters, signaturePermutation, CreateNewParameterSyntax);
- return @struct.WithParameterList(@struct.ParameterList.WithParameters(updatedParameters).WithAdditionalAnnotations(changeSignatureFormattingAnnotation));
+ var updatedParameters = UpdateDeclaration(typeWithParameters.ParameterList.Parameters, signaturePermutation, CreateNewParameterSyntax);
+ return typeWithParameters.WithParameterList(typeWithParameters.ParameterList.WithParameters(updatedParameters).WithAdditionalAnnotations(changeSignatureFormattingAnnotation));
}
if (updatedNode is LocalFunctionStatementSyntax localFunction)
diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
index 604142fc2ccc5..760bb216ed596 100644
--- a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
+++ b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
@@ -2251,11 +2251,10 @@ private static SyntaxNode WithParameterList(SyntaxNode declaration, BaseParamete
}
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration:
- return ((RecordDeclarationSyntax)declaration).WithParameterList((ParameterListSyntax)list);
case SyntaxKind.ClassDeclaration:
- return ((ClassDeclarationSyntax)declaration).WithParameterList((ParameterListSyntax)list);
case SyntaxKind.StructDeclaration:
- return ((StructDeclarationSyntax)declaration).WithParameterList((ParameterListSyntax)list);
+ case SyntaxKind.InterfaceDeclaration:
+ return ((TypeDeclarationSyntax)declaration).WithParameterList((ParameterListSyntax)list);
default:
return declaration;
}
diff --git a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs
index f9864cb773264..f2f2f3ad9e750 100644
--- a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs
+++ b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs
@@ -3167,6 +3167,7 @@ public void TestAddParameters()
Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count);
Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count);
+ Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count);
Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count);
}
@@ -3924,7 +3925,7 @@ public void TestInsertMembersOnStruct_SemiColon()
}
[Fact]
- public void TestInsertMembersOnInterface_SemiColon()
+ public void TestInsertMembersOnInterface_SemiColon_01()
{
var comp = Compile(
$@"public interface C;
@@ -3941,6 +3942,24 @@ public void TestInsertMembersOnInterface_SemiColon()
}}");
}
+ [Fact]
+ public void TestInsertMembersOnInterface_SemiColon_02()
+ {
+ var comp = Compile(
+$@"public interface C();
+");
+
+ var symbolC = (INamedTypeSymbol)comp.GlobalNamespace.GetMembers("C").First();
+ var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First());
+
+ VerifySyntax(
+ Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))),
+$@"public interface C()
+{{
+ T A {{ get; set; }}
+}}");
+ }
+
[Fact]
public void TestInsertMembersOnEnum_SemiColon()
{
diff --git a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
index ee48e906f6748..d51ffd98583a9 100644
--- a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
+++ b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
@@ -9999,6 +9999,18 @@ class R(int X) ;
");
}
+ [Fact]
+ public async Task Interface()
+ {
+ await AssertFormatAsync(
+ @"
+interface R(int X);
+",
+ @"
+interface R(int X) ;
+");
+ }
+
[Fact]
public async Task RecordStruct()
{
diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs
index 865c5ccd44aaa..7e42eb064d21f 100644
--- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs
+++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs
@@ -168,9 +168,11 @@ UsingStatementSyntax or
SyntaxKind.ParenthesizedLambdaExpression => ((ParenthesizedLambdaExpressionSyntax)declaration).ParameterList,
SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).ParameterList,
SyntaxKind.AnonymousMethodExpression => ((AnonymousMethodExpressionSyntax)declaration).ParameterList,
- SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration => ((RecordDeclarationSyntax)declaration).ParameterList,
- SyntaxKind.ClassDeclaration => ((ClassDeclarationSyntax)declaration).ParameterList,
- SyntaxKind.StructDeclaration => ((StructDeclarationSyntax)declaration).ParameterList,
+ SyntaxKind.RecordDeclaration or
+ SyntaxKind.RecordStructDeclaration or
+ SyntaxKind.ClassDeclaration or
+ SyntaxKind.StructDeclaration or
+ SyntaxKind.InterfaceDeclaration => ((TypeDeclarationSyntax)declaration).ParameterList,
_ => null,
};