summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbluebear94 <uruwi@protonmail.com>2023-08-21 10:21:37 -0400
committerGitHub <noreply@github.com>2023-08-21 16:21:37 +0200
commit877df549aae877cf53de2fe250a552358fa5aad9 (patch)
tree26a6105ab61c418afdbbbfe34ab99d0837a5ddfb /tests
parent5c6434d4cef8bd1bf3ad2c77f379a8b174939ab9 (diff)
Check for control flow event before let binding (#1912)
Fixes #1906 (trying to destructure the result of `continue`).
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/compiler/break-continue.pngbin7854 -> 9732 bytes
-rw-r--r--tests/typ/compiler/break-continue.typ15
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/ref/compiler/break-continue.png b/tests/ref/compiler/break-continue.png
index 66197443..9751d395 100644
--- a/tests/ref/compiler/break-continue.png
+++ b/tests/ref/compiler/break-continue.png
Binary files differ
diff --git a/tests/typ/compiler/break-continue.typ b/tests/typ/compiler/break-continue.typ
index 6f505f80..4c4738bb 100644
--- a/tests/typ/compiler/break-continue.typ
+++ b/tests/typ/compiler/break-continue.typ
@@ -145,3 +145,18 @@
for _ in range(3) [B]
)
}
+
+---
+// Ref: true
+// Test continue while destructuring.
+// Should output "one = I \ two = II \ one = I".
+#for num in (1, 2, 3, 1) {
+ let (word, roman) = if num == 1 {
+ ("one", "I")
+ } else if num == 2 {
+ ("two", "II")
+ } else {
+ continue
+ }
+ [#word = #roman \ ]
+}