You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As pointed out by @smarter in #10769, for the following code:
package stm
trait STMLike[F[_]] {
import Internals._
sealed abstract class Txn[+A] {}
object Txn {
def abort[A](e: Throwable): Txn[A] = Abort(e)
}
object Internals {
case class Abort(error: Throwable) extends Txn[Nothing]
}
}
The compiler synthesized the following code for the object `Txn`:
object Txn {
type MirroredMonoType = STMLike.this.Txn[?]
def ordinal(x: Txn.MirroredMonoType): Int =
x match {
case _:stm.STMLike.Internals.Abort => 0
}
def abort[A](e: Throwable): Txn[A] = Abort(e)
}
In the method `ordinal`, the type for `Internals.Abort` is
TypeRef(ThisType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class stm)),trait STMLike)),module class Internals$)),class Abort)
This type is incorrect, as we are not in the object `Internals`. The
explicit outer can only handle such types if it's static. In this
case, the object is not static, thus it crashes the explicit outer.
Co-authored-by: Guillaume Martres <[email protected]>
0 commit comments