Files
c3c/test/test_suite/statements/if_while_do_error.c3
2021-11-28 01:35:09 +01:00

34 lines
546 B
C

module test;
fn void test1()
{
bool! x = 0;
if (x) // #error: The expression may not be a failable, but was 'bool!'
{
x = 100;
}
}
fn void test2()
{
bool! x = 0;
while (x) // #error: The expression may not be a failable, but was 'bool!'
{
x = false;
}
}
fn void test3()
{
bool! x = 0;
double y = 1;
do
{
y = y + 1;
} while (y);
do
{
x = !x;
}
while (x); // #error: A failable 'bool!' cannot be implicitly converted to a regular boolean value
}