Skip to content

Commit 52d95d8

Browse files
authored
Allow trailing single quotes in Symbols and Keywords (#650)
* Allow trailing single quotes in Symbols and Keywords * More parallelism for PyPy * Add a test cuz why not
1 parent c46d26d commit 52d95d8

File tree

7 files changed

+253
-205
lines changed

7 files changed

+253
-205
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ jobs:
180180
test-pypy-36:
181181
docker:
182182
- image: pypy:3.6-slim-buster
183-
parallelism: 4
183+
parallelism: 8
184184
steps:
185185
- run_pypy_tests:
186186
python_version: "3.6"
187187

188188
test-pypy-37:
189189
docker:
190190
- image: pypy:3.7-slim-buster
191-
parallelism: 4
191+
parallelism: 8
192192
steps:
193193
- run_pypy_tests:
194194
python_version: "3.7"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
* Fixed a bug where it was impossible to use more than a single body expression in a `try` special form (#640)
2828
* Fixed a bug where re-`def`ing a Var (regardless of `^:redef` metadata) would not update metadata or dynamic flag (#642)
2929
* Fixed a bug where private Vars could be resolved from the source namespace of a public macro during macroexpansion (#648)
30+
* Fixed a bug where trailing quotes were not allowed in Symbols and Keywords (#650)
3031

3132
### Removed
3233
* Removed Click as a dependency in favor of builtin `argparse` (#622, #624, #636)

src/basilisp/edn.lpy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128
:error :unexpected-char}))
129129
(recur name [] true))))
130130

131-
(re-matches ns-name-chars c)
131+
(or (re-matches ns-name-chars c)
132+
(and (seq name) (= c "'")))
132133
(do
133134
(.next-token reader)
134135
(recur ns (conj name c) has-ns))

src/basilisp/lang/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def _read_namespaced(
514514
has_ns = True
515515
ns = name
516516
name = []
517-
elif ns_name_chars.match(token):
517+
elif ns_name_chars.match(token) or (name and token == "'"):
518518
reader.next_token()
519519
name.append(token)
520520
elif allowed_suffix is not None and token == allowed_suffix:

tests/basilisp/compiler_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5368,6 +5368,17 @@ def test_private_aliased_var_does_not_resolve(
53685368
finally:
53695369
runtime.Namespace.remove(other_ns_name)
53705370

5371+
def test_private_var_does_not_resolve_during_macroexpansion(
5372+
self, lcompile: CompileFn, ns: runtime.Namespace
5373+
):
5374+
# In a previous version of the compiler, it was possible to get access
5375+
# to namespace private Vars simply by referring to them from within macros
5376+
# from the same namespace.
5377+
#
5378+
# https://github.com/basilisp-lang/basilisp/issues/646
5379+
with pytest.raises(compiler.CompilerException):
5380+
lcompile("(let [] basilisp.core/*generated-python*)")
5381+
53715382
def test_aliased_macro_symbol_resolution(
53725383
self, lcompile: CompileFn, ns: runtime.Namespace
53735384
):

0 commit comments

Comments
 (0)