Closed
Description
Compiling the following,
trait Foo {
type Id[t] = t
inline def foo[T](t: T) <: Id[T] =
inline t match {
case i: Int => (i+1).asInstanceOf[Id[T]]
case _ => t
}
}
object Bar extends Foo
object Test {
Bar.foo(23)
}
Results in a compiler crash due to an assertion,
exception occurred while compiling tests/pos/inline-from-super.scala
java.lang.AssertionError: assertion failed: unresolved symbols: value Foo_this when pickling tests/pos/inline-from-super.scala while compiling tests/pos/inline-from-super.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value Foo_this when pickling tests/pos/inline-from-super.scala
If we move the definition of Id
out of the definition of Foo
it compiles,
object Ext {
type Id[t] = t
}
import Ext._
trait Foo {
inline def foo[T](t: T) <: Id[T] =
inline t match {
case i: Int => (i+1).asInstanceOf[Id[T]]
case _ => t
}
}
object Bar extends Foo
object Test {
Bar.foo(23)
}
It also compiles if we move the entire body of Foo
into Bar
,
object Bar {
type Id[t] = t
inline def foo[T](t: T) <: Id[T] =
inline t match {
case i: Int => (i+1).asInstanceOf[Id[T]]
case _ => t
}
}
object Test {
Bar.foo(23)
}