Files
c3c/test/test_suite/statements/if_while_do_error.c3
Christoffer Lerno 25bccf4883 New faults and syntax (#2034)
- Remove `[?]` syntax.
- Change `int!` to `int?` syntax.
- New `fault` declarations.
- Enum associated values can reference the calling enum.
2025-03-10 00:11:35 +01:00

34 lines
489 B
Plaintext

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