aboutsummaryrefslogtreecommitdiff
path: root/src/test/showClass.scala
blob: 4866d536f5f35af32b5cb652de3a91fd6c77726c (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
53
54
55
56
57
58
59
60
package test

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

object showClass {

  def showClasses(path: String)(implicit ctx: Context): Unit = {
    def showClass(cls: Symbol) = {
      println(s"showing $path -> ${cls.denot}")
      val cinfo = cls.info
      val infoText: Text = if (cinfo.exists) cinfo.toText else " is missing"
      println("======================================")
      println((cls.toText ~ infoText).show)
    }
    println(s"showing $path")
    val cls = ctx.requiredClass(path.toTypeName)
    showClass(cls)
    showClass(cls.linkedClass)
/*
    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) showClasses(arg)

//    showClasses("java.util.Map")
//    showClasses("scala.Boolean")
//    showClasses("scala.Array")
//    showClasses("scala.math.Ordering")
      showClasses("scala.collection.mutable.LinkedHashMap")
//    showClasses("scala.collection.Traversable")
//    showClasses("scala.collection.LinearSeqLike")
//    showClasses("scala.collection.immutable.List")
//    showClasses("scala.collection.convert.Wrappers")
//    showClasses("scala.collection.generic.package")
//    showClasses("scala.collection.MapLike")
//    showClasses("scala.Function1")
//  showClasses("dotty.tools.dotc.core.Types")
    println("done")
  }
}