summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-03-26 13:22:33 +0100
committerLukas Rytz <lukas.rytz@typesafe.com>2015-03-26 13:22:33 +0100
commit6372df754ca8943a5fea3455936dbb6c1723d78e (patch)
tree65354825353c927cbbb6bc7700a1fd4fc7c3982e
parent439b3eb6a733cd0a274c7d5498d918bce946f8d3 (diff)
parent06e7e342d1e27097df0b9d0b31a322fd1cf0a34e (diff)
downloadscala-6372df754ca8943a5fea3455936dbb6c1723d78e.tar.gz
scala-6372df754ca8943a5fea3455936dbb6c1723d78e.tar.bz2
scala-6372df754ca8943a5fea3455936dbb6c1723d78e.zip
Merge pull request #4361 from retronym/ticket/9182
SI-9182 Fix runtime reflection with package object, overloads
-rw-r--r--src/reflect/scala/reflect/runtime/SymbolLoaders.scala3
-rw-r--r--test/files/run/t9182.check3
-rw-r--r--test/files/run/t9182.scala12
3 files changed, 17 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/runtime/SymbolLoaders.scala b/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
index 50ea8d9868..9ce6331e33 100644
--- a/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
+++ b/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
@@ -107,7 +107,8 @@ private[reflect] trait SymbolLoaders { self: SymbolTable =>
if (isCompilerUniverse) super.enter(sym)
else {
val existing = super.lookupEntry(sym.name)
- assert(existing == null || existing.sym.isMethod, s"pkgClass = $pkgClass, sym = $sym, existing = $existing")
+ def eitherIsMethod(sym1: Symbol, sym2: Symbol) = sym1.isMethod || sym2.isMethod
+ assert(existing == null || eitherIsMethod(existing.sym, sym), s"pkgClass = $pkgClass, sym = $sym, existing = $existing")
super.enter(sym)
}
}
diff --git a/test/files/run/t9182.check b/test/files/run/t9182.check
new file mode 100644
index 0000000000..80e8b6c558
--- /dev/null
+++ b/test/files/run/t9182.check
@@ -0,0 +1,3 @@
+constructor package
+method A
+object A
diff --git a/test/files/run/t9182.scala b/test/files/run/t9182.scala
new file mode 100644
index 0000000000..1768aa688e
--- /dev/null
+++ b/test/files/run/t9182.scala
@@ -0,0 +1,12 @@
+// Main.scala
+package object ops {
+ object A
+ def A(a: Any) = ()
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val pack = scala.reflect.runtime.currentMirror.staticModule("ops.package")
+ println(pack.info.decls.toList.map(_.toString).sorted.mkString("\n"))
+ }
+}