summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-15 07:27:45 -0800
committerPaul Phillips <paulp@improving.org>2012-11-15 07:27:45 -0800
commitbc60605e182d526e4224c804d218e9a0e2952b72 (patch)
treee1789721cc30309f0ad0dde9f4d8d045cf5c4fc0 /src/compiler
parentbdab9cd5456203284658c1fbd492dc184126b3d1 (diff)
parent24958f7a8b1748be0c462b4563e652c9f7e24d6a (diff)
downloadscala-bc60605e182d526e4224c804d218e9a0e2952b72.tar.gz
scala-bc60605e182d526e4224c804d218e9a0e2952b72.tar.bz2
scala-bc60605e182d526e4224c804d218e9a0e2952b72.zip
Merge pull request #1627 from paulp/issue/6664
Fix for SI-6664, cycle in case classes.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 3f5410eb45..04fb69671e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -909,11 +909,10 @@ trait Namers extends MethodSynthesis {
val modClass = companionSymbolOf(clazz, context).moduleClass
modClass.attachments.get[ClassForCaseCompanionAttachment] foreach { cma =>
val cdef = cma.caseClass
- def hasCopy(decls: Scope) = (decls lookup nme.copy) != NoSymbol
+ def hasCopy = (decls containsName nme.copy) || parents.exists(_ member nme.copy exists)
+
// SI-5956 needs (cdef.symbol == clazz): there can be multiple class symbols with the same name
- if (cdef.symbol == clazz && !hasCopy(decls) &&
- !parents.exists(p => hasCopy(p.typeSymbol.info.decls)) &&
- !parents.flatMap(_.baseClasses).distinct.exists(bc => hasCopy(bc.info.decls)))
+ if (cdef.symbol == clazz && !hasCopy)
addCopyMethod(cdef, templateNamer)
}
}