//! > Test while-let with parenthesis
//! > test_comments
//! > test_runner_name
get_diagnostics
//! > cairo_code
fn f() {
while (let x = 0) {}
}
//! > expected_diagnostics
error[E1001]: Missing token ')'.
--> dummy_file.cairo:2:12
while (let x = 0) {}
^
error[E1001]: Missing token '{'.
--> dummy_file.cairo:2:12
while (let x = 0) {}
^
error[E1001]: Missing token ';'.
--> dummy_file.cairo:2:21
while (let x = 0) {}
^
error[E1000]: Skipped tokens. Expected: statement.
--> dummy_file.cairo:2:21
while (let x = 0) {}
^
error[E1001]: Missing token '}'.
--> dummy_file.cairo:3:2
}
^
//! > ==========================================================================
//! > Test while-let with operators of precedence lower than `&&`
//! > test_comments
//! > test_runner_name
get_diagnostics
//! > cairo_code
fn f() {
// Check that tokens after the operator are skipped without diagnostics, and diagnostics inside
// the `while` body are reported.
while let x = 10 || false < > { += }
while let x = 0 += 2 {}
while let x = 0..2 {}
}
//! > expected_diagnostics
error[E1030]: Operator '||' is not allowed in let chains. Consider wrapping the expression in parentheses.
--> dummy_file.cairo:4:23
while let x = 10 || false < > { += }
^
error[E1000]: Skipped tokens. Expected: statement.
--> dummy_file.cairo:4:38
while let x = 10 || false < > { += }
^^
error[E1030]: Operator '+=' is not allowed in let chains. Consider wrapping the expression in parentheses.
--> dummy_file.cairo:5:21
while let x = 0 += 2 {}
^
error[E1030]: Operator '..' is not allowed in let chains. Consider wrapping the expression in parentheses.
--> dummy_file.cairo:6:20
while let x = 0..2 {}
^