about summary refs log tree commit diff
path: root/tests/ui/parser/or-in-let-chain.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/or-in-let-chain.rs')
-rw-r--r--tests/ui/parser/or-in-let-chain.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/parser/or-in-let-chain.rs b/tests/ui/parser/or-in-let-chain.rs
new file mode 100644
index 00000000000..4c4372bb00f
--- /dev/null
+++ b/tests/ui/parser/or-in-let-chain.rs
@@ -0,0 +1,17 @@
+//@ revisions: edition2021 edition2024
+//@ [edition2021] edition: 2021
+//@ [edition2024] edition: 2024
+
+fn main() {
+    if let true = true || false {}
+    //~^ ERROR `||` operators are not supported in let chain conditions
+    // With parentheses
+    if (let true = true) || false {}
+    //~^ ERROR expected expression, found `let` statement
+    // Multiple || operators
+    if let true = true || false || true {}
+    //~^ ERROR `||` operators are not supported in let chain conditions
+    // Mixed operators (should still show error for ||)
+    if let true = true && false || true {}
+    //~^ ERROR `||` operators are not supported in let chain conditions
+}