Skip to content

Commit

Permalink
Merge pull request #53118 from dotnet/merges/main-to-main-vs-deps
Browse files Browse the repository at this point in the history
Merge main to main-vs-deps
  • Loading branch information
msftbot[bot] authored May 4, 2021
2 parents 5b2aebf + 95e20d6 commit 7b99685
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 40 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>0ca849f0b71866b007fedaaa938cee63f8d056a6</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.10.0-3.21223.23">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.0.0-2.21253.8">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>9b40ab852a3b59ce9cef33b3e97c17af13c8e694</Sha>
<Sha>5b972bceb846f5d15f991a479e285067a75103e4</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="6.0.0-beta.21167.3">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</MajorVersion>
<MinorVersion>
</MinorVersion>
<MicrosoftNetCompilersToolsetVersion>3.10.0-3.21223.23</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>4.0.0-2.21253.8</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ class C
VerifyTypingCharacter(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void TypingCharacter_Record()
{
var code =
@"//$$
record R;";

var expected =
@"/// <summary>
/// $$
/// </summary>
record R;";

VerifyTypingCharacter(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void TypingCharacter_RecordWithPositionalParameters()
{
var code =
@"//$$
record R(string S, int I);";

var expected =
@"/// <summary>
/// $$
/// </summary>
/// <param name=""S""></param>
/// <param name=""I""></param>
record R(string S, int I);";

VerifyTypingCharacter(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void TypingCharacter_Class_NewLine()
{
Expand Down Expand Up @@ -1467,6 +1501,36 @@ class C
VerifyInsertCommentCommand(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void Command_Record()
{
var code = "record R$$;";

var expected =
@"/// <summary>
/// $$
/// </summary>
record R;";

VerifyInsertCommentCommand(code, expected);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void Command_RecordWithPositionalParameters()
{
var code = "record R$$(string S, int I);";

var expected =
@"/// <summary>
/// $$
/// </summary>
/// <param name=""S""></param>
/// <param name=""I""></param>
record R(string S, int I);";

VerifyInsertCommentCommand(code, expected);
}

[WorkItem(4817, "https://github.com/dotnet/roslyn/issues/4817")]
[WpfFact, Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public void Command_Class_AutoGenerateXmlDocCommentsOff()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected override bool SupportsDocumentationComments(MemberDeclarationSyntax me
switch (member.Kind())
{
case SyntaxKind.ClassDeclaration:
case SyntaxKind.RecordDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.StructDeclaration:
case SyntaxKind.DelegateDeclaration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// 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 System;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -18,7 +17,7 @@ namespace Microsoft.CodeAnalysis
internal class DefaultDocumentTextDifferencingService : IDocumentTextDifferencingService
{
[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultDocumentTextDifferencingService()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private async Task<LinkedFileMergeResult> MergeLinkedDocumentGroupAsync(

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,6 @@ public static TypeParameterListSyntax GetTypeParameterList(this MemberDeclaratio
return null;
}

public static BaseParameterListSyntax GetParameterList(this MemberDeclarationSyntax member)
{
if (member != null)
{
switch (member.Kind())
{
case SyntaxKind.DelegateDeclaration:
return ((DelegateDeclarationSyntax)member).ParameterList;
case SyntaxKind.MethodDeclaration:
return ((MethodDeclarationSyntax)member).ParameterList;
case SyntaxKind.ConstructorDeclaration:
return ((ConstructorDeclarationSyntax)member).ParameterList;
case SyntaxKind.DestructorDeclaration:
return ((DestructorDeclarationSyntax)member).ParameterList;
case SyntaxKind.IndexerDeclaration:
return ((IndexerDeclarationSyntax)member).ParameterList;
case SyntaxKind.OperatorDeclaration:
return ((OperatorDeclarationSyntax)member).ParameterList;
case SyntaxKind.ConversionOperatorDeclaration:
return ((ConversionOperatorDeclarationSyntax)member).ParameterList;
}
}

return null;
}

public static MemberDeclarationSyntax WithParameterList(
this MemberDeclarationSyntax member,
BaseParameterListSyntax parameterList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ node is UsingStatementSyntax ||
_ => null,
};

public static BaseParameterListSyntax? GetParameterList(this SyntaxNode declaration)
=> declaration.Kind() switch
public static BaseParameterListSyntax? GetParameterList(this SyntaxNode? declaration)
=> declaration?.Kind() switch
{
SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).ParameterList,
SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).ParameterList,
Expand All @@ -270,6 +270,7 @@ node is UsingStatementSyntax ||
SyntaxKind.ParenthesizedLambdaExpression => ((ParenthesizedLambdaExpressionSyntax)declaration).ParameterList,
SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).ParameterList,
SyntaxKind.AnonymousMethodExpression => ((AnonymousMethodExpressionSyntax)declaration).ParameterList,
SyntaxKind.RecordDeclaration => ((RecordDeclarationSyntax)declaration).ParameterList,
_ => null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ namespace Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports
internal partial class CSharpRemoveUnnecessaryImportsService :
AbstractRemoveUnnecessaryImportsService<UsingDirectiveSyntax>
{
public static readonly CSharpRemoveUnnecessaryImportsService Instance = new();

[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpRemoveUnnecessaryImportsService()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation
Partial Friend NotInheritable Class VisualBasicIndentationService
Inherits AbstractIndentationService(Of CompilationUnitSyntax)

Public Shared ReadOnly DefaultInstance As New VisualBasicIndentationService()
Public Shared ReadOnly WithoutParameterAlignmentInstance As New VisualBasicIndentationService(NoOpFormattingRule.Instance)

Private ReadOnly _specializedIndentationRule As AbstractFormattingRule

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

0 comments on commit 7b99685

Please sign in to comment.