Uploaded image for project: 'Clojure'
  1. CLJ-667

Allow loops fully nested in catch/finally

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: Release 1.5
    • Labels:
      None
    • Approval:
      Ok
    • Patch:
      Code and Test

      Description

      ~/clj-git/clojure $ java -cp clojure.jar clojure.main
      Clojure 1.3.0-alpha2-SNAPSHOT
      user=> (try (catch Exception e (loop [x 0] (recur x))))
      CompilerException java.lang.UnsupportedOperationException: Cannot recur from catch/finally, compiling:(NO_SOURCE_PATH:1)
      user=> (try (finally (loop [x 0] (if false (recur x)))))
      CompilerException java.lang.UnsupportedOperationException: Cannot recur from catch/finally, compiling:(NO_SOURCE_PATH:2)

      With attached patch (should also fix CLJ-31 Closed ):

      ~/clj-head/clojure $ java -cp clojure.jar clojure.main
      Clojure 1.3.0-alpha2-SNAPSHOT
      user=> (try (catch Exception e (loop [x 0] (recur x))))
      nil
      user=> (try (finally (loop [x 0] (if false (recur x)))))
      nil
      user=> (loop [x 0] (try (if false (recur x))))
      CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:3)
      user=> (loop [x 0] (try (catch Exception e (recur x))))
      CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:4)
      user=> (loop [x 0] (try (finally (recur x))))
      CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:5)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jarpiain Juha Arpiainen
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: