Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: Scala 2.10.1
    • Component/s: Specialization
    • Labels:
      None

      Description

      This example:

      import scala.{ specialized => spec }
       
      object Test {
        def blowup[@spec(Int) A](arr: Array[A]): Array[A] = {
          arr.length match {
            case 0 => arr
            case _ => arr
          }
        }
      }
      

      leads to the following:

      [info] Compiling 1 Scala source to /home/adam/code/SpecBug/target/scala-2.10/classes...
      [error] 
      [error]      while compiling: /home/adam/code/SpecBug/src/main/scala/Test2.scala
      [error]         during phase: specialize
      [error]      library version: version 2.10.0
      [error]     compiler version: version 2.10.0
      [error]   reconstructed args: -deprecation -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/adam/.sbt/0.12.2/boot/scala-2.10.0/lib/scala-library.jar -unchecked -d /home/adam/code/SpecBug/target/scala-2.10/classes -classpath /home/adam/code/SpecBug/target/scala-2.10/classes:/home/adam/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.0.jar
      [error] 
      [error]   last tree to typer: Ident(arr)
      [error]               symbol: value arr (flags: <param> <triedcooking>)
      [error]    symbol definition: arr: Array[A]
      [error]                  tpe: Array[A]
      [error]        symbol owners: value arr -> method blowup -> object Test -> package <empty>
      [error]       context owners: value x1 -> method blowup$mIc$sp -> object Test -> package <empty>
      [error] 
      [error] == Enclosing template or block ==
      [error] 
      [error] Block(
      [error]   ValDef( // case val x1: Int
      [error]     case <synthetic> <triedcooking>
      [error]     "x1"
      [error]     <tpt> // tree.tpe=Int
      [error]     Apply( // def length(): Int in class Array, tree.tpe=Int
      [error]       "arr"."length" // def length(): Int in class Array, tree.tpe=()Int
      [error]       Nil
      [error]     )
      [error]   )
      [error]   Match( // tree.tpe=Array[A]
      [error]     "x1" // case val x1: Int
      [error]     // 2 cases
      [error]     CaseDef( // tree.tpe=Array[A]
      [error]       1
      [error]       "arr" // arr: Array[Int], tree.tpe=Array[A]
      [error]     )
      [error]     CaseDef( // tree.tpe=Array[A]
      [error]       "_" // tree.tpe=Int
      [error]       "arr" // arr: Array[Int], tree.tpe=Array[A]
      [error]     )
      [error]   )
      [error] )
      [error] 
      [error] == Expanded type of tree ==
      [error] 
      [error] TypeRef(
      [error]   TypeSymbol(
      [error]     final class Array[T] extends Serializable with Cloneable
      [error]   )
      [error]   args = List(SkolemTypeRef(TypeSkolem(A)))
      [error] )
      [error] 
      [error] uncaught exception during compilation: java.lang.StackOverflowError
      [trace] Stack trace suppressed: run last compile:compile for the full output.
      [error] (compile:compile) java.lang.StackOverflowError
      [error] Total time: 1 s, completed Feb 25, 2013 6:41:01 PM
      

      Doesn't cause problems in 2.9.2

        Attachments

          Activity

            People

            • Assignee:
              ureche Vlad Ureche
              Reporter:
              aklein@novus.com Adam Klein
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: