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

compiler crash involving default params and anonymous classes #5727

Closed
scabug opened this issue May 1, 2012 · 5 comments
Closed

compiler crash involving default params and anonymous classes #5727

scabug opened this issue May 1, 2012 · 5 comments

Comments

@scabug
Copy link

scabug commented May 1, 2012

There were a couple of bugs with similar error msgs, but I don't think this is a duplicate.

To reproduce (recent trunk, M3, 2.9.2):

object Test {

  trait SomeInfo
  case object NoInfo extends SomeInfo
  
  sealed abstract class Res[+T]
  case object NotRes extends Res[Nothing]


  abstract class Base[+T] {
    def apply(f: String): Res[T]
    // 'i' crashes the compiler, similarly if we use currying
    def |[U >: T](a: => Base[U], i: SomeInfo = NoInfo): Base[U] = null
  }

  implicit def fromStringToBase(a: String): Base[String] = new Base[String] { def apply(in: String) = NotRes }
  
  def Sample: Base[Any] = ( rep("foo" | "bar") | "sth")
   
  def rep[T](p: => Base[T]): Base[T] = null // whatever

}

Looks as if the problem is in lambdalift but I didn't really spend much time on it.
Crash:

error: symbol value qual$1$1 does not exist in Test.Sample
error: 
     while compiling:  crasher.scala
       current phase:  icode
     library version:  version 2.10.0-20120428-232041-e6d5d22d28
    compiler version:  version 2.10.0-20120428-232041-e6d5d22d28
  reconstructed args:  -d /tmp

uncaught exception during compilation: scala.reflect.internal.FatalError
error: scala.reflect.internal.FatalError: 
     while compiling:  crasher.scala
       current phase:  icode
     library version:  version 2.10.0-20120428-232041-e6d5d22d28
    compiler version:  version 2.10.0-20120428-232041-e6d5d22d28
  reconstructed args:  -d /tmp

symbol value qual$1$1 does not exist in Test.Sample
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45)
	at scala.tools.nsc.Global.abort(Global.scala:202)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.liftedTree2$1(GenICode.scala:998)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:992)
	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)
@scabug
Copy link
Author

scabug commented May 1, 2012

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

@scabug
Copy link
Author

scabug commented May 2, 2012

@lrytz said:
not a regression - fails the same way in 2.9

@scabug
Copy link
Author

scabug commented May 2, 2012

@som-snytt said:
FWIW, I'm looking at similar #5720, which seems to turn on interaction between the owner of synthetic symbols and lambda lifting. (I think that has been seen before.)

Stuff$1 added in typers is wrapped in anonfuns in uncurry; I think the stuff$ wants to be owned by the anonfun.

I added a small ChangeOwner at uncurry (in transformFunction where the body is made) which made both bug examples compile, but it isn't quite correct enough yet (for nested anonfuns, I think).

I could be off-base, since I only just learned how all the parts work -- lambda lifter, default args, etc, all interesting stuff$. Thanks to everyone: it reads like a good novel, with spell-binding plot twists.

@scabug
Copy link
Author

scabug commented May 2, 2012

@paulp said:

Thanks to everyone: it reads like a good novel, with spell-binding plot twists.

Chapter XXXI: LOST IN THE MOORS

@scabug
Copy link
Author

scabug commented May 5, 2012

@som-snytt said:
Duplicate of #5720.
Test included at
aabe71f989f023d64b6c52680485e4cacb4e88b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants