Accuracy of procedure name in error messages

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Accuracy of procedure name in error messages

Alex-2
For what brought up this question, see:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2017-10/msg00261.html

The procedure that's named in error messages seems to be incorrect in
some cases, especially in bytecode.

For example, evaluate:

  (defun outer ()
    (inner))

  (defun inner ()
    (setq global (1+ nil)))

With eval-expression-debug-on-error non-nil, evaluate (outer). The
debugger pops up with "1+(nil)" at the top, but the error message
displayed after continuing is:

setq: Wrong type argument: number-or-marker-p, nil

Shouldn't it say "1+: Wrong type..."?

Now if you byte-compile `outer' and `inner' and evaluate (outer), then
the debugger pops up with "inner()" at the top. The error message
displayed after continuing is:

outer: Wrong type argument: number-or-marker-p, nil

So it seems that the error message is created one frame off, and the
bytecode versions ignore primitives like `setq' and `1+'.

Is this a known limitation, and/or should I file a bug report?