summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-02-11 17:16:44 +0000
committerMartin Odersky <odersky@gmail.com>2011-02-11 17:16:44 +0000
commit593256a6ecc799e10cd6079a61e713aede854106 (patch)
treee445c1b71dbdbb1aeb3174fb970f58bd7bbbb6f2 /src
parent02435237ac075fdd681fcd7d79faa6f2e7581c44 (diff)
downloadscala-593256a6ecc799e10cd6079a61e713aede854106.tar.gz
scala-593256a6ecc799e10cd6079a61e713aede854106.tar.bz2
scala-593256a6ecc799e10cd6079a61e713aede854106.zip
Fixed infinite expansion of rawToExistential di...
Fixed infinite expansion of rawToExistential discovered by Donna.
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)
}