Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Lambda inlining pass produces wrong result when a free variable is rebound in context of a function call. #163

Closed Idorobots closed 2 years ago

Idorobots commented 2 years ago

The following code produces 10 as the result instead of 28:

(let ((x 23))
  (let ((foo (lambda ()
               x))
        (x 5))
    (+ x (foo))))
Idorobots commented 2 years ago

This one is related to https://github.com/Idorobots/spartan/issues/143 and can be solved the same way, by https://github.com/Idorobots/spartan/issues/48