1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00
Beef/IDE/Tests/CompileFail001/src/Cases.bf
2025-02-22 10:40:14 -08:00

52 lines
694 B
Beef

#pragma warning disable 168
using System;
namespace IDETest
{
class Cases
{
public void Test()
{
Result<int> iResult = .Err;
if ((iResult case .Ok(var val0)) && (iResult case .Ok(var val1)))
{
val0 = 0;
val1 = 0;
}
val0 = 0;
val1 = 0; //FAIL
int val2;
if ((true) || (iResult case .Ok(out val2)))
{
int a = val2; //FAIL
}
}
int Switch1(Result<int> res)
{
switch (res)
{
case .Ok(let a):
fallthrough;
case .Err(let b): //FAIL
return 1;
}
}
int Switch2(Result<int> res)
{
switch (res)
{
case .Ok(let a):
if (a > 0)
break;
fallthrough;
case .Err:
return 1;
}
} //FAIL
}
}