Hi dear devs,

I encountered some funny behaviour between compiled and interpreted
code with flet. I'm not sure if this is a duplicate bug?

-------- flet-bug.lisp --------------

(defun foo (x)
  (print x))

(defun test1 ()
  (flet ((foo1 ()
           (foo 3)))
    (foo1)))

(defun test2 ()
  (flet ((foo ()
           (foo 3)))
    (foo)))

------------------------------------

We compile the following file,

  (compile-file "c:/me/temp/flet-bug.lisp")
  ; Compiling C:/me/temp/flet-bug.lisp ...

  ; (DEFUN FOO ...)

  ; (DEFUN TEST1 ...)

  ; (DEFUN TEST2 ...)

  ; Wrote c:/me/temp/flet-bug.abcl (2.62 seconds)


Then either load it interpreted or compiled. Interpreted, everything's
fine:

  > (load "c:/me/temp/flet-bug.lisp")
  T
  > (test1)
  

  3 

  3
  > (test2)
  

  3 

  3

Compiled, we get an error in test2:

  > (load "c:/me/temp/flet-bug.abcl")
  T
  > (test1)
  

  3 

  3
  > (test2)
  ; Evaluation aborted on #<PROGRAM-ERROR {797E7B}>.


The stack trace for this is:

    Wrong number of arguments for #<FOO {CCA5B9}>.
       [Condition of type PROGRAM-ERROR]
    
    Restarts:
     0: [RETRY] Retry SLIME REPL evaluation request.
     1: [*ABORT] Return to SLIME's top level.
     2: [ABORT] Abort thread.
    
    Backtrace:
      0: (#<FUNCTION {490A12}> #<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>)
      1: (APPLY #<FUNCTION {490A12}> (#<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>))
      2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<PROGRAM-ERROR {19430CA}> #<FUNCTION {490A12}>)
      3: (INVOKE-DEBUGGER #<PROGRAM-ERROR {19430CA}>)
      4: org.armedbear.lisp.Lisp.error(Lisp.java:381)
      5: org.armedbear.lisp.Function.execute(Function.java:312)
      6: org.armedbear.lisp.Primitive.execute(Primitive.java:113)
      7: (FOO 3)
      8: (TEST2)
      9: (SYSTEM::%EVAL (TEST2))
     10: (EVAL (TEST2))
     11: (SWANK::EVAL-REGION "(test2)

         ")
     ... etc ...


Thanks for your attention,

Wei-Lun Chiu