diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-06 21:36:53 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-02-01 09:55:04 +0100 |
commit | bf247809da01b2f921c64ac69e7937773abe7e27 (patch) | |
tree | e5762ecc155aa2a3cbcd94d82adef05d768b3350 /src/compiler | |
parent | 925df5555e8c43c50151cc0d418ef2f657393b63 (diff) | |
download | scala-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.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 |
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: |