Skip to content

Commit

Permalink
Unskip some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gafter committed Mar 19, 2019
1 parent 3c1f656 commit e49ddea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68858,7 +68858,6 @@ void M0<T>(object? x0, T z0)
ref T M2<T>(T x) => throw null!;
}
";
// https://github.com/dotnet/roslyn/issues/30952 - Expect WRN_NullReferenceAssignment for [M2(y0) = z0;]
CreateCompilation(source, options: WithNonNullTypesTrue()).VerifyDiagnostics();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,19 +547,18 @@ static void G(object? x)
[Fact]
public void IsDeclarationPattern_01()
{
// https://github.com/dotnet/roslyn/issues/30952: `is` declaration does not set not nullable for declared local.
var source =
@"class Program
{
//static void F1(object x1)
//{
// if (x1 is string y1)
// {
// x1/*T:object!*/.ToString();
// y1/*T:string!*/.ToString();
// }
// x1/*T:object!*/.ToString();
//}
static void F1(object x1)
{
if (x1 is string y1)
{
x1/*T:object!*/.ToString();
y1/*T:string!*/.ToString();
}
x1/*T:object!*/.ToString();
}
static void F2(object? x2)
{
if (x2 is string y2)
Expand Down Expand Up @@ -743,6 +742,7 @@ static void F2(object? x2)
}

[Fact]
[WorkItem(30952, "https://github.com/dotnet/roslyn/issues/30952")]
public void IsDeclarationPattern_NeverNull_02()
{
var source =
Expand All @@ -754,27 +754,28 @@ static void F1<T, U>(T t1)
{
if (t1 is U u1)
{
t1?.ToString(); // 1
u1?.ToString(); // 2
t1.ToString();
u1.ToString();
}
t1?.ToString(); // 3
t1.ToString();
}
static void F2<T, U>(T t2)
where T : class?
where U : class
{
if (t2 is U u2)
{
t2?.ToString(); // 4
u2?.ToString(); // 5
t2.ToString();
u2.ToString();
}
t2?.ToString();
t2.ToString(); // 1
}
}";
// https://github.com/dotnet/roslyn/issues/30952: `is` declaration does not set not nullable for declared local.
var comp = CreateCompilation(source, options: WithNonNullTypesTrue());
comp.VerifyDiagnostics(
);
// (23,9): warning CS8602: Possible dereference of a null reference.
// t2.ToString(); // 2
Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "t2").WithLocation(23, 9));
}

[Fact]
Expand Down

0 comments on commit e49ddea

Please sign in to comment.