inline4.scm 872 B

123456789101112131415161718192021222324
  1. ;; This used to fail because g would get inlined into f, and h into g.
  2. ;; Then we set up the local-variable and stack-map attributes so that x2
  3. ;; is defined (and has type int) in h (because the inlining causes it
  4. ;; to be logically nested in g). However, x2 is never set if we call h
  5. ;; directly from f, so we get a conflict.
  6. ;; This fix was to defer te inlining, rather than doing it in-place.
  7. (format #t "r:~w~%"
  8. (letrec ((f (lambda (x1::int)
  9. (if (eqv? x1 1)
  10. (g x1)
  11. (h x1))))
  12. (g (lambda (x2::int)
  13. (h x2)))
  14. (h (lambda (x3::int)
  15. (case x3
  16. ((0) (h x3))
  17. ((2) x3)
  18. (else 123)
  19. )
  20. )))
  21. (f 45)))
  22. ;; Output: r:123