Regression test for 32503

This issue is fixed. Adding a regression test.

closes #32503
上级 03254095
......@@ -24,6 +24,9 @@ x64/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# Debug artifacts
launchSettings.json
# Prevent accidental re-checkin of NuGet.exe
NuGet.exe
......@@ -191,4 +194,4 @@ $RECYCLE.BIN/
.idea/
# WPF temp projects
*wpftmp.*
\ No newline at end of file
*wpftmp.*
......@@ -74820,5 +74820,26 @@ void M1(C? c1)
// c1 ??= M2(c1);
Diagnostic(ErrorCode.WRN_NullReferenceArgument, "c1").WithArguments("c1", "C C.M2(C c1)").WithLocation(6, 19));
}
[WorkItem(32503, "https://github.com/dotnet/roslyn/issues/32503")]
[Fact]
public void PatternDeclarationBreaksNullabeAnalysis()
{
var source = @"
#nullable enable
class A { }
class B : A
{
A M()
{
var s = new A();
if (s is B b) {}
return s;
}
}
";
var comp = CreateCompilation(source);
comp.VerifyDiagnostics();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册