aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/reflection-modulemirror-toplevel-good.scala
blob: a278b728eaa9ef7a9a2a49e585fab34c91dde798 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.reflect.ClassTag

object R { override def toString = "R" }

class Foo{
 import Test._
 def foo = {
  val classTag = implicitly[ClassTag[R.type]]
  val sym = cm.moduleSymbol(classTag.runtimeClass)
  val cls = cm.reflectModule(sym)
  cls.instance
 }
}

object Test extends dotty.runtime.LegacyApp{
  val foo = new Foo
  println(foo.foo)
}