Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
MaStr11 committed Oct 3, 2018
1 parent 9892220 commit 77c29cd
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,49 @@ void M(string s2)
if (ReferenceEquals(s2, null) is null)
return;
}
}");
}

[WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)]
public async Task TestUnconstrainedMethodTypeParameter()
{
await TestInRegularAndScriptAsync(
@"
public sealed class A
{
public bool Test<T>(T a) => {|FixAllInDocument:ReferenceEquals|}(a, null);
public static void NotNull<T>(T value, string parameterName)
{
if (ReferenceEquals(value, null))
{
throw new ArgumentNullException(parameterName);
}
}
}
public class B<T>
{
public bool Test(T b) => ReferenceEquals(b, null);
}",
@"
public sealed class A
{
public bool Test<T>(T a) => a == null;
public static void NotNull<T>(T value, string parameterName)
{
if (value == null)
{
throw new ArgumentNullException(parameterName);
}
}
}
public class B<T>
{
public bool Test(T b) => b == null;
}");
}
}
Expand Down

0 comments on commit 77c29cd

Please sign in to comment.