summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-06 21:36:53 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-01 09:55:04 +0100
commitbf247809da01b2f921c64ac69e7937773abe7e27 (patch)
treee5762ecc155aa2a3cbcd94d82adef05d768b3350
parent925df5555e8c43c50151cc0d418ef2f657393b63 (diff)
downloadscala-bf247809da01b2f921c64ac69e7937773abe7e27.tar.gz
scala-bf247809da01b2f921c64ac69e7937773abe7e27.tar.bz2
scala-bf247809da01b2f921c64ac69e7937773abe7e27.zip
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.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala3
1 files changed, 2 insertions, 1 deletions
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: