summaryrefslogtreecommitdiff
path: root/test/files/run/t8133b
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-01-13 12:45:46 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-14 22:44:25 +0100
commite57af7dae72cae7d071f848edaf1fdbe32939ed8 (patch)
tree2ede778dc5115d77a7191b1d2899a92020ab0df9 /test/files/run/t8133b
parente089cafb5fd02e2457bafde3252da3a771d3180e (diff)
downloadscala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.tar.gz
scala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.tar.bz2
scala-e57af7dae72cae7d071f848edaf1fdbe32939ed8.zip
SI-8133 Fix regression with package objects, overloading
Regressed in f5c336d56, a refactoring of `typedIdent`. In that commit, an (ostensibly) accidental change arrived, equivalent to: - val pre1 = if (qual == EmptyTree) NoPrefix else if (sym.isTopLevel) sym.owner.thisType else qual.tpe + val pre1 = if (sym.isTopLevel) sym.owner.thisType else if (qual == EmptyTree) NoPrefix else qual.tpe Here, `qual` is a tree returned in the successful result of `Context#lookup`. This change itself looks innocuous (top level symbols can be prefixed with a qualifier or not, right?), but it exposed us to a bug in `makeAccessible`. It is responsible for rewriting, e.g, `scala.List` to `scala.package.List`. It has a few cases, but one of them relies relies on typechecking `Ident(nme.PACKAGE)`, and hoping that it will bind to the right place. That's fraught with danger, and breaks in the enclosed tests. This commit binds that Ident symbolically, and in the process factors a tiny bit of code in common with `TreeGen`. (More work is still needed here!) In the next commit, I'm going to revert the change to `pre1`. That would have also fixed the regression, albeit symptomatically.
Diffstat (limited to 'test/files/run/t8133b')
-rw-r--r--test/files/run/t8133b/A_1.scala4
-rw-r--r--test/files/run/t8133b/B_2.scala9
2 files changed, 13 insertions, 0 deletions
diff --git a/test/files/run/t8133b/A_1.scala b/test/files/run/t8133b/A_1.scala
new file mode 100644
index 0000000000..24bbfc118d
--- /dev/null
+++ b/test/files/run/t8133b/A_1.scala
@@ -0,0 +1,4 @@
+package object pkg {
+ def foo(x: Int): String = "a"
+ def foo(x: String): String = "b"
+}
diff --git a/test/files/run/t8133b/B_2.scala b/test/files/run/t8133b/B_2.scala
new file mode 100644
index 0000000000..865ca0c0b0
--- /dev/null
+++ b/test/files/run/t8133b/B_2.scala
@@ -0,0 +1,9 @@
+// b.scala
+package pkg {
+ package object other
+ package other { class Crash { foo("") } }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = new pkg.other.Crash
+}