Skip to content

Commit

Permalink
[GH-61] - proper checks for extension methods call
Browse files Browse the repository at this point in the history
  • Loading branch information
tpodolak committed Jan 27, 2019
1 parent 628ce4c commit 9f52c20
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CallInfoAnalyzer()

protected override SyntaxNode GetSubstituteCall(IMethodSymbol methodSymbol, InvocationExpressionSyntax invocationExpressionSyntax)
{
if (methodSymbol.IsStatic)
if (methodSymbol.IsExtensionMethod)
{
switch (methodSymbol.MethodKind)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private bool SupportsCallInfo(SyntaxNodeAnalysisContext syntaxNodeContext, TInvo
var allArguments = GetArgumentExpressions(syntax);
var argumentsForAnalysis = methodSymbol.MethodKind == MethodKind.ReducedExtension
? allArguments
: methodSymbol.IsStatic ? allArguments.Skip(1) : allArguments;
: methodSymbol.IsExtensionMethod ? allArguments.Skip(1) : allArguments;

if (MethodNames.TryGetValue(methodSymbol.Name, out var typeName) == false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CallInfoAnalyzer()

protected override SyntaxNode GetSubstituteCall(IMethodSymbol methodSymbol, InvocationExpressionSyntax invocationExpressionSyntax)
{
if (methodSymbol.IsStatic)
if (methodSymbol.IsExtensionMethod)
{
switch (methodSymbol.MethodKind)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace NSubstitute.Analyzers.Tests.VisualBasic.DiagnosticAnalyzersTests.CallInfoAnalyzerTests
{
[CombinatoryData("Returns", "ReturnsForAnyArgs")]
[CombinatoryData("AndDoes")]
public class AndDoesMethodTests : CallInfoDiagnosticVerifier
{
public override async Task ReportsNoDiagnostics_WhenSubstituteMethodCannotBeInferred(string method, string call, string argAccess)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class VisualBasicDiagnosticVerifier : DiagnosticVerifier

protected override CompilationOptions GetCompilationOptions()
{
return new VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optionStrict: OptionStrict.On);
return new VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optionStrict: OptionStrict.Off);
}

protected override IEnumerable<MetadataReference> GetAdditionalMetadataReferences()
Expand Down

0 comments on commit 9f52c20

Please sign in to comment.