summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-05-22 15:25:36 +0000
committerMartin Odersky <odersky@gmail.com>2006-05-22 15:25:36 +0000
commitd83476284ecca4f33986fcc265bb8a3f09f76c72 (patch)
treed7b1d5bee5060a98f892c2d68f074b6d5a9ceedd
parentc039ddddee91cf699be6952e24efa6c9768f2981 (diff)
downloadscala-d83476284ecca4f33986fcc265bb8a3f09f76c72.tar.gz
scala-d83476284ecca4f33986fcc265bb8a3f09f76c72.tar.bz2
scala-d83476284ecca4f33986fcc265bb8a3f09f76c72.zip
Fixed bug 613
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala9
-rw-r--r--test/files/pos/bug613.scala17
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)
+}