sasagawa888 / eisl

ISLisp interpreter/compiler
Other
275 stars 23 forks source link

Incorrect behavior when combining unwind-protect and with-handler #270

Closed gtnoble closed 1 year ago

gtnoble commented 1 year ago

https://github.com/sasagawa888/eisl/blob/b89f39d4d3996013301eef72dc647c126ac0bdac/tests/bug.lsp#L70-L75

(defun foo-unwind ()
  (unwind-protect (foo)
    (print "cleanup")))

Using the interpreter, this is the current output:

> (foo)
"inner handler continued"
"inner handler continued"
"outer handler continued"
NIL
> (foo-unwind)
"outer handler continued"
"outer handler continued"
"outer handler continued"
"cleanup"
NIL

The correct output for foo-unwind should be:

"inner handler continued"
"inner handler continued"
"outer handler continued"
"cleanup"
gtnoble commented 1 year ago

This appears to work properly now.