diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t7582-private-within.check | 12 | ||||
-rw-r--r-- | test/files/run/t7582-private-within/JavaPackagePrivate.java | 8 | ||||
-rw-r--r-- | test/files/run/t7582-private-within/Test.scala | 22 |
3 files changed, 42 insertions, 0 deletions
diff --git a/test/files/run/t7582-private-within.check b/test/files/run/t7582-private-within.check new file mode 100644 index 0000000000..b2743ffa06 --- /dev/null +++ b/test/files/run/t7582-private-within.check @@ -0,0 +1,12 @@ +private[package pack] class JavaPackagePrivate +private[package pack] module JavaPackagePrivate +private[package pack] module class JavaPackagePrivate +private[package pack] field field +private[package pack] primary constructor <init> +private[package pack] method meth +private[package pack] field staticField +private[package pack] method staticMeth +private[package pack] method <clinit> +private[package pack] field staticField +private[package pack] method staticMeth +private[package pack] method <clinit> diff --git a/test/files/run/t7582-private-within/JavaPackagePrivate.java b/test/files/run/t7582-private-within/JavaPackagePrivate.java new file mode 100644 index 0000000000..672d19b57e --- /dev/null +++ b/test/files/run/t7582-private-within/JavaPackagePrivate.java @@ -0,0 +1,8 @@ +package pack; + +class JavaPackagePrivate { + int field = 0; + static int staticField = 0; + void meth() { } + static void staticMeth() { } +} diff --git a/test/files/run/t7582-private-within/Test.scala b/test/files/run/t7582-private-within/Test.scala new file mode 100644 index 0000000000..3d581f063b --- /dev/null +++ b/test/files/run/t7582-private-within/Test.scala @@ -0,0 +1,22 @@ +import scala.tools.partest.DirectTest + +// Testing that the `privateWithin` field is correctly populated on all +// the related symbols (e.g. module class) under separate compilation. +object Test extends DirectTest { + def code = ??? + + def show(): Unit = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + val global = newCompiler("-usejavacp", "-cp", classpath, "-d", testOutput.path) + import global._ + withRun(global) { _ => + def check(sym: Symbol) = { + sym.initialize + println(f"${sym.accessString}%12s ${sym.accurateKindString} ${sym.name.decode}") // we want to see private[pack] for all of these. + } + val sym = rootMirror.getRequiredClass("pack.JavaPackagePrivate") + val syms = Seq(sym, sym.companionModule, sym.companionModule.moduleClass) + (syms ++ syms.flatMap(_.info.decls)).foreach(check) + } + } +} |