Scala Programming Language
  1. Scala Programming Language
  2. SI-6072

eq in nested object causes crash in genicode

    Details

      Description

      import scala.util.parsing.combinator.syntactical.StandardTokenParsers
      
      trait A {
        object B {
          def eq(lvl: Int): Boolean = true
        }
      }
      
      object C extends StandardTokenParsers with A
      

      It still contains StandardTokenParsers as a dependency but I don't have energy to go further - already wasted a lot of time reducing it from some weird and convoluted scala library crash, believe me.

      Crash:

      error: 
           while compiling: parsersCrash.scala
              during phase: icode
           library version: version 2.10.0-M4
          compiler version: version 2.10.0-M4
        reconstructed args: 
      
        last tree to typer: term B$module
                    symbol: variable A$$B$module in object A$class (flags: <mutable> <synthetic> <modulevar> <expandedname> <notprivate>)
         symbol definition: var A$$B$module: ...
                       tpe: <notype>
             symbol owners: variable A$$B$module -> object A$class -> package <empty>
            context owners: object A$B -> package <empty>
      
      == Enclosing template or block ==
      
      Template( // val <local B>: <notype> in object A$B, tree.tpe=...
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def eq(lvl: Int): Boolean in object A$B
          <method>
          "eq"
          []
          // 1 parameter list
          ValDef( // lvl: Int
            <param>
            "lvl"
            <tpt> // tree.tpe=Int
            <empty>
          )
          <tpt> // tree.tpe=Boolean
          true
        )
        DefDef( // def <init>(arg$outer: A): ... in object A$B
          <method> <triedcooking>
          "<init>"
          []
          // 1 parameter list
          ValDef( // $outer: A
            <param>
            "$outer"
            <tpt> // tree.tpe=A
            <empty>
          )
          <tpt> // tree.tpe=...
          Block( // tree.tpe=Unit
            Apply( // def <init>(): Object in class Object, tree.tpe=Object
              A$B.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
              Nil
            )
            ()
          )
        )
      )
      
      == Expanded type of tree ==
      
      <notype>
      
      uncaught exception during compilation: java.lang.AssertionError
      error: java.lang.AssertionError: assertion failed: 
           while compiling: parsersCrash.scala
              during phase: icode
           library version: version 2.10.0-M4
          compiler version: version 2.10.0-M4
        reconstructed args: 
      
        last tree to typer: term B$module
                    symbol: variable A$$B$module in object A$class (flags: <mutable> <synthetic> <modulevar> <expandedname> <notprivate>)
         symbol definition: var A$$B$module: ...
                       tpe: <notype>
             symbol owners: variable A$$B$module -> object A$class -> package <empty>
            context owners: object A$B -> package <empty>
      
      == Enclosing template or block ==
      
      Template( // val <local B>: <notype> in object A$B, tree.tpe=...
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def eq(lvl: Int): Boolean in object A$B
          <method>
          "eq"
          []
          // 1 parameter list
          ValDef( // lvl: Int
            <param>
            "lvl"
            <tpt> // tree.tpe=Int
            <empty>
          )
          <tpt> // tree.tpe=Boolean
          true
        )
        DefDef( // def <init>(arg$outer: A): ... in object A$B
          <method> <triedcooking>
          "<init>"
          []
          // 1 parameter list
          ValDef( // $outer: A
            <param>
            "$outer"
            <tpt> // tree.tpe=A
            <empty>
          )
          <tpt> // tree.tpe=...
          Block( // tree.tpe=Unit
            Apply( // def <init>(): Object in class Object, tree.tpe=Object
              A$B.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
              Nil
            )
            ()
          )
        )
      )
      
      == Expanded type of tree ==
      
      <notype>
      
      type error: can't convert from REF(class Null) to INT in unit parsersCrash.scala at source-/home/hubert/tmp/toremove/parsersCrash.scala,line-12,offset=158
      	at scala.Predef$.assert(Predef.scala:162)
      	at scala.tools.nsc.Global.assert(Global.scala:235)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.adapt(GenICode.scala:1125)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1111)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1201)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1199)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadArguments(GenICode.scala:1199)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:905)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.default$2(GenICode.scala:1478)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genCond(GenICode.scala:1521)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadIf(GenICode.scala:358)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:651)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genSynchronized$2.apply(GenICode.scala:324)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genSynchronized$2.apply(GenICode.scala:323)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$Context.Try(GenICode.scala:2119)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genSynchronized(GenICode.scala:322)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genPrimitiveOp(GenICode.scala:453)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:884)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:116)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      	at scala.collection.immutable.List.foreach(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:141)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:91)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      	at scala.collection.immutable.List.foreach(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:82)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:68)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:64)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:459)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:426)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:426)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:724)
      	at scala.collection.AbstractIterator.foreach(Iterator.scala:1152)
      	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:426)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:57)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
      	at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
      	at scala.tools.nsc.Main$.doCompile(Main.scala:81)
      	at scala.tools.nsc.Driver.process(Driver.scala:52)
      	at scala.tools.nsc.Driver.main(Driver.scala:65)
      	at scala.tools.nsc.Main.main(Main.scala)
      
      Exception in thread "main" java.lang.AssertionError: assertion failed: 
           while compiling: parsersCrash.scala
              during phase: icode
           library version: version 2.10.0-M4
          compiler version: version 2.10.0-M4
        reconstructed args: 
      
        last tree to typer: term B$module
                    symbol: variable A$$B$module in object A$class (flags: <mutable> <synthetic> <modulevar> <expandedname> <notprivate>)
         symbol definition: var A$$B$module: ...
                       tpe: <notype>
             symbol owners: variable A$$B$module -> object A$class -> package <empty>
            context owners: object A$B -> package <empty>
      
      == Enclosing template or block ==
      
      Template( // val <local B>: <notype> in object A$B, tree.tpe=...
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def eq(lvl: Int): Boolean in object A$B
          <method>
          "eq"
          []
          // 1 parameter list
          ValDef( // lvl: Int
            <param>
            "lvl"
            <tpt> // tree.tpe=Int
            <empty>
          )
          <tpt> // tree.tpe=Boolean
          true
        )
        DefDef( // def <init>(arg$outer: A): ... in object A$B
          <method> <triedcooking>
          "<init>"
          []
          // 1 parameter list
          ValDef( // $outer: A
            <param>
            "$outer"
            <tpt> // tree.tpe=A
            <empty>
          )
          <tpt> // tree.tpe=...
          Block( // tree.tpe=Unit
            Apply( // def <init>(): Object in class Object, tree.tpe=Object
              A$B.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
              Nil
            )
            ()
          )
        )
      )
      
      == Expanded type of tree ==
      
      <notype>
      
      type error: can't convert from REF(class Null) to INT in unit parsersCrash.scala at source-/home/hubert/tmp/toremove/parsersCrash.scala,line-12,offset=158
      	at scala.Predef$.assert(Predef.scala:162)
      	at scala.tools.nsc.Global.assert(Global.scala:235)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.adapt(GenICode.scala:1125)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1111)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1201)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1199)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadArguments(GenICode.scala:1199)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:905)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.default$2(GenICode.scala:1478)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genCond(GenICode.scala:1521)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadIf(GenICode.scala:358)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:651)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genSynchronized$2.apply(GenICode.scala:324)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genSynchronized$2.apply(GenICode.scala:323)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$Context.Try(GenICode.scala:2119)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genSynchronized(GenICode.scala:322)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genPrimitiveOp(GenICode.scala:453)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:884)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:179)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:148)
      	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
      	at scala.collection.immutable.List.foldLeft(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:148)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1023)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:116)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      	at scala.collection.immutable.List.foreach(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:141)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:91)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:72)
      	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      	at scala.collection.immutable.List.foreach(List.scala:77)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:72)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:82)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:68)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:64)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:459)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:426)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:426)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:724)
      	at scala.collection.AbstractIterator.foreach(Iterator.scala:1152)
      	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:426)
      	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:57)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
      	at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
      	at scala.tools.nsc.Main$.doCompile(Main.scala:81)
      	at scala.tools.nsc.Driver.process(Driver.scala:52)
      	at scala.tools.nsc.Driver.main(Driver.scala:65)
      	at scala.tools.nsc.Main.main(Main.scala)
      

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          Finishing the gardening:

          class A {
            object B { def eq(lvl: Int) = ??? }
          }
          
          Show
          Paul Phillips added a comment - Finishing the gardening: class A { object B { def eq(lvl: Int) = ??? } }
          Show
          Paul Phillips added a comment - https://github.com/scala/scala/pull/914
          Hide
          Hubert Plociniczak added a comment -

          Closed by #914

          Show
          Hubert Plociniczak added a comment - Closed by #914
          Hide
          Adriaan Moors added a comment -

          reopening for 2.10.1-RC1 backport

          Show
          Adriaan Moors added a comment - reopening for 2.10.1-RC1 backport

            People

            • Assignee:
              Paul Phillips
              Reporter:
              Hubert Plociniczak
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development