1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-24 06:03:17 +00:00
This commit is contained in:
Calvin Rose 2020-12-11 19:21:54 -06:00
parent 12f470ed10
commit 6020106000
2 changed files with 2 additions and 1 deletions

View File

@ -1652,7 +1652,7 @@
# match data structure template
(or isarr (= t :struct) (= t :table))
(eachp [i sub-pattern] pattern
(when (not= t :array)
(when (not isarr)
(array/push anda [not= nil (get-sym s i)]))
(visit-pattern-2 anda gun preds s i sub-pattern))

View File

@ -125,6 +125,7 @@
(assert (= :yes (match {:a 1} {:a _} :yes :no)) "match wildcard 5")
(assert (= false (match {:a 1 :b 2 :c 3} {:a a :b _ :c _ :d _} :no {:a _ :b _ :c _} false :no)) "match wildcard 6")
(assert (= nil (match {:a 1 :b 2 :c 3} {:a a :b _ :c _ :d _} :no {:a _ :b _ :c _} nil :no)) "match wildcard 7")
(assert (= "t" (match [true nil] [true _] "t")) "match wildcard 8")
# Regression #301
(def b (buffer/new-filled 128 0x78))