aboutsummaryrefslogtreecommitdiff
path: root/src/test/showClass.scala
blob: a7896c73317e7beb1002a181e7a167963e777cca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package test

import dotty.tools.dotc.core._
import Contexts._
import Symbols._, Types._
import Decorators._

object showClass {

  def showClass(path: String)(implicit ctx: Context): Unit = {
    println(s"showing $path")
    val cls = ctx.requiredClass(path.toTypeName)
    println(s"showing $path -> ${cls.denot}")
    println((cls.toText ~ cls.info.toText).show)
/*
    val info = cls.info
    info match {
      case ClassInfo(pre, c, cps, decls, optSelfType) =>
        println(s"prefix = ${pre.show}")
        println(s"self = ${c.show}")
        println(s"parents = ${cps.map(_.show).mkString(",")}")
        println(s"showClass $path") // !!! DEBUG
        println(s"decls = ${decls.show}")
        println(s"selftype = ${optSelfType.show}")
        println(s"type-params = ${info.typeParams}")
    }
*/
  }

  def main(args: Array[String]) = {
    val base = Context.theBase
    implicit val ctx = base.initialCtx
    println(ctx.settings)
    base.definitions.init()

    for (arg <- args) showClass(arg)

//    showClass("java.lang.Class")
//    showClass("scala.Boolean")
//    showClass("scala.Array")
//    showClass("scala.math.Ordering")
//    showClass("scala.collection.Traversable")
//    showClass("scala.collection.LinearSeqLike")
//    showClass("scala.collection.immutable.List")
      showClass("scala.collection.TraversableLike")
//    showClass("scala.collection.immutable.Seq")
//    showClass("scala.collection.MapLike")
//    showClass("scala.Function1")
//    showClass("dotty.tools.dotc.core.Types")
    println("done")
  }
}