Skip to content

Commit 7b99685

Browse files
author
msftbot[bot]
authored
Merge pull request #53118 from dotnet/merges/main-to-main-vs-deps
Merge main to main-vs-deps
2 parents 5b2aebf + 95e20d6 commit 7b99685

File tree

10 files changed

+76
-40
lines changed

10 files changed

+76
-40
lines changed

eng/Version.Details.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<Uri>https://github.com/dotnet/arcade</Uri>
88
<Sha>0ca849f0b71866b007fedaaa938cee63f8d056a6</Sha>
99
</Dependency>
10-
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.10.0-3.21223.23">
10+
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.0.0-2.21253.8">
1111
<Uri>https://github.com/dotnet/roslyn</Uri>
12-
<Sha>9b40ab852a3b59ce9cef33b3e97c17af13c8e694</Sha>
12+
<Sha>5b972bceb846f5d15f991a479e285067a75103e4</Sha>
1313
</Dependency>
1414
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="6.0.0-beta.21167.3">
1515
<Uri>https://github.com/dotnet/arcade</Uri>

eng/Versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</MajorVersion>
2424
<MinorVersion>
2525
</MinorVersion>
26-
<MicrosoftNetCompilersToolsetVersion>3.10.0-3.21223.23</MicrosoftNetCompilersToolsetVersion>
26+
<MicrosoftNetCompilersToolsetVersion>4.0.0-2.21253.8</MicrosoftNetCompilersToolsetVersion>
2727
</PropertyGroup>
2828
<PropertyGroup>
2929
<!-- Versions used by several individual references below -->

src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs

+64
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,40 @@ class C
3838
VerifyTypingCharacter(code, expected);
3939
}
4040

41+
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
42+
public void TypingCharacter_Record()
43+
{
44+
var code =
45+
@"//$$
46+
record R;";
47+
48+
var expected =
49+
@"/// <summary>
50+
/// $$
51+
/// </summary>
52+
record R;";
53+
54+
VerifyTypingCharacter(code, expected);
55+
}
56+
57+
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
58+
public void TypingCharacter_RecordWithPositionalParameters()
59+
{
60+
var code =
61+
@"//$$
62+
record R(string S, int I);";
63+
64+
var expected =
65+
@"/// <summary>
66+
/// $$
67+
/// </summary>
68+
/// <param name=""S""></param>
69+
/// <param name=""I""></param>
70+
record R(string S, int I);";
71+
72+
VerifyTypingCharacter(code, expected);
73+
}
74+
4175
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
4276
public void TypingCharacter_Class_NewLine()
4377
{
@@ -1467,6 +1501,36 @@ class C
14671501
VerifyInsertCommentCommand(code, expected);
14681502
}
14691503

1504+
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
1505+
public void Command_Record()
1506+
{
1507+
var code = "record R$$;";
1508+
1509+
var expected =
1510+
@"/// <summary>
1511+
/// $$
1512+
/// </summary>
1513+
record R;";
1514+
1515+
VerifyInsertCommentCommand(code, expected);
1516+
}
1517+
1518+
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
1519+
public void Command_RecordWithPositionalParameters()
1520+
{
1521+
var code = "record R$$(string S, int I);";
1522+
1523+
var expected =
1524+
@"/// <summary>
1525+
/// $$
1526+
/// </summary>
1527+
/// <param name=""S""></param>
1528+
/// <param name=""I""></param>
1529+
record R(string S, int I);";
1530+
1531+
VerifyInsertCommentCommand(code, expected);
1532+
}
1533+
14701534
[WorkItem(4817, "https://github.com/dotnet/roslyn/issues/4817")]
14711535
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
14721536
public void Command_Class_AutoGenerateXmlDocCommentsOff()

