Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move more code down to shared layer #74539

Merged
Merged
Show file tree
Hide file tree
Changes from 24 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
1 change: 1 addition & 0 deletions src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Compile Include="$(MSBuildThisFileDirectory)GenerateConstructor\GenerateConstructorDiagnosticIds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.AddNewKeywordAction.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\CSharpImplementAbstractClassCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Iterator\CSharpAddYieldCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp.ImplementAbstractClass;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ImplementAbstractClass), Shared]
[ExtensionOrder(After = PredefinedCodeFixProviderNames.GenerateType)]
internal class CSharpImplementAbstractClassCodeFixProvider :
internal sealed class CSharpImplementAbstractClassCodeFixProvider :
AbstractImplementAbstractClassCodeFixProvider<TypeDeclarationSyntax>
{
private const string CS0534 = nameof(CS0534); // 'Program' does not implement inherited abstract member 'Goo.bar()'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<Compile Include="$(MSBuildThisFileDirectory)ForEachCast\ForEachCastTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\FormattingAnalyzerTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests_FixAllTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests_ThroughMember.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Iterator\AddYieldTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Iterator\ChangeToIEnumerableTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ abstract class Base
class [|Derived|] : Base
{
}
""", [FeaturesResources.Implement_abstract_class]);
""", [AnalyzersResources.Implement_abstract_class]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand All @@ -93,7 +93,7 @@ abstract class Middle : Base
class [|Derived|] : Base
{
}
""", [FeaturesResources.Implement_abstract_class]);
""", [AnalyzersResources.Implement_abstract_class]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -126,7 +126,7 @@ public override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact]
Expand Down Expand Up @@ -159,7 +159,7 @@ public override void Method(int a, ref int b, in int c, ref readonly int d, out
inner.Method(a, ref b, c, in d, out e);
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact]
Expand Down Expand Up @@ -189,7 +189,7 @@ class Derived : Base

public override int this[int a, in int b, ref readonly int c, out int d] => inner[a, b, in c, out d];
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -224,7 +224,7 @@ public override void Method1()
inner.Method1();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand All @@ -247,7 +247,7 @@ public override void Method1()
inner.Method1();
}
}
""", new string[] { FeaturesResources.Implement_abstract_class });
""", new string[] { AnalyzersResources.Implement_abstract_class });
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -288,7 +288,7 @@ public override void Method()
class DerivedAgain : Derived
{
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -321,7 +321,7 @@ public override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand All @@ -347,9 +347,9 @@ class [|Derived|] : Base, IInterface
}
""",
[
FeaturesResources.Implement_abstract_class,
string.Format(FeaturesResources.Implement_through_0, "Inner"),
string.Format(FeaturesResources.Implement_through_0, "IInterface.Inner"),
AnalyzersResources.Implement_abstract_class,
string.Format(AnalyzersResources.Implement_through_0, "Inner"),
string.Format(AnalyzersResources.Implement_through_0, "IInterface.Inner"),
]);
}

Expand All @@ -367,7 +367,7 @@ class [|Derived|] : Base
{
dynamic inner;
}
""", [FeaturesResources.Implement_abstract_class]);
""", [AnalyzersResources.Implement_abstract_class]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -400,7 +400,7 @@ public override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -430,7 +430,7 @@ class Derived : Base

public override int Property { get => inner.Property; set => inner.Property = value; }
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -505,7 +505,7 @@ class Derived : Base

public override int SetOnly { set => inner.SetOnly = value; }
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -596,7 +596,7 @@ public override event Action Event
}
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -633,7 +633,7 @@ public override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand All @@ -650,7 +650,7 @@ class [|Derived|] : Base
{
Base inner;
}
""", [FeaturesResources.Implement_abstract_class]);
""", [AnalyzersResources.Implement_abstract_class]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -683,7 +683,7 @@ protected override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -716,7 +716,7 @@ protected internal override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -749,7 +749,7 @@ internal override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand All @@ -766,7 +766,7 @@ class [|Derived|] : Base
{
Base inner;
}
""", [FeaturesResources.Implement_abstract_class]);
""", [AnalyzersResources.Implement_abstract_class]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -799,7 +799,7 @@ private protected override void Method()
inner.Method();
}
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
Expand Down Expand Up @@ -832,7 +832,7 @@ class Derived : Base
public override int InternalGet { internal get => inner.InternalGet; set => inner.InternalGet = value; }
public override int InternalSet { get => inner.InternalSet; internal set => inner.InternalSet = value; }
}
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
}

[Fact]
Expand Down Expand Up @@ -935,7 +935,7 @@ class [|Program|](Base base1) : Base
{
private Base _base = base1;
}
""", [FeaturesResources.Implement_abstract_class, string.Format(FeaturesResources.Implement_through_0, "_base")]);
""", [AnalyzersResources.Implement_abstract_class, string.Format(AnalyzersResources.Implement_through_0, "_base")]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/69177")]
Expand All @@ -953,7 +953,7 @@ class [|Program|](Base base1) : Base
{
private Base _base = (base1);
}
""", [FeaturesResources.Implement_abstract_class, string.Format(FeaturesResources.Implement_through_0, "_base")]);
""", [AnalyzersResources.Implement_abstract_class, string.Format(AnalyzersResources.Implement_through_0, "_base")]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/69177")]
Expand All @@ -971,7 +971,7 @@ class [|Program|](Base base1) : Base
{
private Base B { get; } = base1;
}
""", [FeaturesResources.Implement_abstract_class, string.Format(FeaturesResources.Implement_through_0, "B")]);
""", [AnalyzersResources.Implement_abstract_class, string.Format(AnalyzersResources.Implement_through_0, "B")]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/69177")]
Expand All @@ -989,7 +989,7 @@ class [|Program|](Base base1) : Base
{
private Base B { get; } = (base1);
}
""", [FeaturesResources.Implement_abstract_class, string.Format(FeaturesResources.Implement_through_0, "B")]);
""", [AnalyzersResources.Implement_abstract_class, string.Format(AnalyzersResources.Implement_through_0, "B")]);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/69177")]
Expand Down
11 changes: 10 additions & 1 deletion src/Analyzers/Core/Analyzers/AnalyzersResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,13 @@
<data name="Simplify_check" xml:space="preserve">
<value>Simplify check</value>
</data>
</root>
<data name="Base_classes_contain_inaccessible_unimplemented_members" xml:space="preserve">
<value>Base classes contain inaccessible unimplemented members</value>
</data>
<data name="Implement_abstract_class" xml:space="preserve">
<value>Implement abstract class</value>
</data>
<data name="Implement_through_0" xml:space="preserve">
<value>Implement through '{0}'</value>
</data>
</root>
15 changes: 15 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading