Merge pull request #1579 from vodik/splicing-typo
Fix a bug where the compiler doesn't properly handle unquote-splice
This commit is contained in:
commit
bb10921ace
1
NEWS.rst
1
NEWS.rst
@ -51,6 +51,7 @@ Bug Fixes
|
||||
* Fixed a REPL crash caused by illegle unicode escape string inputs
|
||||
* `NaN` can no longer create an infinite loop during macro-expansion
|
||||
* Fixed a bug that caused `try` to drop expressions
|
||||
* Fixed a bug where the compiler didn't properly compile `unquote-splice`
|
||||
|
||||
Misc. Improvements
|
||||
----------------------------
|
||||
|
@ -723,7 +723,7 @@ class HyASTCompiler(object):
|
||||
ret.add_imports("hy", imports)
|
||||
return ret
|
||||
|
||||
@builds("unquote", "unquote-splicing")
|
||||
@builds("unquote", "unquote-splice")
|
||||
def compile_unquote(self, expr):
|
||||
raise HyTypeError(expr,
|
||||
"`%s' can't be used at the top-level" % expr[0])
|
||||
|
@ -588,6 +588,16 @@ def test_setv_builtins():
|
||||
""")
|
||||
|
||||
|
||||
def test_top_level_unquote():
|
||||
with pytest.raises(HyTypeError) as excinfo:
|
||||
can_compile("(unquote)")
|
||||
assert excinfo.value.message == "`unquote' can't be used at the top-level"
|
||||
|
||||
with pytest.raises(HyTypeError) as excinfo:
|
||||
can_compile("(unquote-splice)")
|
||||
assert excinfo.value.message == "`unquote-splice' can't be used at the top-level"
|
||||
|
||||
|
||||
def test_lots_of_comment_lines():
|
||||
# https://github.com/hylang/hy/issues/1313
|
||||
can_compile(1000 * ";\n")
|
||||
|
Loading…
Reference in New Issue
Block a user