fix gensym format to start with _ for import *
This commit is contained in:
parent
1fd0dc8fbe
commit
c4b3d7bcda
@ -224,7 +224,7 @@
|
||||
(global _gensym_lock)
|
||||
(.acquire _gensym_lock)
|
||||
(try (do (setv _gensym_counter (inc _gensym_counter))
|
||||
(setv new_symbol (HySymbol (.format ":{0}_{1}" g _gensym_counter))))
|
||||
(setv new_symbol (HySymbol (.format "_;{0}|{1}" g _gensym_counter))))
|
||||
(finally (.release _gensym_lock)))
|
||||
new_symbol)
|
||||
|
||||
|
@ -272,10 +272,10 @@ result['y in globals'] = 'y' in globals()")
|
||||
(import [hy.models [HySymbol]])
|
||||
(setv s1 (gensym))
|
||||
(assert (isinstance s1 HySymbol))
|
||||
(assert (= 0 (.find s1 ":G_")))
|
||||
(assert (= 0 (.find s1 "_;G|")))
|
||||
(setv s2 (gensym "xx"))
|
||||
(setv s3 (gensym "xx"))
|
||||
(assert (= 0 (.find s2 ":xx_")))
|
||||
(assert (= 0 (.find s2 "_;xx|")))
|
||||
(assert (not (= s2 s3)))
|
||||
(assert (not (= (str s2) (str s3)))))
|
||||
|
||||
|
@ -163,8 +163,8 @@
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
;; and make sure there is something new that starts with :G_
|
||||
(assert (in ":G_" s1))
|
||||
(assert (in ":G_" s2))
|
||||
(assert (in "_;G|" s1))
|
||||
(assert (in "_;G|" s2))
|
||||
;; but make sure the two don't match each other
|
||||
(assert (not (= s1 s2))))
|
||||
|
||||
@ -188,8 +188,8 @@
|
||||
(setv _ast2 (import_buffer_to_ast macro1 "foo"))
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
(assert (in ":a_" s1))
|
||||
(assert (in ":a_" s2))
|
||||
(assert (in "_;a|" s1))
|
||||
(assert (in "_;a|" s2))
|
||||
(assert (not (= s1 s2))))
|
||||
|
||||
(defn test-defmacro-g! []
|
||||
@ -211,8 +211,8 @@
|
||||
(setv _ast2 (import_buffer_to_ast macro1 "foo"))
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
(assert (in ":res_" s1))
|
||||
(assert (in ":res_" s2))
|
||||
(assert (in "_;res|" s1))
|
||||
(assert (in "_;res|" s2))
|
||||
(assert (not (= s1 s2)))
|
||||
|
||||
;; defmacro/g! didn't like numbers initially because they
|
||||
@ -240,8 +240,8 @@
|
||||
(setv _ast2 (import_buffer_to_ast macro1 "foo"))
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
(assert (in ":res_" s1))
|
||||
(assert (in ":res_" s2))
|
||||
(assert (in "_;res|" s1))
|
||||
(assert (in "_;res|" s2))
|
||||
(assert (not (= s1 s2)))
|
||||
|
||||
;; defmacro/g! didn't like numbers initially because they
|
||||
|
Loading…
Reference in New Issue
Block a user