diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-05-26 20:11:26 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan@lightbend.com> | 2016-08-11 10:59:15 -0700 |
commit | 1f6f7f8aa94c622665a35343de8108ea66a787b7 (patch) | |
tree | 6556ae84eced06a88cfc9bd65d06607723c7db6c /src/reflect/scala/reflect/internal/Symbols.scala | |
parent | fcfe7050a50d2c71094a9ac212330be87c4d0781 (diff) | |
download | scala-1f6f7f8aa94c622665a35343de8108ea66a787b7.tar.gz scala-1f6f7f8aa94c622665a35343de8108ea66a787b7.tar.bz2 scala-1f6f7f8aa94c622665a35343de8108ea66a787b7.zip |
Don't cache `MethodSymbol`'s `memberType`.
Correct caching is impossible because `sym.tpeHK.asSeenFrom(pre, sym.owner)`
may have different results even for reference-identical `sym.tpeHK` and `pre`
(even in the same period). For example, `pre` could be a `ThisType`.
For such a type, `tpThen eq tpNow` does not imply `tpThen` and `tpNow` mean
the same thing, because `tpThen.typeSymbol.info` could have been different
from what it is now, and the cache won't know simply by looking at `pre`.
Somehow this distinction never caused trouble, but when starting to desugar
module definitions during the fields phase, it causes several test failures.
I tried keying the cache on the current period to no avail.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 1456022b10..e438856160 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2906,11 +2906,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** A class for method symbols */ class MethodSymbol protected[Symbols] (initOwner: Symbol, initPos: Position, initName: TermName) extends TermSymbol(initOwner, initPos, initName) with MethodSymbolApi { - private[this] var mtpePeriod = NoPeriod - private[this] var mtpePre: Type = _ - private[this] var mtpeResult: Type = _ - private[this] var mtpeInfo: Type = _ - override def isLabel = this hasFlag LABEL override def isVarargsMethod = this hasFlag VARARGS override def isLiftedMethod = this hasFlag LIFTED @@ -2928,21 +2923,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => // are a case accessor (you can also be a field.) override def isCaseAccessorMethod = isCaseAccessor - def typeAsMemberOf(pre: Type): Type = { - if (mtpePeriod == currentPeriod) { - if ((mtpePre eq pre) && (mtpeInfo eq info)) return mtpeResult - } else if (isValid(mtpePeriod)) { - mtpePeriod = currentPeriod - if ((mtpePre eq pre) && (mtpeInfo eq info)) return mtpeResult - } - val res = pre.computeMemberType(this) - mtpePeriod = currentPeriod - mtpePre = pre - mtpeInfo = info - mtpeResult = res - res - } - override def isVarargs: Boolean = definitions.isVarArgsList(paramss.flatten) override def returnType: Type = { |