Skip to content

Commit ed5fa5e

Browse files
Merge pull request #74539 from CyrusNajmabadi/moveImplementAbstractClassToShared
2 parents 5998125 + d915982 commit ed5fa5e

File tree

139 files changed

+1217
-1140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+1217
-1140
lines changed

src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Compile Include="$(MSBuildThisFileDirectory)GenerateConstructor\GenerateConstructorDiagnosticIds.cs" />
4949
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.AddNewKeywordAction.cs" />
5050
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseCodeFixProvider.cs" />
51+
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\CSharpImplementAbstractClassCodeFixProvider.cs" />
5152
<Compile Include="$(MSBuildThisFileDirectory)Iterator\CSharpAddYieldCodeFixProvider.cs" />
5253
<Compile Include="$(MSBuildThisFileDirectory)Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs" />
5354
<Compile Include="$(MSBuildThisFileDirectory)MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp.ImplementAbstractClass;
1212

1313
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ImplementAbstractClass), Shared]
1414
[ExtensionOrder(After = PredefinedCodeFixProviderNames.GenerateType)]
15-
internal class CSharpImplementAbstractClassCodeFixProvider :
15+
internal sealed class CSharpImplementAbstractClassCodeFixProvider :
1616
AbstractImplementAbstractClassCodeFixProvider<TypeDeclarationSyntax>
1717
{
1818
private const string CS0534 = nameof(CS0534); // 'Program' does not implement inherited abstract member 'Goo.bar()'

src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
<Compile Include="$(MSBuildThisFileDirectory)ForEachCast\ForEachCastTests.cs" />
3535
<Compile Include="$(MSBuildThisFileDirectory)Formatting\FormattingAnalyzerTests.cs" />
3636
<Compile Include="$(MSBuildThisFileDirectory)HideBase\HideBaseTests.cs" />
37+
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests.cs" />
38+
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests_FixAllTests.cs" />
39+
<Compile Include="$(MSBuildThisFileDirectory)ImplementAbstractClass\ImplementAbstractClassTests_ThroughMember.cs" />
3740
<Compile Include="$(MSBuildThisFileDirectory)Iterator\AddYieldTests.cs" />
3841
<Compile Include="$(MSBuildThisFileDirectory)Iterator\ChangeToIEnumerableTests.cs" />
3942
<Compile Include="$(MSBuildThisFileDirectory)MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticTests.cs" />
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ abstract class Base
7272
class [|Derived|] : Base
7373
{
7474
}
75-
""", [FeaturesResources.Implement_abstract_class]);
75+
""", [AnalyzersResources.Implement_abstract_class]);
7676
}
7777

7878
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -93,7 +93,7 @@ abstract class Middle : Base
9393
class [|Derived|] : Base
9494
{
9595
}
96-
""", [FeaturesResources.Implement_abstract_class]);
96+
""", [AnalyzersResources.Implement_abstract_class]);
9797
}
9898

9999
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -126,7 +126,7 @@ public override void Method()
126126
inner.Method();
127127
}
128128
}
129-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
129+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
130130
}
131131

132132
[Fact]
@@ -159,7 +159,7 @@ public override void Method(int a, ref int b, in int c, ref readonly int d, out
159159
inner.Method(a, ref b, c, in d, out e);
160160
}
161161
}
162-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
162+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
163163
}
164164

165165
[Fact]
@@ -189,7 +189,7 @@ class Derived : Base
189189
190190
public override int this[int a, in int b, ref readonly int c, out int d] => inner[a, b, in c, out d];
191191
}
192-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
192+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
193193
}
194194

195195
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -224,7 +224,7 @@ public override void Method1()
224224
inner.Method1();
225225
}
226226
}
227-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
227+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
228228
}
229229

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

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

294294
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -321,7 +321,7 @@ public override void Method()
321321
inner.Method();
322322
}
323323
}
324-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
324+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
325325
}
326326

