summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2015-08-04 04:01:50 +0000
committerPer Bothner <per@bothner.com>2015-08-04 04:01:50 +0000
commitf4228b57936de5a84dba0afcfac54196bec86fa4 (patch)
treefd501c5565ea2594de0f87f38a9745ba22255967
parenta8e678ebf7216e9fad9238e0b1c2442ea371c63c (diff)
Minor fix, from Andra. Also added a testcase.callcc
-rw-r--r--gnu/expr/ANormalize.java3
-rw-r--r--testsuite/Makefile.am3
-rw-r--r--testsuite/Makefile.in3
-rw-r--r--testsuite/continuations1.scm25
4 files changed, 31 insertions, 3 deletions
diff --git a/gnu/expr/ANormalize.java b/gnu/expr/ANormalize.java
index f4d04649d..c2108c75c 100644
--- a/gnu/expr/ANormalize.java
+++ b/gnu/expr/ANormalize.java
@@ -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;
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index ca76b914b..0e661ae39 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -731,7 +731,8 @@ SCRIPTS_TO_RUN = case-warnings.scm uninit1.scm \
command1.scm command2.scm command3.scm exit1.scm exit2.scm lib-cycle.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 \
+ 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 \
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 48128dea5..65e67c66c 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -295,7 +295,8 @@ SCRIPTS_TO_RUN = case-warnings.scm uninit1.scm \
command1.scm command2.scm command3.scm exit1.scm exit2.scm lib-cycle.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 \
+ 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 \
diff --git a/testsuite/continuations1.scm b/testsuite/continuations1.scm
new file mode 100644
index 000000000..5ef41ea67
--- /dev/null
+++ b/testsuite/continuations1.scm
@@ -0,0 +1,25 @@
+;;; 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))