peval: Handle optional argument inits that refer to previous arguments.
authorMark H Weaver <mhw@netris.org>
Sun, 28 Sep 2014 16:51:11 +0000 (12:51 -0400)
committerMark H Weaver <mhw@netris.org>
Mon, 29 Sep 2014 03:51:20 +0000 (23:51 -0400)
commit7a71a45cfd6092402d540e9bc5d2432941a8a336
treed2928613b8ed1f48ad293fba13c340d860bfc9e8
parentff4af3df238815e434b62693a3c02b8213667ebe
peval: Handle optional argument inits that refer to previous arguments.

Fixes <http://bugs.gnu.org/17634>.
Reported by Josep Portella Florit <jpf@primfilat.com>.

* module/language/tree-il/peval.scm (inlined-application): When inlining
  an application whose operator is a lambda expression with optional
  arguments that rely on default initializers, expand into a series of
  nested let expressions, to ensure that previous arguments are in scope
  when the default initializers are evaluated.

* test-suite/tests/peval.test ("partial evaluation"): Add tests.
module/language/tree-il/peval.scm
test-suite/tests/peval.test