提交 c795fd2e 编写于 作者: N Neal Gafter

Add test to verify code generation for the discard designator in a pattern

Fixes #15437
上级 c8564b07
......@@ -861,6 +861,32 @@ .maxstack 2
IL_0042: ldstr ""2""
IL_0047: call ""void System.Console.WriteLine(string)""
IL_004c: ret
}");
}
[Fact, WorkItem(15437, "https://github.com/dotnet/roslyn/issues/15437")]
public void IsTypeDiscard()
{
var source =
@"public class C
{
public bool IsString(object o)
{
return o is string _;
}
}";
var compilation = CreateCompilation(source, options: TestOptions.ReleaseDll);
compilation.VerifyDiagnostics();
var compVerifier = CompileAndVerify(compilation);
compVerifier.VerifyIL("C.IsString",
@"{
// Code size 10 (0xa)
.maxstack 2
IL_0000: ldarg.1
IL_0001: isinst ""string""
IL_0006: ldnull
IL_0007: cgt.un
IL_0009: ret
}");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册