There was an error while loading. Please reload this page.
1 parent 4e04827 commit 0a1de1eCopy full SHA for 0a1de1e
2 files changed
Switch.ark
@@ -22,5 +22,6 @@
22
# @author https://github.com/SuperFola
23
(macro switch (value case then ...cases) {
24
(macro var ($gensym))
25
- (let var value)
26
- (_switch_impl var case then ...cases) })
+ {
+ (let var value)
27
+ (_switch_impl var case then ...cases) } })
tests/switch-tests.ark
@@ -36,4 +36,8 @@
36
(switch (let n 1)
37
0 (test:expect false)
38
1 (test:expect true)
39
- _ (test:expect false)) })
+ _ (test:expect false))
40
+
41
+ # (switch ...) should count as a single expression
42
+ (test:eq (+ 0 (switch 1 1 1)) 1)
43
+ (test:eq ((fun () (switch 1 1 1))) 1) })
0 commit comments