summaryrefslogtreecommitdiff
path: root/test/files/run/t6989/Test_2.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t6989/Test_2.scala')
-rw-r--r--test/files/run/t6989/Test_2.scala42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/files/run/t6989/Test_2.scala b/test/files/run/t6989/Test_2.scala
new file mode 100644
index 0000000000..e48e82422d
--- /dev/null
+++ b/test/files/run/t6989/Test_2.scala
@@ -0,0 +1,42 @@
+import scala.reflect.runtime.universe._
+
+// Originally composed to accommodate pull request feedback, this test has
+// uncovered a handful of bugs in FromJavaClassCompleter, namely:
+// * SI-7071 non-public ctors get lost
+// * SI-7072 inner classes are read incorrectly
+
+// I'm leaving the incorrect results of FromJavaClassCompleters in the check
+// file, so that we get notified when something changes there.
+
+package object foo {
+ def testAll(): Unit = {
+ test(typeOf[foo.PackagePrivateJavaClass].typeSymbol)
+ test(typeOf[foo.PackagePrivateJavaClass].typeSymbol.companionSymbol)
+ test(typeOf[foo.JavaClass_1].typeSymbol)
+ test(typeOf[foo.JavaClass_1].typeSymbol.companionSymbol)
+ }
+
+ def test(sym: Symbol): Unit = {
+ printSymbolDetails(sym)
+ if (sym.isClass || sym.isModule) {
+ sym.typeSignature.declarations.toList.sortBy(_.name.toString) foreach test
+ }
+ }
+
+ def printSymbolDetails(sym: Symbol): Unit = {
+ def stableSignature(sym: Symbol) = sym.typeSignature match {
+ case ClassInfoType(_, _, _) => "ClassInfoType(...)"
+ case tpe => tpe.toString
+ }
+ println("============")
+ println(s"sym = $sym, signature = ${stableSignature(sym)}, owner = ${sym.owner}")
+ println(s"isPrivate = ${sym.isPrivate}")
+ println(s"isProtected = ${sym.isProtected}")
+ println(s"isPublic = ${sym.isPublic}")
+ println(s"privateWithin = ${sym.privateWithin}")
+ }
+}
+
+object Test extends App {
+ foo.testAll()
+} \ No newline at end of file