提交 4cd29113 编写于 作者: J jnm2

Add a test for mismatching constant type

上级 4b1304e5
......@@ -862,6 +862,53 @@ void Method()
}", index: 2);
}
[Fact]
public async Task NotAllMembersExist_NotDefault_WithMismatchingConstantType()
{
await TestInRegularAndScriptAsync(
@"enum MyEnum
{
Fizz,
Buzz,
FizzBuzz
}
class MyClass
{
void Method()
{
var e = MyEnum.Fizz;
_ = e [||]switch
{
(MyEnum)0 => 1,
(MyEnum)1 => 2,
""Mismatching constant"" => 3,
}
}
}",
@"enum MyEnum
{
Fizz,
Buzz,
FizzBuzz
}
class MyClass
{
void Method()
{
var e = MyEnum.Fizz;
_ = e switch
{
(MyEnum)0 => 1,
(MyEnum)1 => 2,
""Mismatching constant"" => 3,
_ => throw new System.NotImplementedException(),
}
}
}");
}
[Fact]
public async Task AllMissingTokens()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册