未验证 提交 22a16482 编写于 作者: J Jared Parsons 提交者: GitHub

Merge pull request #32810 from jaredpar/fix-test

Regression test for 32503
......@@ -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.*
......@@ -74902,5 +74902,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 PatternDeclarationBreaksNullableAnalysis()
{
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.
先完成此消息的编辑!
想要评论请 注册