Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
gafter committed Mar 19, 2019
1 parent e49ddea commit 9e38138
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1244,5 +1244,25 @@ public void M(C? input, int i)
var comp = CreateCompilation(source);
comp.VerifyDiagnostics();
}

[Fact, WorkItem(33499, "https://github.com/dotnet/roslyn/issues/33499")]
public void PatternVariablesAreNotOblivious_33499()
{
var source = @"
#nullable enable
class Test
{
static void M(object o)
{
if (o is string s) { }
s = null;
}
}";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (8,13): warning CS8600: Converting null literal or possible null value to non-nullable type.
// s = null;
Diagnostic(ErrorCode.WRN_ConvertingNullableToNonNullable, "null").WithLocation(8, 13));
}
}
}

0 comments on commit 9e38138

Please sign in to comment.