Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into move-some-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Apr 5, 2022
2 parents ca0c17c + 90112dd commit 97ba8a2
Show file tree
Hide file tree
Showing 169 changed files with 670 additions and 3,843 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ csharp_preserve_single_line_statements = true
# https://github.com/dotnet/roslyn/pull/54259 has been published.
dotnet_style_allow_statement_immediately_after_block_experimental = false

[src/CodeStyle/**.{cs,vb}]
# warning RS0005: Do not use generic CodeAction.Create to create CodeAction
dotnet_diagnostic.RS0005.severity = none

[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]

# IDE0011: Add braces
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ Visit [Roslyn Architecture Overview](https://docs.microsoft.com/en-us/dotnet/csh

#### Misc Tests

|Branch|Determinism|Build Correctness|Source build|Spanish|MacOS|
|:--:|:--:|:--|:--:|:--:|:--:|
**main**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|
**main-vs-deps**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|
|Branch|Determinism|Build Correctness|Rebuild from artifacts|Source build|Spanish|MacOS|
|:--:|:--:|:--|:--:|:--:|:--:|:--:|
**main**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchName=main&jobName=Correctness_Rebuild)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchName=main)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|
**main-vs-deps**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchName=main-vs-deps&jobName=Correctness_Rebuild)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchName=main-vs-deps)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|

[//]: # (End current test results)

Expand Down
1 change: 1 addition & 0 deletions azure-pipelines-integration-corehost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pr:
paths:
exclude:
- docs/*
- eng/config/PublishData.json
- .vscode/*
- .github/*
- .devcontainer/*
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pr:
paths:
exclude:
- docs/*
- eng/config/PublishData.json
- .vscode/*
- .github/*
- .devcontainer/
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pr:
paths:
exclude:
- docs/*
- eng/config/PublishData.json
- .vscode/*
- .github/*
- .devcontainer/*
Expand Down
2 changes: 1 addition & 1 deletion docs/Language Feature Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ efforts behind them.
| [Utf8 String Literals](https://github.com/dotnet/csharplang/issues/184) | [Utf8StringLiterals](https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/58848) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) |
| [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) |
| [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) |
| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [In Progress](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) |
| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) |
| [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs) |


Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
<RoslynDiagnosticsNugetPackageVersion>3.3.4-beta1.22160.2</RoslynDiagnosticsNugetPackageVersion>
<RoslynDiagnosticsNugetPackageVersion>3.3.4-beta1.22204.1</RoslynDiagnosticsNugetPackageVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-rc1.21366.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.22122.4</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.132-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
Expand Down
7 changes: 3 additions & 4 deletions eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@
"version": "4.2.*",
"packageFeeds": "default",
"channels": [],
"vsBranch": "main",
"insertionCreateDraftPR": false,
"vsBranch": "rel/d17.2",
"vsMajorVersion": 17,
"insertionTitlePrefix": "[d17.2p3]"
"insertionTitlePrefix": "[d17.2]"
},
"main": {
"nugetKind": [
Expand All @@ -248,7 +247,7 @@
"channels": [],
"vsBranch": "main",
"vsMajorVersion": 17,
"insertionCreateDraftPR": true,
"insertionCreateDraftPR": false,
"insertionTitlePrefix": "[d17.3p1]"
},
"features/NullableReferenceTypes": {
Expand Down
2 changes: 0 additions & 2 deletions eng/config/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ dotnet_diagnostic.RS1026.severity = none
dotnet_diagnostic.RS1032.severity = none
# Define diagnostic description correctly
dotnet_diagnostic.RS1033.severity = none
# Do not use generic CodeAction.Create to create CodeAction - not useful for tests
dotnet_diagnostic.RS0005.severity = none
# Do not call 'GetTestAccessor()' from production code: does not apply to tests
dotnet_diagnostic.RS0043.severity = none

Expand Down
2 changes: 0 additions & 2 deletions eng/config/globalconfigs/Shipping.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ is_global = true
dotnet_diagnostic.CA1802.severity = warning
dotnet_diagnostic.CA2007.severity = warning

dotnet_diagnostic.RS0005.severity = warning

# CA2016: Forward the 'CancellationToken' parameter to methods
dotnet_diagnostic.CA2016.severity = warning
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public override ImmutableArray<string> FixableDiagnosticIds
public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
{
context.RegisterCodeFix(
new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)),
CodeAction.Create(
CSharpAnalyzersResources.Add_braces,
c => FixAsync(context.Document, context.Diagnostics.First(), c),
nameof(CSharpAnalyzersResources.Add_braces)),
context.Diagnostics);

return Task.CompletedTask;
Expand Down Expand Up @@ -63,13 +66,5 @@ protected override Task FixAllAsync(

return Task.CompletedTask;
}

private sealed class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpAnalyzersResources.Add_braces, createChangedDocument, CSharpAnalyzersResources.Add_braces)
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
});

context.RegisterCodeFix(
new MyCodeAction(title, c => FixAsync(context.Document, diagnostic, c), equivalenceKey),
CodeAction.Create(title, c => FixAsync(context.Document, diagnostic, c), equivalenceKey),
context.Diagnostics);

return Task.CompletedTask;
Expand All @@ -66,13 +66,5 @@ protected override async Task FixAllAsync(
editor.OriginalRoot,
await converted.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false));
}

private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument, string equivalenceKey)
: base(title, createChangedDocument, equivalenceKey)
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
}

context.RegisterCodeFix(
new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)),
CodeAction.Create(
CSharpAnalyzersResources.Convert_switch_statement_to_expression,
c => FixAsync(context.Document, context.Diagnostics.First(), c),
nameof(CSharpAnalyzersResources.Convert_switch_statement_to_expression)),
context.Diagnostics);
return Task.CompletedTask;
}
Expand Down Expand Up @@ -113,13 +116,5 @@ protected override async Task FixAllAsync(
}
}
}

private sealed class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpAnalyzersResources.Convert_switch_statement_to_expression, createChangedDocument, nameof(CSharpAnalyzersResources.Convert_switch_statement_to_expression))
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ public override ImmutableArray<string> FixableDiagnosticIds

public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
context.RegisterCodeFix(new MyCodeAction(
c => FixAsync(context.Document, context.Diagnostics.First(), c)),
context.RegisterCodeFix(CodeAction.Create(
CSharpAnalyzersResources.Inline_variable_declaration,
c => FixAsync(context.Document, context.Diagnostics.First(), c),
nameof(CSharpAnalyzersResources.Inline_variable_declaration)),
context.Diagnostics);
return Task.CompletedTask;
}
Expand Down Expand Up @@ -424,15 +426,5 @@ private static bool TryGetSpeculativeSemanticModel(
speculativeModel = null;
return false;
}

private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpAnalyzersResources.Inline_variable_declaration,
createChangedDocument,
CSharpAnalyzersResources.Inline_variable_declaration)
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)

public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
context.RegisterCodeFix(new MyCodeAction(
c => FixAsync(context.Document, context.Diagnostics.First(), c)),
context.RegisterCodeFix(CodeAction.Create(
CSharpAnalyzersResources.Simplify_delegate_invocation,
c => FixAsync(context.Document, context.Diagnostics.First(), c),
nameof(CSharpAnalyzersResources.Simplify_delegate_invocation)),
context.Diagnostics);
return Task.CompletedTask;
}
Expand Down Expand Up @@ -158,13 +160,5 @@ private static T AppendTriviaWithoutEndOfLines<T>(T newStatement, IfStatementSyn

return newStatement.WithTrailingTrivia(expressionTriviaWithoutEndOfLine.Concat(ifStatementTrivia));
}

private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpAnalyzersResources.Simplify_delegate_invocation, createChangedDocument, nameof(CSharpAnalyzersResources.Simplify_delegate_invocation))
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public override ImmutableArray<string> FixableDiagnosticIds

public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
context.RegisterCodeFix(new MyCodeAction(
c => FixAsync(context.Document, context.Diagnostics[0], c)),
context.RegisterCodeFix(CodeAction.Create(
CSharpAnalyzersResources.Make_readonly_fields_writable,
c => FixAsync(context.Document, context.Diagnostics[0], c),
nameof(CSharpAnalyzersResources.Make_readonly_fields_writable)),
context.Diagnostics);
return Task.CompletedTask;
}
Expand Down Expand Up @@ -73,13 +75,5 @@ protected override Task FixAllAsync(

return Task.CompletedTask;
}

private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpAnalyzersResources.Make_readonly_fields_writable, createChangedDocument, nameof(CSharpAnalyzersResources.Make_readonly_fields_writable))
{
}
}
}
}
Loading

0 comments on commit 97ba8a2

Please sign in to comment.