Fix infinite loop for 'leaves' in IndexedList

diff --git a/ChangeLog b/ChangeLog
index 1cf555d3..3aae476b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-19  Qian Yun  <oldk1...@gmail.com>
+
+       * src/algebra/list.spad: Fix infinite loop for 'leaves'
+       in IndexedList
+
  2018-11-18  Qian Yun  <oldk1...@gmail.com>

         * src/algebra/aggcat.spad, src/algebra/stream.spad:
diff --git a/src/algebra/list.spad b/src/algebra/list.spad
index c6953ed5..7e10689d 100644
--- a/src/algebra/list.spad
+++ b/src/algebra/list.spad
@@ -91,7 +91,7 @@
         empty? x => Qempty
         for i in 0.. while not Qempty? x repeat
             Qeq(i, cycleMax) and cyclic? x => error "cyclic list"
-           leaf? x => [value x]
+           leaf? x => return [value x]
             x := Qrest x

     if S has CoercibleTo(OutputForm) then
diff --git a/src/input/bugs2018.input b/src/input/bugs2018.input
index d84938b9..a5b88524 100644
--- a/src/input/bugs2018.input
+++ b/src/input/bugs2018.input
@@ -205,4 +205,8 @@

  testTrue("empty? children([1]@Stream Integer)")

+testcase "fix infinite loop for 'leaves' in List"
+
+testEquals("leaves [1]", "[1]")
+
  statistics()

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to