mirror of
https://github.com/janet-lang/janet
synced 2026-09-22 00:48:42 +00:00
Add fix for issue #1687 - destrucutre + splice
An optimization to ellude creation of intermediate tuples was erroneously flagging a splice as invalid, even though it was valid. Instead, if we see splice on the rhs, bail out of the optimization.
This commit is contained in:
@@ -195,5 +195,10 @@
|
||||
(assert (= :yes (match [1 2 3] [x y z w] :no1 [x y $] :no2 [x y z] :yes)) "match dollar suffix 1")
|
||||
(assert (= :yes (match [1 2 3] [x y z w] :no1 [x y z $] :yes [x y z] :no2)) "match dollar suffix 2")
|
||||
|
||||
# Issue #1687
|
||||
(assert-no-error "def destructure splice works 1" (do (def [a] [;[1]]) a))
|
||||
(assert-no-error "def destructure splice works 2" (do (def (n) [(splice [])]) n))
|
||||
(assert-no-error "var destructure splice works" (do (var [a] [;[1]]) a))
|
||||
|
||||
(end-suite)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user