summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-08-21 17:42:43 +0000
committerPaul Phillips <paulp@improving.org>2009-08-21 17:42:43 +0000
commit7039772a3ae96fe79b1bbc5e55745a59080a5227 (patch)
tree4b9f1c7b7ef936a1a992257040134cf574fdd7b2
parent4a1b8bcc729e7817aa4017a7494f2c61fd7b7a22 (diff)
downloadscala-7039772a3ae96fe79b1bbc5e55745a59080a5227.tar.gz
scala-7039772a3ae96fe79b1bbc5e55745a59080a5227.tar.bz2
scala-7039772a3ae96fe79b1bbc5e55745a59080a5227.zip
Reverted r18344 as it is interacting badly with...
Reverted r18344 as it is interacting badly with package objects.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala20
-rw-r--r--test/files/run/bug1373.scala6
2 files changed, 2 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index b76f169552..e4696339bc 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -1051,24 +1051,8 @@ trait Symbols {
/** Return every accessor of a primary constructor parameter in this case class
*/
- final def caseFieldAccessors: List[Symbol] = {
- val allAccessors = info.decls.toList filter (_ hasFlag CASEACCESSOR)
-
- // if a case class has private fields, the accessors will come back in the wrong
- // order unless we do some more work. See ticket #1373 and test bug1373.scala.
- def findRightAccessor(cpa: Symbol) = {
- val toFind = cpa.fullNameString + "$"
- // def fail = throw new Error("Accessor for %s not found among %s".format(cpa.fullNameString, allAccessors))
- def isRightAccessor(s: Symbol) =
- if (s hasFlag ACCESSOR) s.accessed.id == cpa.id
- else s.fullNameString startsWith toFind
-
- if (cpa.isOuterAccessor || cpa.isOuterField) None
- else allAccessors find isRightAccessor
- }
-
- constrParamAccessors map findRightAccessor flatten
- }
+ final def caseFieldAccessors: List[Symbol] =
+ info.decls.toList filter (sym => !(sym hasFlag PRIVATE) && sym.hasFlag(CASEACCESSOR))
final def constrParamAccessors: List[Symbol] =
info.decls.toList filter (sym => !sym.isMethod && sym.hasFlag(PARAMACCESSOR))
diff --git a/test/files/run/bug1373.scala b/test/files/run/bug1373.scala
deleted file mode 100644
index 537421c788..0000000000
--- a/test/files/run/bug1373.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-// Testing whether case class params come back in the right order.
-object Test extends Application {
- case class Foo(private val a: String, b: String, private val c: String, d: String, private val e: String)
- val x = Foo("a", "b", "c", "d", "e")
- assert(x.toString == """Foo(a,b,c,d,e)""")
-} \ No newline at end of file