Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Compilers/Core/Portable/Syntax/SeparatedSyntaxList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,13 @@ public SeparatedSyntaxList<TNode> ReplaceSeparator(SyntaxToken separatorToken, S
var index = nodesWithSeps.IndexOf(separatorToken);
if (index < 0)
{
throw new ArgumentException("separatorToken");
throw new ArgumentException(CodeAnalysisResources.MissingListItem, nameof(separatorToken));
}

if (newSeparator.RawKind != nodesWithSeps[index].RawKind ||
newSeparator.Language != nodesWithSeps[index].Language)
{
throw new ArgumentException("newSeparator");
throw new ArgumentException("New separator must have the same RawKind and Language as the separator being replaced.", nameof(newSeparator));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Break this into two separate checks, and add two new resource string exception messages. One for needing to have the same RawKind and one for needing to have the same Language.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Split into two separate checks with dedicated resource strings SeparatorTokenMustHaveSameRawKind and SeparatorTokenMustHaveSameLanguage in commit 0c9ca.

}

return new SeparatedSyntaxList<TNode>(nodesWithSeps.Replace(separatorToken, newSeparator));
Expand Down