File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
31
31
* Fix an issue where ` concat ` on maps was iterating over the keys instead of the key/value pairs (#871 )
32
32
* Fix a bug where the compiler would throw an exception partially macroexpanding forms with ` recur ` forms provided as arguments (#856 )
33
33
* Fix a bug where the original ` (var ...) ` form is not retained during analysis, causing it to be lost in calls to ` macroexpand ` (#888 )
34
+ * Fix issue with the reader var macro failing in syntax quote when unquoting a symbol, e.g. `(#'~ symbol) (#889 )
34
35
35
36
## [ v0.1.0b1]
36
37
### Added
Original file line number Diff line number Diff line change @@ -1527,7 +1527,11 @@ def _read_reader_macro(ctx: ReaderContext) -> LispReaderForm: # noqa: MC0001
1527
1527
return _read_namespaced_map (ctx )
1528
1528
elif token == "'" :
1529
1529
ctx .reader .advance ()
1530
- s = _read_sym (ctx )
1530
+ token_next = ctx .reader .peek ()
1531
+ if token_next == "~" :
1532
+ s = _read_unquote (ctx )
1533
+ else :
1534
+ s = _read_sym (ctx )
1531
1535
return llist .l (_VAR , s )
1532
1536
elif token == '"' :
1533
1537
return _read_regex (ctx )
Original file line number Diff line number Diff line change @@ -970,6 +970,30 @@ def complex_resolver(s: sym.Symbol) -> sym.Symbol:
970
970
),
971
971
) == read_str_first ("`(~'my-symbol)" ), "Do not resolve unquoted quoted syms"
972
972
973
+ assert llist .l (
974
+ reader ._SEQ ,
975
+ llist .l (
976
+ reader ._CONCAT ,
977
+ llist .l (
978
+ reader ._LIST ,
979
+ llist .l (
980
+ reader ._SEQ ,
981
+ llist .l (
982
+ reader ._CONCAT ,
983
+ llist .l (
984
+ reader ._LIST ,
985
+ llist .l (sym .symbol ("quote" ), sym .symbol ("var" )),
986
+ ),
987
+ llist .l (
988
+ reader ._LIST ,
989
+ llist .l (sym .symbol ("quote" ), sym .symbol ("a-symbol" )),
990
+ ),
991
+ ),
992
+ ),
993
+ ),
994
+ ),
995
+ ) == read_str_first ("`(#'~'a-symbol)" ), "Reader var macro works with unquote"
996
+
973
997
assert llist .l (sym .symbol ("quote" ), sym .symbol ("&" )) == read_str_first (
974
998
"`&"
975
999
), "do not resolve the not namespaced ampersand"
You can’t perform that action at this time.
0 commit comments