1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-16 08:17:41 +00:00

Try to address memoization problem in pegs.

This commit is contained in:
Calvin Rose
2019-08-29 19:09:43 -05:00
parent d4b49cd622
commit 8bc8709d0e
2 changed files with 26 additions and 8 deletions

View File

@@ -421,4 +421,14 @@
(assert (= (tuple/type (-> '(1 2 3) marshal unmarshal)) :parens) "normal tuple marshalled/unmarshalled")
(assert (= (tuple/type (-> '[1 2 3] marshal unmarshal)) :brackets) "normal tuple marshalled/unmarshalled")
# Check for bad memoization (+ :a) should mean different things in different contexts.
(def redef-a
~{:a "abc"
:c (+ :a)
:main (* :c {:a "def" :main (+ :a)} -1)})
(check-match redef-a "abcdef" true)
(check-match redef-a "abcabc" false)
(check-match redef-a "defdef" false)
(end-suite)