Skip to content

SAMs for traits inheriting traits crash backend #511

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

Closed
odersky opened this issue Apr 30, 2015 · 0 comments
Closed

SAMs for traits inheriting traits crash backend #511

odersky opened this issue Apr 30, 2015 · 0 comments

Comments

@odersky
Copy link
Contributor

odersky commented Apr 30, 2015

Look at disabled/simplesams.scala in #509

package test

trait X { def foo(x: Int): Int; def bar = foo(2) }
trait XX extends X

object test {
  val x: X = (x: Int) => 2  // should be a closure
  val xx: XX = (x: Int) => 2  // should be a closure, but blows up in backend
}

This crashes the backend with

java.lang.AssertionError: assertion failed: not a method-symbol: val
at scala.Predef$.assert(Predef.scala:165)
at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.asmMethodType(BCodeHelpers.scala:253)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.asmMethodType(BCodeSkelBuilder.scala:51)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genInvokeDynamicLambda(BCodeBodyBuilder.scala:1391)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:324)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:78)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder$$anonfun$genNormalBlock$1$1.apply(BCodeBodyBuilder.scala:847)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder$$anonfun$genNormalBlock$1$1.apply(BCodeBodyBuilder.scala:847)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genNormalBlock$1(BCodeBodyBuilder.scala:847)

DarkDimius added a commit to lampepfl/scala that referenced this issue Apr 30, 2015
@DarkDimius DarkDimius self-assigned this Apr 30, 2015
DarkDimius added a commit that referenced this issue May 4, 2015
Fix #511. Lambdas of traits that inherit abstract member.
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this issue Dec 8, 2016
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this issue Dec 12, 2016
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