diff options
Diffstat (limited to 'test/files/run/reflection-modulemirror-nested-good.scala')
-rw-r--r-- | test/files/run/reflection-modulemirror-nested-good.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/reflection-modulemirror-nested-good.scala b/test/files/run/reflection-modulemirror-nested-good.scala new file mode 100644 index 0000000000..8390bbaac7 --- /dev/null +++ b/test/files/run/reflection-modulemirror-nested-good.scala @@ -0,0 +1,24 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.ClassTag + +class Foo{ + import Test._ + def foo = { + val classTag = implicitly[ClassTag[R.type]] + val sym = cm.moduleSymbol(classTag.runtimeClass) + val cls = cm.reflectModule(sym) + try { + cls.instance + } catch { + case ex: Throwable => + println(ex.getMessage) + } + } +} + +object Test extends App{ + object R { override def toString = "R" } + val foo = new Foo + println(foo.foo) +}
\ No newline at end of file |