summaryrefslogblamecommitdiff
path: root/test/files/run/reflection-companiontype.scala
blob: 7f2a37aaa913cdb7eac1aa276a4b117d10fbea59 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                            


                                                                                                            


                                                                                                        
                                                                                   
 
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}

class C
object C

object Test extends App {
  type T = C

  println("TypeRefs")
  println(showRaw(typeOf[C].companionType, printKinds = true))
  println(showRaw(typeOf[C].companionType.companionType, printKinds = true))
  println(showRaw(typeOf[C.type].companionType, printKinds = true))
  println("ClassInfoTypes")
  println(showRaw(typeOf[C].typeSymbol.info.companionType, printKinds = true))
  println(showRaw(typeOf[C].typeSymbol.info.companionType.typeSymbol.info.companionType, printKinds = true))
  println(showRaw(typeOf[C.type].typeSymbol.info.companionType, printKinds = true))
  println("Unrelated")
  println(showRaw(typeOf[T].companionType, printKinds = true))
  println(showRaw(cm.staticPackage("scala").moduleClass.asType.toType.companionType, printKinds = true))
  println(showRaw(cm.staticPackage("scala").info.companionType, printKinds = true))
}