From 24958f7a8b1748be0c462b4563e652c9f7e24d6a Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 14 Nov 2012 11:40:12 -0800 Subject: Fix for SI-6664, cycle in case classes. Scope lookup of an overloaded symbol was accidentally forcing some lazy info. Since as usual the caller didn't even have any interest in the symbol, but only in whether the name existed at all, I changed it call the method I made for this exact purpose, containsName. Also I much reduced the number of checks being made in the quest for an inherited copy method. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/compiler') 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) } } -- cgit v1.2.3