summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala4
-rw-r--r--test/files/run/t6888.check3
-rw-r--r--test/files/run/t6888.scala19
3 files changed, 25 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 72ad84edec..4ffd198dc4 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -2515,7 +2515,9 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
}
override def outerSource: Symbol =
- if (originalName == nme.OUTER) initialize.referenced
+ // SI-6888 Approximate the name to workaround the deficiencies in `nme.originalName`
+ // in the face of clases named '$'. SI-2806 remains open to address the deeper problem.
+ if (originalName endsWith (nme.OUTER)) initialize.referenced
else NoSymbol
def setModuleClass(clazz: Symbol): TermSymbol = {
diff --git a/test/files/run/t6888.check b/test/files/run/t6888.check
new file mode 100644
index 0000000000..4e8a2de2db
--- /dev/null
+++ b/test/files/run/t6888.check
@@ -0,0 +1,3 @@
+2
+3
+3
diff --git a/test/files/run/t6888.scala b/test/files/run/t6888.scala
new file mode 100644
index 0000000000..0c64cbe5b6
--- /dev/null
+++ b/test/files/run/t6888.scala
@@ -0,0 +1,19 @@
+class C {
+ val x = 1
+ object $ {
+ val y = x + x
+ class abc$ {
+ def xy = x + y
+ }
+ object abc$ {
+ def xy = x + y
+ }
+ }
+}
+
+object Test extends App {
+ val c = new C()
+ println(c.$.y)
+ println(c.$.abc$.xy)
+ println(new c.$.abc$().xy)
+}