2019-08-23 11:56:54 -07:00
|
|
|
#pragma warning disable 168
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace IDETest
|
|
|
|
{
|
|
|
|
class Cases
|
|
|
|
{
|
|
|
|
public void Test()
|
|
|
|
{
|
|
|
|
Result<int> iResult = .Err;
|
|
|
|
|
|
|
|
if ((iResult case .Ok(var val0)) || (true)) //FAIL
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int val1;
|
|
|
|
if ((true) || (iResult case .Ok(out val1)))
|
|
|
|
{
|
|
|
|
int a = val1; //FAIL
|
|
|
|
}
|
|
|
|
}
|
2021-06-19 09:29:36 -07:00
|
|
|
|
2021-06-19 11:25:00 -07:00
|
|
|
int Switch1(Result<int> res)
|
2021-06-19 09:29:36 -07:00
|
|
|
{
|
|
|
|
switch (res)
|
|
|
|
{
|
|
|
|
case .Ok(let a):
|
|
|
|
fallthrough;
|
|
|
|
case .Err(let b): //FAIL
|
|
|
|
return 1;
|
|
|
|
}
|
2021-06-19 11:25:00 -07:00
|
|
|
}
|
2021-06-19 09:29:36 -07:00
|
|
|
|
|
|
|
int Switch2(Result<int> res)
|
|
|
|
{
|
|
|
|
switch (res)
|
|
|
|
{
|
|
|
|
case .Ok(let a):
|
|
|
|
if (a > 0)
|
2021-06-19 11:16:04 -07:00
|
|
|
break;
|
2021-06-19 09:29:36 -07:00
|
|
|
fallthrough;
|
|
|
|
case .Err:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} //FAIL
|
2019-08-23 11:56:54 -07:00
|
|
|
}
|
|
|
|
}
|