Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: Scala 2.10.0-M3, Scala 2.10.0
    • Component/s: Pattern Matcher
    • Labels:
      None
    • Environment:

      Scala version 2.10.0-M1 (Java HotSpot(TM) Client VM, Java 1.6.0_25). Win32. 32 bit JDK.

      Description

      The following tail recursive function is not optimized when using -Yvirtpatmat

      def f[T](l: List[T]): Int = l match { case x :: xs => f(xs) case Nil => 0 }
      f(List.fill(10000)(0))
      

      will cause a stack overflow.

      Also when using @annotation.tailrec the compiler will report that f contains a call not in tail position.

        Attachments

          Activity

            People

            • Assignee:
              moors Adriaan Moors
              Reporter:
              huynhjl huynhjl
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: