diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/reflection-companion.check | 6 | ||||
-rw-r--r-- | test/files/run/reflection-companion.scala | 16 | ||||
-rw-r--r-- | test/files/run/reflection-implClass.scala | 8 | ||||
-rw-r--r-- | test/files/run/t6989/Test_2.scala | 4 |
4 files changed, 28 insertions, 6 deletions
diff --git a/test/files/run/reflection-companion.check b/test/files/run/reflection-companion.check new file mode 100644 index 0000000000..5dbff9960e --- /dev/null +++ b/test/files/run/reflection-companion.check @@ -0,0 +1,6 @@ +C#MOD +C#CLS +C#CLS +NoSymbol#??? +NoSymbol#??? +NoSymbol#??? diff --git a/test/files/run/reflection-companion.scala b/test/files/run/reflection-companion.scala new file mode 100644 index 0000000000..0f62dead12 --- /dev/null +++ b/test/files/run/reflection-companion.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} + +class C +object C + +object Test extends App { + type T = C + + println(showRaw(symbolOf[C].companion, printKinds = true)) + println(showRaw(symbolOf[C].companion.companion, printKinds = true)) + println(showRaw(symbolOf[C.type].companion, printKinds = true)) + println(showRaw(symbolOf[T].companion, printKinds = true)) + println(showRaw(cm.staticPackage("scala").moduleClass.companion, printKinds = true)) + println(showRaw(cm.staticPackage("scala").companion, printKinds = true)) +}
\ No newline at end of file diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala index db211fd9a8..e11b8a2a16 100644 --- a/test/files/run/reflection-implClass.scala +++ b/test/files/run/reflection-implClass.scala @@ -16,13 +16,13 @@ object Test extends App with Outer { val s1 = implClass(classTag[Foo].runtimeClass) assert(s1 != NoSymbol) assert(s1.typeSignature != NoType) - assert(s1.companionSymbol.typeSignature != NoType) - assert(s1.companionSymbol.typeSignature.declaration(TermName("bar")) != NoSymbol) + assert(s1.companion.typeSignature != NoType) + assert(s1.companion.typeSignature.declaration(TermName("bar")) != NoSymbol) val s2 = implClass(classTag[Bar].runtimeClass) assert(s2 != NoSymbol) assert(s2.typeSignature != NoType) - assert(s2.companionSymbol.typeSignature != NoType) - assert(s2.companionSymbol.typeSignature.declaration(TermName("foo")) != NoSymbol) + assert(s2.companion.typeSignature != NoType) + assert(s2.companion.typeSignature.declaration(TermName("foo")) != NoSymbol) def implClass(clazz: Class[_]) = { val implClass = Class.forName(clazz.getName + "$class") cm.classSymbol(implClass) diff --git a/test/files/run/t6989/Test_2.scala b/test/files/run/t6989/Test_2.scala index e48e82422d..3f578158e8 100644 --- a/test/files/run/t6989/Test_2.scala +++ b/test/files/run/t6989/Test_2.scala @@ -11,9 +11,9 @@ import scala.reflect.runtime.universe._ package object foo { def testAll(): Unit = { test(typeOf[foo.PackagePrivateJavaClass].typeSymbol) - test(typeOf[foo.PackagePrivateJavaClass].typeSymbol.companionSymbol) + test(typeOf[foo.PackagePrivateJavaClass].typeSymbol.companion) test(typeOf[foo.JavaClass_1].typeSymbol) - test(typeOf[foo.JavaClass_1].typeSymbol.companionSymbol) + test(typeOf[foo.JavaClass_1].typeSymbol.companion) } def test(sym: Symbol): Unit = { |