-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
(From Paul's comment in #4225)
object TestDep {
class Ops(val g: scala.reflect.api.JavaUniverse) {
def op[T: g.TypeTag] = ()
}
def Ops(g: scala.reflect.api.JavaUniverse): Ops = new Ops(g)
Ops(scala.reflect.runtime.universe).op[Int]
}uncaught exception during compilation: java.lang.AssertionError
java.lang.AssertionError: assertion failed: mkAttributedQualifier(_1.type, <none>)
at scala.Predef$.assert(Predef.scala:162)
at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:87)
at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:60)
at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:120)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.tagOfType(Implicits.scala:1176)
The implicit search for _1.g.TypeTag[Int]] fails trying to treat the skolem _1.type (originated from the tree Ops(scala.reflect.runtime.universe)) as a stable prefix for mkAttributedRef. AFAICS, it ought to fail through to a search failure.
An alternative formulation seems to work in this case:
object Test {
class Ops[U <: scala.reflect.api.JavaUniverse](val g: U) {
def op[T: U#TypeTag] = ()
}
implicit def Ops(g: scala.reflect.api.JavaUniverse): Ops[g.type] = new Ops(g)
Ops(scala.reflect.runtime.universe).op[Int]
scala.reflect.runtime.universe.op[Int]
}Reactions are currently unavailable