Skip to content

Commit

Permalink
Fix analyzer RCS1046 (#1283)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Nov 24, 2023
1 parent 62a9d84 commit e4051ef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix analyzer [RCS0058](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0058) ([PR](https://github.com/dotnet/roslynator/pull/1281))
- Fix analyzer [RCS1163](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1163) ([PR](https://github.com/dotnet/roslynator/pull/1280))
- Fix analyzer [RCS1203](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1203) ([PR](https://github.com/dotnet/roslynator/pull/1282))
- Fix analyzer [RCS1046](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1046) ([PR](https://github.com/dotnet/roslynator/pull/1283))

## [4.6.4] - 2023-11-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ private static void AnalyzeMethodDeclaration(SyntaxNodeAnalysisContext context,
if (SymbolUtility.CanBeEntryPoint(methodSymbol))
return;

if (methodSymbol.ImplementsInterfaceMember(allInterfaces: true))
return;

if (!SymbolUtility.IsAwaitable(methodSymbol.ReturnType, shouldCheckWindowsRuntimeTypes)
&& !methodSymbol.ReturnType.OriginalDefinition.HasMetadataName(in MetadataNames.System_Collections_Generic_IAsyncEnumerable_T))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ static async Task Main()
await Task.CompletedTask;
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.AsynchronousMethodNameShouldEndWithAsync)]
public async Task TestNoDiagnostic_Interface()
{
await VerifyNoDiagnosticAsync(@"
using System.Threading.Tasks;
interface IFoo
{
#pragma warning disable RCS1046
Task Foo();
#pragma warning restore RCS1046
}
class C : IFoo
{
public Task Foo() => Task.CompletedTask;
}
");
}
}

0 comments on commit e4051ef

Please sign in to comment.