src/Features/CSharp/Portable/DocumentationComments/DocumentationCommentSnippetService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ protected override bool SupportsDocumentationComments(MemberDeclarationSyntax me
3939
switch (member.Kind())
4040
{
4141
case SyntaxKind.ClassDeclaration:
42+
case SyntaxKind.RecordDeclaration:
4243
case SyntaxKind.InterfaceDeclaration:
4344
case SyntaxKind.StructDeclaration:
4445
case SyntaxKind.DelegateDeclaration:

src/Workspaces/Core/Portable/LinkedFileDiffMerging/DefaultDocumentTextDifferencingService.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
5+
using System;
76
using System.Collections.Immutable;
87
using System.Composition;
98
using System.Diagnostics.CodeAnalysis;
@@ -18,7 +17,7 @@ namespace Microsoft.CodeAnalysis
1817
internal class DefaultDocumentTextDifferencingService : IDocumentTextDifferencingService
1918
{
2019
[ImportingConstructor]
21-
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")]
20+
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
2221
public DefaultDocumentTextDifferencingService()
2322
{
2423
}

src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private async Task<LinkedFileMergeResult> MergeLinkedDocumentGroupAsync(
8585

8686
// Automatically merge non-conflicting diffs while collecting the conflicting diffs
8787

88-
var textDifferencingService = _oldSolution.Workspace.Services.GetService<IDocumentTextDifferencingService>() ?? new DefaultDocumentTextDifferencingService();
88+
var textDifferencingService = _oldSolution.Workspace.Services.GetRequiredService<IDocumentTextDifferencingService>();
8989
var appliedChanges = await textDifferencingService.GetTextChangesAsync(_oldSolution.GetDocument(linkedDocumentGroup.First()), _newSolution.GetDocument(linkedDocumentGroup.First()), cancellationToken).ConfigureAwait(false);
9090
var unmergedChanges = new List<UnmergedDocumentChanges>();
9191

src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/MemberDeclarationSyntaxExtensions.cs

-26
Original file line numberDiff line numberDiff line change
@@ -114,32 +114,6 @@ public static TypeParameterListSyntax GetTypeParameterList(this MemberDeclaratio
114114
return null;
115115
}
116116

117-
public static BaseParameterListSyntax GetParameterList(this MemberDeclarationSyntax member)
118-
{
119-
if (member != null)
120-
{
121-
switch (member.Kind())
122-
{
123-
case SyntaxKind.DelegateDeclaration:
124-
return ((DelegateDeclarationSyntax)member).ParameterList;
125-
case SyntaxKind.MethodDeclaration:
126-
return ((MethodDeclarationSyntax)member).ParameterList;
127-
case SyntaxKind.ConstructorDeclaration:
128-
return ((ConstructorDeclarationSyntax)member).ParameterList;
129-
case SyntaxKind.DestructorDeclaration:
130-
return ((DestructorDeclarationSyntax)member).ParameterList;
131-
case SyntaxKind.IndexerDeclaration:
132-
return ((IndexerDeclarationSyntax)member).ParameterList;
133-
case SyntaxKind.OperatorDeclaration:
134-
return ((OperatorDeclarationSyntax)member).ParameterList;
135-
case SyntaxKind.ConversionOperatorDeclaration:
136-
return ((ConversionOperatorDeclarationSyntax)member).ParameterList;
137-
}
138-
}
139-
140-
return null;
141-
}
142-
143117
public static MemberDeclarationSyntax WithParameterList(
144118
this MemberDeclarationSyntax member,
145119
BaseParameterListSyntax parameterList)

src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ node is UsingStatementSyntax ||
257257
_ => null,
258258
};
259259

260-
public static BaseParameterListSyntax? GetParameterList(this SyntaxNode declaration)
261-
=> declaration.Kind() switch
260+
public static BaseParameterListSyntax? GetParameterList(this SyntaxNode? declaration)
261+
=> declaration?.Kind() switch
262262
{
263263
SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).ParameterList,
264264
SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).ParameterList,
@@ -270,6 +270,7 @@ node is UsingStatementSyntax ||
270270
SyntaxKind.ParenthesizedLambdaExpression => ((ParenthesizedLambdaExpressionSyntax)declaration).ParameterList,
271271
SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).ParameterList,
272272
SyntaxKind.AnonymousMethodExpression => ((AnonymousMethodExpressionSyntax)declaration).ParameterList,
273+
SyntaxKind.RecordDeclaration => ((RecordDeclarationSyntax)declaration).ParameterList,
273274
_ => null,
274275
};
275276

src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ namespace Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports
2626
internal partial class CSharpRemoveUnnecessaryImportsService :
2727
AbstractRemoveUnnecessaryImportsService<UsingDirectiveSyntax>
2828
{
29-
public static readonly CSharpRemoveUnnecessaryImportsService Instance = new();
30-
3129
[ImportingConstructor]
32-
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")]
30+
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
3331
public CSharpRemoveUnnecessaryImportsService()
3432
{
3533
}

src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation
1717
Partial Friend NotInheritable Class VisualBasicIndentationService
1818
Inherits AbstractIndentationService(Of CompilationUnitSyntax)
1919

20-
Public Shared ReadOnly DefaultInstance As New VisualBasicIndentationService()
2120
Public Shared ReadOnly WithoutParameterAlignmentInstance As New VisualBasicIndentationService(NoOpFormattingRule.Instance)
2221

2322
Private ReadOnly _specializedIndentationRule As AbstractFormattingRule
2423

2524
<ImportingConstructor>
26-
<SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification:="Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")>
25+
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
2726
Public Sub New()
2827
Me.New(Nothing)
2928
End Sub

0 commit comments

Comments
 (0)