twitter/rsc

Crash on structural type with a method declaration with generic parameters

wiwa opened this issue · 1 comments

wiwa commented
object O {
  def foo: { def bar[A](a: A) } = ???
}
O.scala:2: error: local2
object O {
^
rsc.util.CrashException: local2
	at rsc.util.CrashUtil$class.crash(CrashUtil.scala:10)
	at rsc.util.package$.crash(package.scala:5)
	at rsc.util.CrashUtil$class.crash(CrashUtil.scala:18)
	at rsc.util.package$.crash(package.scala:5)
	at rsc.scalasig.Pickle$HardlinkOps.sinfo$lzycompute(Pickle.scala:577)
	at rsc.scalasig.Pickle$HardlinkOps.sinfo(Pickle.scala:574)
	at rsc.scalasig.Pickle$HardlinkOps.isObject(Pickle.scala:586)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:82)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSym(Pickle.scala:37)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:264)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:256)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitTpe(Pickle.scala:255)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:250)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:111)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:98)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:98)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:167)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:142)
	at scala.collection.immutable.List.map(List.scala:284)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitScope(Pickle.scala:142)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:237)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:177)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:176)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:181)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:177)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:176)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:111)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:98)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:98)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:167)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:142)
	at scala.collection.immutable.List.map(List.scala:284)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitScope(Pickle.scala:142)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:230)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:177)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:176)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:111)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:98)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:98)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1$$anonfun$apply$7.apply(Pickle.scala:285)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1$$anonfun$apply$7.apply(Pickle.scala:284)
	at rsc.scalasig.Pickle$Stack.inStructuralType(Pickle.scala:1332)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:284)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:256)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitTpe(Pickle.scala:255)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:233)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:177)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:176)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:111)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:98)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:98)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:167)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitScope$4.apply(Pickle.scala:142)
	at scala.collection.immutable.List.map(List.scala:284)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitScope(Pickle.scala:142)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:207)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitSig$1.apply(Pickle.scala:177)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSig(Pickle.scala:176)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:111)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$3.apply(Pickle.scala:98)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:98)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitSym(Pickle.scala:37)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:264)
	at rsc.scalasig.Pickle$$anonfun$rsc$scalasig$Pickle$$emitTpe$1.apply(Pickle.scala:256)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle.rsc$scalasig$Pickle$$emitTpe(Pickle.scala:255)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$2.apply(Pickle.scala:93)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1$$anonfun$apply$2.apply(Pickle.scala:83)
	at rsc.scalasig.Entries.getOrElseUpdate(Entries.scala:27)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:83)
	at rsc.scalasig.Pickle$$anonfun$emitEmbeddedSym$1.apply(Pickle.scala:79)
	at rsc.scalasig.Pickle$Stack.inEmbedded(Pickle.scala:1278)
	at rsc.scalasig.Pickle.emitEmbeddedSym(Pickle.scala:79)
	at rsc.scalasig.Writer.write(Writer.scala:33)
	at rsc.Compiler.rsc$Compiler$$scalasig(Compiler.scala:164)
	at rsc.Compiler$$anonfun$phases$6.apply$mcV$sp(Compiler.scala:73)
	at rsc.Compiler$$anonfun$run$2.apply(Compiler.scala:36)
	at rsc.Compiler$$anonfun$run$2.apply(Compiler.scala:33)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
	at rsc.Compiler.run(Compiler.scala:33)
	at rsc.cli.Main$.process(Main.scala:35)
	at rsc.cli.Main$.main(Main.scala:14)
	at rsc.cli.Main.main(Main.scala)

Other similar failures:

object O2 {
  def foo[_ <: { def bar[A](a: A) }]: Unit = ???
}
object O3 {
  def foo(x: { def bar[A](a: A) }): Unit = ???
}

Note that the following compiles successfully:

object O4 {
  def foo(x: { def bar(a: Int) }): Unit = ???
}

However, checkoutline disagrees (nsc includes an Anyref):

different nsc (-) vs rsc (+): O4.scala: _empty_/O4.foo().(x)
 signature {
   value_signature {
     tpe {
       structural_type {
         tpe {
-          with_type {
-            types {
-              type_ref {
-                prefix {
-                }
-                symbol: "scala/AnyRef#"
-              }
-            }
-          }
         }
         declarations {
           hardlinks {
             symbol: "localNNN"
             kind: METHOD
wiwa commented

It's worth to note that the error message

O.scala:2: error: local2
object O {
^
rsc.util.CrashException: local2

was quite unhelpful in figuring out what caused the failure.