diff options
Diffstat (limited to 'test/files/run/reflection-implClass-new.scala')
-rw-r--r-- | test/files/run/reflection-implClass-new.scala | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/test/files/run/reflection-implClass-new.scala b/test/files/run/reflection-implClass-new.scala deleted file mode 100644 index 27374f2106..0000000000 --- a/test/files/run/reflection-implClass-new.scala +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tries to load a symbol for the `Foo$class` using Scala reflection. - * Since trait implementation classes do not get pickling information - * symbol for them should be created using fallback mechanism - * that exposes Java reflection information dressed up in - * a Scala symbol. - */ -object Test extends App with Outer { - import scala.reflect.mirror - - assert(mirror.classToSymbol(classTag[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature == - mirror.classToSymbol(classTag[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature) - - val s1 = implClass(classTag[Foo].erasure) - assert(s1 != mirror.NoSymbol) - assert(s1.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature != mirror.NoType) - assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol) - val s2 = implClass(classTag[Bar].erasure) - assert(s2 != mirror.NoSymbol) - assert(s2.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature != mirror.NoType) - assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol) - def implClass(clazz: Class[_]) = { - val implClass = Class.forName(clazz.getName + "$class") - mirror.classToSymbol(implClass) - } -} - -trait Foo { - def bar = 1 -} - -trait Outer { - trait Bar { - def foo = 1 - } -} |