diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 9 | ||||
-rw-r--r-- | test/files/pos/bug613.scala | 17 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index cc2b25a7e7..e7220014fd 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -695,7 +695,7 @@ trait Symbols requires SymbolTable { } def expandedName(name: Name): Name = - newTermName(fullNameString('$') + nme.EXPAND_SEPARATOR_STRING + name); + newTermName(fullNameString('$') + nme.EXPAND_SEPARATOR_STRING + name) def sourceFile: AbstractFile = (if (isModule) moduleClass else toplevelClass).sourceFile; @@ -757,8 +757,11 @@ trait Symbols requires SymbolTable { */ final def fullNameString(separator: char): String = { assert(owner != NoSymbol, this) - if (owner.isRoot || owner.isEmptyPackageClass) simpleName.toString() - else owner.fullNameString(separator) + separator + simpleName + idString; + var str = + if (owner.isRoot || owner.isEmptyPackageClass) simpleName.toString() + else owner.fullNameString(separator) + separator + simpleName + idString; + if (str.charAt(str.length - 1) == ' ') str = str.substring(0, str.length - 1) + str } final def fullNameString: String = fullNameString('.'); diff --git a/test/files/pos/bug613.scala b/test/files/pos/bug613.scala new file mode 100644 index 0000000000..49071fa806 --- /dev/null +++ b/test/files/pos/bug613.scala @@ -0,0 +1,17 @@ +class Outer extends Application { + val y: int = 1 + abstract class C { + val x: int + } + val foo = new C { + class I { + val z = y + } + val x = (new I).z + } +} + +object Test extends Application { + val o = new Outer + Console.println(o.foo.x) +} |