Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eq in nested object causes crash in genicode #6072

Closed
scabug opened this issue Jul 12, 2012 · 5 comments
Closed

eq in nested object causes crash in genicode #6072

scabug opened this issue Jul 12, 2012 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 12, 2012

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)
@scabug
Copy link
Author

@scabug scabug commented Jul 12, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6072?orig=1
Reporter: @hubertp
Affected Versions: 2.10.0-M4, 2.10.0

Loading

@scabug
Copy link
Author

@scabug scabug commented Jul 16, 2012

@paulp said:
Finishing the gardening:

class A {
  object B { def eq(lvl: Int) = ??? }
}

Loading

@scabug
Copy link
Author

@scabug scabug commented Jul 16, 2012

Loading

@scabug
Copy link
Author

@scabug scabug commented Jul 17, 2012

@hubertp said:
Closed by #914

Loading

@scabug
Copy link
Author

@scabug scabug commented Jan 22, 2013

@adriaanm said:
reopening for 2.10.1-RC1 backport

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants