obriencj / python-sibilant

A dialect of Lisp compiling to Python bytecode
GNU Lesser General Public License v3.0
7 stars 1 forks source link

Cryptic error message on bare unquoted cons #211

Closed ahills closed 5 years ago

ahills commented 5 years ago

I'm not sure exactly how to describe this problem, except that when I was trying to write:

sibilant > '(1 . 2)
(1 . 2)

I accidentally omitted the quote, and experienced:

sibilant > (1 . 2)
** WUT <sibilant.compiler.targets.cpython37.SibilantCPython37 object at 0x7fa1541b5dd8> (1 . 2) True <trampoline for <bound method SibilantCompiler._compile_cont of <sibilant.compiler.targets.cpython37.SibilantCPython37 object at 0x7fa1541b5dd8>>>
Traceback (most recent call last):
  File "…/python-sibilant/sibilant/module.py", line 388, in load_module_1
    code_obj = compile_time(module, source_expr)
  File "…/python-sibilant/sibilant/module.py", line 269, in compile_time
    compiler.add_expression_with_return(source_expr)
  File "…/python-sibilant/sibilant/compiler/__init__.py", line 837, in add_expression_with_return
    self.compile(expr, True, None)
  File "…/python-sibilant/sibilant/compiler/__init__.py", line 469, in compile_pair
    raise self._err(msg, source_obj)
AttributeError: 'SibilantCPython37' object has no attribute '_err'

I'm not sure how to express why (1 . 2) is invalid, so I don't have any good suggestions for an error message.

obriencj commented 5 years ago

looks like an exception from an exception in this case -- real error got eaten by that faulty _err

obriencj commented 5 years ago

self._err should have been self.error

I'm surprised that flake didn't notice that.

The WUT is a leftover debugging print that I should probably comment out!

obriencj commented 5 years ago
sibilant > (print . 100)
  File "<stdin>", line 1
    (print . 100)
                ^
sibilant.compiler.CompilerSyntaxError: cannot evaluate improper lists as expressions