I have a method:
import scala.reflect.runtime.universe.{TypeTag,typeOf}
def print[T:TypeTag] = println(typeOf[T].typeSymbol.name.toString)
Most of the time, print[MyClass]
prints MyClass
when invoked, but sometimes, it prints <refinement>
?
I am working on a fairly complex system (multiple interconnecting jars, 100K lines of code), and I cannot seem to identify what determines if it is the one behaviour or the other. But if I knew what <refinement>
means, or what triggers that, maybe I could?
Refinements could be explained as anonymous class type. E.g.
import scala.reflect.runtime.universe.{TypeTag,typeOf}
def print[T:TypeTag] = println(typeOf[T].typeSymbol.name.toString)
class C
trait T
print[C with T]
type A = C with T
print[A]
Output will be <refinement>
in both cases.