diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-02-12 16:42:01 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-02-12 16:42:01 -0800 |
commit | 77115d03e41a072f2640d2a7c688bf82a38511e2 (patch) | |
tree | 5ffcc6c709866a765ba05b1d89e7da8203f25285 | |
parent | 6c8a12fbfe02db2890fefd60546dd43230e34bc3 (diff) | |
download | scala-77115d03e41a072f2640d2a7c688bf82a38511e2.tar.gz scala-77115d03e41a072f2640d2a7c688bf82a38511e2.tar.bz2 scala-77115d03e41a072f2640d2a7c688bf82a38511e2.zip |
thisInfo.parents also needs separate treatment
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 0b0e851d69..685c9f7476 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -1986,6 +1986,7 @@ trait Types override def termSymbol = if (this ne normalize) normalize.termSymbol else super.termSymbol override def typeSymbol = if (this ne normalize) normalize.typeSymbol else sym + override protected[Types] def parentsImpl: List[Type] = normalize.parents map relativize // `baseClasses` is sensitive to type args when referencing type members // consider `type foo[x] = x`, `typeOf[foo[String]].baseClasses` should be the same as `typeOf[String].baseClasses`, @@ -2080,6 +2081,7 @@ trait Types override def bounds = relativeInfo.bounds override protected[Types] def baseTypeSeqImpl: BaseTypeSeq = bounds.hi.baseTypeSeq prepend this + override protected[Types] def parentsImpl: List[Type] = relativeInfo.parents override def kind = "AbstractTypeRef" } @@ -2263,6 +2265,8 @@ trait Types } } + protected[Types] def parentsImpl: List[Type] = sym.info.parents map relativize + // Since type parameters cannot occur in super types, no need to relativize before looking at base *classes*. // Similarly, our prefix can occur in super class types, but it cannot influence which classes those types resolve to. // For example, `class Outer { outer => class Inner extends outer.Foo; class Foo }` @@ -2404,7 +2408,7 @@ trait Types if (period != currentPeriod) { tpe.parentsPeriod = currentPeriod if (!isValidForBaseClasses(period)) { - tpe.parentsCache = tpe.sym.info.parents map tpe.relativize + tpe.parentsCache = tpe.parentsImpl } else if (tpe.parentsCache == null) { // seems this can happen if things are corrupted enough, see #2641 tpe.parentsCache = List(AnyTpe) } |