Skip to content

Commit

Permalink
Unskip a test
Browse files Browse the repository at this point in the history
  • Loading branch information
gafter committed Mar 19, 2019
1 parent faf69ce commit 3c1f656
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1207,5 +1207,41 @@ void M8(object o, bool b)
// _ = o switch // 3 not exhaustive
Diagnostic(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull, "switch").WithLocation(63, 15));
}

[Fact, WorkItem(31881, "https://github.com/dotnet/roslyn/issues/31881")]
public void NullableVsPattern_31881()
{
var source = @"
using System;
#nullable enable
public class C
{
public object? AProperty { get; set; }
public void M(C? input, int i)
{
if (input?.AProperty is string str)
{
Console.WriteLine(str.ToString());
switch (i)
{
case 1:
Console.WriteLine(input?.AProperty.ToString());
break;
case 2:
Console.WriteLine(input.AProperty.ToString());
break;
case 3:
Console.WriteLine(input.ToString());
break;
}
}
}
}
";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics();
}
}
}

0 comments on commit 3c1f656

Please sign in to comment.