Closes #4603. Review by extempore.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25394 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
odersky 2011-07-28 13:50:21 +00:00
parent 9cb04ea1c4
commit c06e31f78b
1 changed files with 5 additions and 2 deletions

View File

@ -3471,6 +3471,7 @@ A type's typeSymbol should never be inspected directly.
*/
object rawToExistential extends TypeMap {
private var expanded = immutable.Set[Symbol]()
private var generated = immutable.Set[Type]()
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, List()) if isRawIfWithoutArgs(sym) =>
if (expanded contains sym) AnyRefClass.tpe
@ -3481,8 +3482,10 @@ A type's typeSymbol should never be inspected directly.
} finally {
expanded -= sym
}
case ExistentialType(_, _) => // stop to avoid infinite expansions
tp
case ExistentialType(_, _) if !(generated contains tp) => // to avoid infinite expansions. todo: not sure whether this is needed
val result = mapOver(tp)
generated += result
result
case _ =>
mapOver(tp)
}