Commit f4228b57 authored by Per Bothner's avatar Per Bothner

Minor fix, from Andra. Also added a testcase.

parent a8e678eb
......@@ -620,7 +620,8 @@ public class ANormalize extends ExpExpVisitor<ANormalize.Context> {
// optimization for non top-level 'define'
if (bin.getContext().currentLambda() != comp.currentModule()
&& bin.getInitValue() == QuoteExp.undefined_exp
&& nvals < 2) {
&& nvals < 2
&& exp.new_value.getClass() == LambdaExp.class) {
bin.setInitValue(exp.new_value);
bin.nvalues = 0;
bin.values = null;
......
......@@ -732,6 +732,7 @@ SCRIPTS_TO_RUN = case-warnings.scm uninit1.scm \
lib-square.scm lib-squaref.scm lib-impsrc1.scm lib-impsrc2.scm lib-dup.scm \
lib-colon1.scm lib-colon2.scm lib-export.scm lib-receive.scm \
macros1.scm macros2.scm exception1.scm exception2.scm \
continuations1.scm \
sva34005.scm sva35362.scm sva36039.scm sva36413.scm sva36556.scm \
sva36853.scm sva36863.scm sva36917.scm sva37684.scm sva38026.scm \
sva39060.scm sva39150.scm sva39945.scm sva39940.scm sva39947.scm \
......
......@@ -296,6 +296,7 @@ SCRIPTS_TO_RUN = case-warnings.scm uninit1.scm \
lib-square.scm lib-squaref.scm lib-impsrc1.scm lib-impsrc2.scm lib-dup.scm \
lib-colon1.scm lib-colon2.scm lib-export.scm lib-receive.scm \
macros1.scm macros2.scm exception1.scm exception2.scm \
continuations1.scm \
sva34005.scm sva35362.scm sva36039.scm sva36413.scm sva36556.scm \
sva36853.scm sva36863.scm sva36917.scm sva37684.scm sva38026.scm \
sva39060.scm sva39150.scm sva39945.scm sva39940.scm sva39947.scm \
......
;;; This doesn't actually test continuations, but it's a regression
;;; test for the anormalizer/code-fragmenter.
;; Kawa-options: --full-continuations %F
(define (f x)
(format #t "called f.~%")
(cons 'f x))
(define (g x)
(format #t "called g.~%")
(cons 'g x))
(define (h x)
(format #t "called h.~%")
(cons 'h x))
(define yglobal 100)
(define (ff x)
(! y1 (f x) )
(set! yglobal (g x))
(! y3 (h x))
(list y1 yglobal y3))
(format #t "(ff 3) => ~w~%" (ff 3))
;; Output: called f.
;; Output: called g.
;; Output: called h.
;; Output: (ff 3) => ((f . 3) (g . 3) (h . 3))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment