From c4b3d7bcda7cedeee00f345867fc6835736d9505 Mon Sep 17 00:00:00 2001 From: gilch Date: Sat, 23 Sep 2017 23:10:23 -0600 Subject: [PATCH] fix gensym format to start with _ for import * --- hy/core/language.hy | 2 +- tests/native_tests/core.hy | 4 ++-- tests/native_tests/native_macros.hy | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hy/core/language.hy b/hy/core/language.hy index e4aa531..fd67f15 100644 --- a/hy/core/language.hy +++ b/hy/core/language.hy @@ -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) diff --git a/tests/native_tests/core.hy b/tests/native_tests/core.hy index d9455ef..e5af611 100644 --- a/tests/native_tests/core.hy +++ b/tests/native_tests/core.hy @@ -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))))) diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy index d3efcb6..12e4fe1 100644 --- a/tests/native_tests/native_macros.hy +++ b/tests/native_tests/native_macros.hy @@ -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