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

Verify that we do not box for integer "is constant"

Fixes #12813
上级 0c51585e
......@@ -772,6 +772,31 @@ .maxstack 1
IL_0017: ret
IL_0018: ldc.i4.3
IL_0019: ret
}");
}
[Fact, WorkItem(12813, "https://github.com/dotnet/roslyn/issues/12813")]
public void NoBoxingOnIntegerConstantPattern()
{
var source =
@"public class C
{
static bool M1(int x)
{
return x is 42;
}
}";
var compilation = CreateCompilation(source, options: TestOptions.ReleaseDll);
compilation.VerifyDiagnostics();
var compVerifier = CompileAndVerify(compilation);
compVerifier.VerifyIL("C.M1",
@"{
// Code size 6 (0x6)
.maxstack 2
IL_0000: ldc.i4.s 42
IL_0002: ldarg.0
IL_0003: ceq
IL_0005: ret
}");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册