Subject: bug#42757: calling internal define with incorrect n(args) gives invalid error

From: Christopher Lam <[email-masked]>
Date: Sat, 8 Aug 2020 06:58:53 +0000

Using guile 3.0.1 (also tested with 3.0.4)

Consider following snippet
------
(define (outer-function)
  (define (inner-function q w e r t y)  ;takes 6 args
    #f)
  (inner-function 'a 'b 'c 'd 'e))     ;send 5 args
(outer-function)
------

The internally defined function is called with insufficient args. We'd
expect error to be
"Wrong number of arguments to inner-function"

Instead the error is
"Wrong number of arguments to a"

Note if the invalid code is not internally-defined, the error is correct:
"Wrong number of arguments to #<procedure inner-function (q w e r t y)>"