Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0, Scala 2.10.1
    • Fix Version/s: Scala 2.10.2-RC1
    • Component/s: None
    • Environment:

      Windows

      Description

      scala: duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011.
      scala: uncaught exception during compilation: scala.reflect.internal.FatalError
      scala: Error:
      while compiling: M:\projects\weltkante\proto\lang\src\weltkante\scanner\Token.scala
      during phase: jvm
      library version: version 2.10.1
      compiler version: version 2.10.1
      reconstructed args: -classpath M:\projects\weltkante\proto\lang\out\production\lang -bootclasspath C:\dev\jdk6-32bit\jre\lib\resources.jar;C:\dev\jdk6-32bit\jre\lib\rt.jar;C:\dev\jdk6-32bit\jre\lib\sunrsasign.jar;C:\dev\jdk6-32bit\jre\lib\jsse.jar;C:\dev\jdk6-32bit\jre\lib\jce.jar;C:\dev\jdk6-32bit\jre\lib\charsets.jar;C:\dev\jdk6-32bit\jre\lib\modules\jdk.boot.jar;C:\dev\jdk6-32bit\jre\classes;C:\dev\scala\lib\scala-library.jar
      last tree to typer: Literal(Constant(weltkante.scanner.TSymbol))
      symbol: null
      symbol definition: null
      tpe: Class(classOf[weltkante.scanner.TSymbol])
      symbol owners:
      context owners: anonymous class anonfun$22 -> package scanner
      == Enclosing template or block ==
      Template( // val <local $anonfun>: <notype>, tree.tpe=weltkante.scanner.anonfun$22
      "scala.runtime.AbstractFunction0", "scala.Serializable" // parents
      ValDef(
      private
      "_"
      <tpt>
      <empty>
      )
      // 3 statements
      DefDef( // final def apply(): weltkante.scanner.TComment
      <method> final <triedcooking>
      "apply"
      []
      List(Nil)
      <tpt> // tree.tpe=weltkante.scanner.TComment
      Apply( // def <init>(): weltkante.scanner.TComment in class TComment, tree.tpe=weltkante.scanner.TComment
      new weltkante.scanner.TComment."<init>" // def <init>(): weltkante.scanner.TComment in class TComment, tree.tpe=()weltkante.scanner.TComment
      Nil
      )
      )
      DefDef( // final def apply(): Object
      <method> final <bridge>
      "apply"
      []
      List(Nil)
      <tpt> // tree.tpe=Object
      Apply( // final def apply(): weltkante.scanner.TComment, tree.tpe=weltkante.scanner.TComment
      STokenFactories$$anonfun$22.this."apply" // final def apply(): weltkante.scanner.TComment, tree.tpe=()weltkante.scanner.TComment
      Nil
      )
      )
      DefDef( // def <init>(): weltkante.scanner.anonfun$22
      <method> <triedcooking>
      "<init>"
      []
      List(Nil)
      <tpt> // tree.tpe=weltkante.scanner.anonfun$22
      Block( // tree.tpe=Unit
      Apply( // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=scala.runtime.AbstractFunction0
      STokenFactories$$anonfun$22.super."<init>" // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=()scala.runtime.AbstractFunction0
      Nil
      )
      ()
      )
      )
      )
      == Expanded type of tree ==
      ConstantType(value = Constant(weltkante.scanner.TSymbol))
      duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011.
      scala.reflect.internal.FatalError:
      while compiling: M:\projects\weltkante\proto\lang\src\weltkante\scanner\Token.scala
      during phase: jvm
      library version: version 2.10.1
      compiler version: version 2.10.1
      reconstructed args: -classpath M:\projects\weltkante\proto\lang\out\production\lang -bootclasspath C:\dev\jdk6-32bit\jre\lib\resources.jar;C:\dev\jdk6-32bit\jre\lib\rt.jar;C:\dev\jdk6-32bit\jre\lib\sunrsasign.jar;C:\dev\jdk6-32bit\jre\lib\jsse.jar;C:\dev\jdk6-32bit\jre\lib\jce.jar;C:\dev\jdk6-32bit\jre\lib\charsets.jar;C:\dev\jdk6-32bit\jre\lib\modules\jdk.boot.jar;C:\dev\jdk6-32bit\jre\classes;C:\dev\scala\lib\scala-library.jar

      last tree to typer: Literal(Constant(weltkante.scanner.TSymbol))
      symbol: null
      symbol definition: null
      tpe: Class(classOf[weltkante.scanner.TSymbol])
      symbol owners:
      context owners: anonymous class anonfun$22 -> package scanner

      == Enclosing template or block ==

      Template( // val <local $anonfun>: <notype>, tree.tpe=weltkante.scanner.anonfun$22

      "scala.runtime.AbstractFunction0", "scala.Serializable" // parents

      ValDef(

      private

      "_"

      <tpt>

      <empty>

      )

      // 3 statements

      DefDef( // final def apply(): weltkante.scanner.TComment

      <method> final <triedcooking>

      "apply"

      []

      List(Nil)

      <tpt> // tree.tpe=weltkante.scanner.TComment

      Apply( // def <init>(): weltkante.scanner.TComment in class TComment, tree.tpe=weltkante.scanner.TComment

      new weltkante.scanner.TComment."<init>" // def <init>(): weltkante.scanner.TComment in class TComment, tree.tpe=()weltkante.scanner.TComment

      Nil

      )

      )

      DefDef( // final def apply(): Object

      <method> final <bridge>

      "apply"

      []

      List(Nil)

      <tpt> // tree.tpe=Object

      Apply( // final def apply(): weltkante.scanner.TComment, tree.tpe=weltkante.scanner.TComment

      STokenFactories$$anonfun$22.this."apply" // final def apply(): weltkante.scanner.TComment, tree.tpe=()weltkante.scanner.TComment

      Nil

      )

      )

      DefDef( // def <init>(): weltkante.scanner.anonfun$22

      <method> <triedcooking>

      "<init>"

      []

      List(Nil)

      <tpt> // tree.tpe=weltkante.scanner.anonfun$22

      Block( // tree.tpe=Unit

      Apply( // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=scala.runtime.AbstractFunction0

      STokenFactories$$anonfun$22.super."<init>" // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=()scala.runtime.AbstractFunction0

      Nil

      )

      ()

      )

      )

      )

      == Expanded type of tree ==

      ConstantType(value = Constant(weltkante.scanner.TSymbol))

      duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011.

      at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49)

      at scala.tools.nsc.Global.abort(Global.scala:253)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$jcode$.emitSWITCH(GenASM.scala:1849)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genJumpInstr$1(GenASM.scala:2515)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.scala$tools$nsc$backend$jvm$GenASM$JPlainBuilder$$genInstr$1(GenASM.scala:2618)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genBlock$1$2.apply(GenASM.scala:2326)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genBlock$1$2.apply(GenASM.scala:2312)

      at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)

      at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:105)

      at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.foreach(BasicBlocks.scala:197)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genBlock$1(GenASM.scala:2312)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genBlocks$1(GenASM.scala:2244)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genCode(GenASM.scala:2856)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1563)

      at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398)

      at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)

      at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582)

      at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556)

      at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552)

      at scala.tools.nsc.Global$Run.compile(Global.scala:1661)

      at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)

      at xsbt.CachedCompiler0.run(CompilerInterface.scala:89)

      at xsbt.CompilerInterface.run(CompilerInterface.scala:27)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:74)

      at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:36)

      at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:30)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1$$anonfun$apply$3$$anonfun$apply$1.apply$mcV$sp(AggressiveCompile.scala:77)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1$$anonfun$apply$3$$anonfun$apply$1.apply(AggressiveCompile.scala:77)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1$$anonfun$apply$3$$anonfun$apply$1.apply(AggressiveCompile.scala:77)

      at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:135)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1$$anonfun$apply$3.apply(AggressiveCompile.scala:76)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1$$anonfun$apply$3.apply(AggressiveCompile.scala:73)

      at scala.Option.foreach(Option.scala:236)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:73)

      at sbt.compiler.AggressiveCompile$$anonfun$8$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:73)

      at scala.Option.foreach(Option.scala:236)

      at sbt.compiler.AggressiveCompile$$anonfun$8.compileScala$1(AggressiveCompile.scala:73)

      at sbt.compiler.AggressiveCompile$$anonfun$8.apply(AggressiveCompile.scala:118)

      at sbt.compiler.AggressiveCompile$$anonfun$8.apply(AggressiveCompile.scala:61)

      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)

      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)

      at sbt.inc.Incremental$.cycle(Incremental.scala:46)

      at sbt.inc.Incremental$.compile(Incremental.scala:29)

      at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)

      at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:126)

      at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)

      at org.jetbrains.jps.incremental.scala.local.CompilerImpl.compile(CompilerImpl.scala:66)

      at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:23)

      at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:31)

      at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at com.martiansoftware.nailgun.NGSession.run(Unknown Source)

        Activity

        Hide
        Tobias added a comment - - edited

        The code in question compiled well in 2.9.1, after updating to 2.10.1 the compiler now fails with an uncaught exception.

        Token.scala does not contain any switch, so no idea what it is complaining about.

        The issue SI-6011 mentioned in the message claims that was something fixed in 2.10.0-M5 so I assume it appearing in 2.10.1 is something not covered by the fixed SI-6011

        Show
        Tobias added a comment - - edited The code in question compiled well in 2.9.1, after updating to 2.10.1 the compiler now fails with an uncaught exception. Token.scala does not contain any switch, so no idea what it is complaining about. The issue SI-6011 mentioned in the message claims that was something fixed in 2.10.0-M5 so I assume it appearing in 2.10.1 is something not covered by the fixed SI-6011
        Hide
        Miguel Garcia added a comment -

        Please attach Token.scala to this ticket, or ideally a minimized version of it that still triggers the bug.

        Show
        Miguel Garcia added a comment - Please attach Token.scala to this ticket, or ideally a minimized version of it that still triggers the bug.
        Hide
        Tobias added a comment -

        I've attached a subset of the source which still has the error. Even though the error message talks about Token.scala, if I just compile Token.scala without having Scanner.scala no error occurs (maybe dead code removal? or the error is really in Scanner.scala and the message is broken?)

        Show
        Tobias added a comment - I've attached a subset of the source which still has the error. Even though the error message talks about Token.scala, if I just compile Token.scala without having Scanner.scala no error occurs (maybe dead code removal? or the error is really in Scanner.scala and the message is broken?)
        Hide
        Jason Zaugg added a comment - - edited

        Yes, the error reporting is pointing to the wrong file.

        The line of code that triggers the problem:

        case '!' | '%' | '&' | '\'' | '*' | '+' | ',' | '.' | '/' | '|' | ';' |
                   '=' | '?' | '@' | '\\' | '^' | '`' | '|' | '~' | ':' => pushToken[TSymbol]
        

        Note that '|' is duplicated.

        Here's a minimal test case:

        def foo(a: Char) = a match { case 'b' => 0 case 'a' | 'a' => 0 }
        duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011: 97, 97, 98
        	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49)
        

        By contrast, the redundant cases are collapsed here:

        scala> def foo(a: Char) = a match { case 'b' => 0 case 'b' => 0 }
        <console>:7: warning: unreachable code
               def foo(a: Char) = a match { case 'b' => 0 case 'b' => 0 }
                                                                      ^
        
        Show
        Jason Zaugg added a comment - - edited Yes, the error reporting is pointing to the wrong file. The line of code that triggers the problem: case '!' | '%' | '&' | '\'' | '*' | '+' | ',' | '.' | '/' | '|' | ';' | '=' | '?' | '@' | '\\' | '^' | '`' | '|' | '~' | ':' => pushToken[TSymbol] Note that '|' is duplicated. Here's a minimal test case: def foo(a: Char) = a match { case 'b' => 0 case 'a' | 'a' => 0 } duplicate keys in SWITCH, can't pick arbitrarily one of them to evict, see SI-6011: 97, 97, 98 at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49) By contrast, the redundant cases are collapsed here: scala> def foo(a: Char) = a match { case 'b' => 0 case 'b' => 0 } <console>:7: warning: unreachable code def foo(a: Char) = a match { case 'b' => 0 case 'b' => 0 } ^
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/2291

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Tobias
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development