summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/Types.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-23 01:21:52 +0000
committerPaul Phillips <paulp@improving.org>2011-05-23 01:21:52 +0000
commite6b0beaa4c41a46bb9eb492f3fad6ff6589fa5ea (patch)
treeb89896de0cc5e38b478b798ac799047ebad2b978 /src/compiler/scala/reflect/internal/Types.scala
parent00569a3b47164b06f863eac2a23a8226447e3e0a (diff)
downloadscala-e6b0beaa4c41a46bb9eb492f3fad6ff6589fa5ea.tar.gz
scala-e6b0beaa4c41a46bb9eb492f3fad6ff6589fa5ea.tar.bz2
scala-e6b0beaa4c41a46bb9eb492f3fad6ff6589fa5ea.zip
Reverts a change as a tribute to the performanc...
Reverts a change as a tribute to the performance gods, no review.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Types.scala')
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 8930ff86cd..572cb8d3a4 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -1679,7 +1679,8 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable =>
// assert(args.isEmpty || !sym.info.typeParams.isEmpty, this)
// assert(args.isEmpty || ((sym ne AnyClass) && (sym ne NothingClass))
- private val parentsCache = new ListOfTypesCache(thisInfo.parents map transform)
+ private var parentsCache: List[Type] = _
+ private var parentsPeriod = NoPeriod
private var baseTypeSeqCache: BaseTypeSeq = _
private var baseTypeSeqPeriod = NoPeriod
@@ -1759,7 +1760,18 @@ A type's typeSymbol should never be inspected directly.
if (sym.isAbstractType) thisInfo.bounds // transform(thisInfo.bounds).asInstanceOf[TypeBounds] // ??? seems to be doing asSeenFrom twice
else super.bounds
- override def parents: List[Type] = parentsCache.get()
+ override def parents: List[Type] = {
+ val period = parentsPeriod
+ if (period != currentPeriod) {
+ parentsPeriod = currentPeriod
+ if (!isValidForBaseClasses(period)) {
+ parentsCache = thisInfo.parents map transform
+ } else if (parentsCache == null) { // seems this can happen if things are currupted enough, see #2641
+ parentsCache = List(AnyClass.tpe)
+ }
+ }
+ parentsCache
+ }
override def typeOfThis = transform(sym.typeOfThis)
/*