summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 54e5978e7b..950a1d7725 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -3263,10 +3263,17 @@ A type's typeSymbol should never be inspected directly.
* in ClassFileparser.sigToType (where it is usually done)
*/
object rawToExistential extends TypeMap {
+ private var expanded = immutable.Set[Symbol]()
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, List()) if isRawIfWithoutArgs(sym) =>
- val eparams = typeParamsToExistentials(sym, sym.typeParams)
- existentialAbstraction(eparams, typeRef(pre, sym, eparams map (_.tpe)))
+ if (expanded contains sym) AnyRefClass.tpe
+ else try {
+ expanded += sym
+ val eparams = typeParamsToExistentials(sym, sym.typeParams)
+ existentialAbstraction(eparams, typeRef(pre, sym, eparams map (_.tpe)))
+ } finally {
+ expanded -= sym
+ }
case _ =>
mapOver(tp)
}