327327
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -347,9 +347,9 @@ class [|Derived|] : Base, IInterface
347347
}
348348
""",
349349
[
350-
FeaturesResources.Implement_abstract_class,
351-
string.Format(FeaturesResources.Implement_through_0, "Inner"),
352-
string.Format(FeaturesResources.Implement_through_0, "IInterface.Inner"),
350+
AnalyzersResources.Implement_abstract_class,
351+
string.Format(AnalyzersResources.Implement_through_0, "Inner"),
352+
string.Format(AnalyzersResources.Implement_through_0, "IInterface.Inner"),
353353
]);
354354
}
355355

@@ -367,7 +367,7 @@ class [|Derived|] : Base
367367
{
368368
dynamic inner;
369369
}
370-
""", [FeaturesResources.Implement_abstract_class]);
370+
""", [AnalyzersResources.Implement_abstract_class]);
371371
}
372372

373373
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -400,7 +400,7 @@ public override void Method()
400400
inner.Method();
401401
}
402402
}
403-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
403+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
404404
}
405405

406406
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -430,7 +430,7 @@ class Derived : Base
430430
431431
public override int Property { get => inner.Property; set => inner.Property = value; }
432432
}
433-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
433+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
434434
}
435435

436436
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -505,7 +505,7 @@ class Derived : Base
505505
506506
public override int SetOnly { set => inner.SetOnly = value; }
507507
}
508-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
508+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
509509
}
510510

511511
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -596,7 +596,7 @@ public override event Action Event
596596
}
597597
}
598598
}
599-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
599+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
600600
}
601601

602602
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -633,7 +633,7 @@ public override void Method()
633633
inner.Method();
634634
}
635635
}
636-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
636+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
637637
}
638638

639639
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -650,7 +650,7 @@ class [|Derived|] : Base
650650
{
651651
Base inner;
652652
}
653-
""", [FeaturesResources.Implement_abstract_class]);
653+
""", [AnalyzersResources.Implement_abstract_class]);
654654
}
655655

656656
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -683,7 +683,7 @@ protected override void Method()
683683
inner.Method();
684684
}
685685
}
686-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
686+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
687687
}
688688

689689
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -716,7 +716,7 @@ protected internal override void Method()
716716
inner.Method();
717717
}
718718
}
719-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
719+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
720720
}
721721

722722
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -749,7 +749,7 @@ internal override void Method()
749749
inner.Method();
750750
}
751751
}
752-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
752+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
753753
}
754754

755755
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -766,7 +766,7 @@ class [|Derived|] : Base
766766
{
767767
Base inner;
768768
}
769-
""", [FeaturesResources.Implement_abstract_class]);
769+
""", [AnalyzersResources.Implement_abstract_class]);
770770
}
771771

772772
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/41420")]
@@ -799,7 +799,7 @@ private protected override void Method()
799799
inner.Method();
800800
}
801801
}
802-
""", index: 1, title: string.Format(FeaturesResources.Implement_through_0, "inner"));
802+
""", index: 1, title: string.Format(AnalyzersResources.Implement_through_0, "inner"));
803803
}
804804

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

838838
[Fact]
@@ -935,7 +935,7 @@ class [|Program|](Base base1) : Base
935935
{
936936
private Base _base = base1;
937937
}
938-
""", [FeaturesResources.Implement_abstract_class, string.Format(FeaturesResources.Implement_through_0, "_base")]);
938+
""", [AnalyzersResources.Implement_abstract_class, string.Format(AnalyzersResources.Implement_through_0, "_base")]);
939939
}
940940

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

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

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

995995
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/69177")]

src/Analyzers/Core/Analyzers/AnalyzersResources.resx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,13 @@
397397
<data name="Simplify_check" xml:space="preserve">
398398
<value>Simplify check</value>
399399
</data>
400-
</root>
400+
<data name="Base_classes_contain_inaccessible_unimplemented_members" xml:space="preserve">
401+
<value>Base classes contain inaccessible unimplemented members</value>
402+
</data>
403+
<data name="Implement_abstract_class" xml:space="preserve">
404+
<value>Implement abstract class</value>
405+
</data>
406+
<data name="Implement_through_0" xml:space="preserve">
407+
<value>Implement through '{0}'</value>
408+
</data>
409+
</root>

src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)