From bf247809da01b2f921c64ac69e7937773abe7e27 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 6 Nov 2013 21:36:53 +0100 Subject: Optimize use of methodTypeSchema Cache it, rather than recreating it for each candidate overriden method we encounter. We can't do this eagerly as we trip a cycle in neg/t5093.scala. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 27e8698676..645f267a21 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1069,8 +1069,9 @@ trait Namers extends MethodSynthesis { } def overriddenSymbol(resTp: Type) = { + lazy val schema: Type = methodTypeSchema(resTp) // OPT create once. Must be lazy to avoid cycles in neg/t5093.scala intersectionType(methOwner.info.parents).nonPrivateMember(meth.name).filter { sym => - sym != NoSymbol && (site.memberType(sym) matches methodTypeSchema(resTp)) + sym != NoSymbol && (site.memberType(sym) matches schema) } } // TODO: see whether this or something similar would work instead: -- cgit v1.2.3