hylang / hy

A dialect of Lisp that's embedded in Python
http://hylang.org
Other
5.13k stars 373 forks source link

bad macro causes repl to exit. #1757

Closed andrewchambers closed 4 years ago

andrewchambers commented 5 years ago
$ hy 
=> #@()
Traceback (most recent call last):
  File "/home/ac/src/test/venv/bin/hy", line 11, in <module>
    sys.exit(hy_main())
  File "/nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/code.py", line 232, in interact
    more = self.push(line)
  File "/nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/code.py", line 258, in push
    more = self.runsource(source, self.filename)
  File "/nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/code.py", line 63, in runsource
    code = self.compile(source, filename, symbol)
  File "/nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/codeop.py", line 168, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/core/macros.hy", line 244, in hyx_Xnumber_signXXcommercial_atX
    fndef (get expr -1))
hy.errors.HyCompileError: Internal Compiler Bug 😱
⤷ Traceback (most recent call last):
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/compiler.py", line 438, in compile
    ret = self.compile_atom(tree)
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/compiler.py", line 432, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/compiler.py", line 1703, in compile_expression
    self, expr, unmangle(sroot), *parse_tree)
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/compiler.py", line 1628, in compile_dispatch_tag_macro
    self.module))
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/macros.py", line 381, in tag_macroexpand
    expr = tag_macro(tree)
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/core/macros.hy", line 244, in hyx_Xnumber_signXXcommercial_atX
    fndef (get expr -1))
  File "/home/ac/src/test/venv/lib/python3.7/site-packages/hy/models.py", line 263, in __getitem__
    ret = super(HySequence, self).__getitem__(item)
IndexError: list index out of range

(venv) 
[ac@black:~/src/test]$
Kodiologist commented 5 years ago

I'm reopening this on the suspicion that we still have the more general problem of (some kinds of) errors during macro expansion causing the REPL to quit.

Kodiologist commented 4 years ago

At least as of this point, I can't replicate such a problem.