mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 22:34:09 +02:00
Fixed exhaustive switch case test with const enums
This commit is contained in:
parent
5731b15b05
commit
63a87cbe57
2 changed files with 32 additions and 18 deletions
|
@ -4766,6 +4766,12 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
|
||||||
if ((switchValue) && (switchStmt->mDefaultCase == NULL))
|
if ((switchValue) && (switchStmt->mDefaultCase == NULL))
|
||||||
{
|
{
|
||||||
if (switchValue.mType->IsEnum())
|
if (switchValue.mType->IsEnum())
|
||||||
|
{
|
||||||
|
if (hadConstMatch)
|
||||||
|
{
|
||||||
|
// Already handled
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
auto enumType = switchValue.mType->ToTypeInstance();
|
auto enumType = switchValue.mType->ToTypeInstance();
|
||||||
if (enumType->IsPayloadEnum())
|
if (enumType->IsPayloadEnum())
|
||||||
|
@ -4796,6 +4802,7 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isComprehensive)
|
if (!isComprehensive)
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,6 +114,13 @@ namespace Tests
|
||||||
}
|
}
|
||||||
Test.Assert(val == 0);
|
Test.Assert(val == 0);
|
||||||
|
|
||||||
|
const EnumA cea = .A;
|
||||||
|
switch (cea)
|
||||||
|
{
|
||||||
|
case .A:
|
||||||
|
val = 123;
|
||||||
|
}
|
||||||
|
|
||||||
ee = .B(10);
|
ee = .B(10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue