From 5be9ee030535a806c3f2467d8af1962b4131062a Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 7 May 2007 12:22:56 +0000 Subject: fixed bug1090 widen now only normalizes when necessary --- src/compiler/scala/tools/nsc/symtab/Types.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Infer.scala | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 9f10ab994b..156f79617e 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1206,7 +1206,7 @@ A type's symbol should never be inspected directly. else if (isHigherKinded) PolyType(typeParams, transform(sym.info.resultType).normalize) else { - log("Error: normalizing "+sym.rawname+" with mismatch between type params "+sym.info.typeParams+" and args "+args) + //log("Error: normalizing "+sym.rawname+" with mismatch between type params "+sym.info.typeParams+" and args "+args) //this transform(sym.info.resultType).normalize // technically wrong, but returning `this' is even worse (cycle!) // only happens when compiling `val x: Class' with -Xgenerics, diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 0cee1b1bba..39f8893fbd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -860,9 +860,11 @@ trait Infer { } /** Type with all top-level occurrences of abstract types replaced by their bounds */ - def widen(tp: Type): Type = tp.normalize match { - case TypeRef(pre, sym, _) if sym.isAbstractType => + def widen(tp: Type): Type = tp match { // @M don't normalize here (compiler loops on pos/bug1090.scala ) + case TypeRef(_, sym, _) if sym.isAbstractType => widen(tp.bounds.hi) + case TypeRef(_, sym, _) if sym.isAliasType => + widen(tp.normalize) case rtp @ RefinedType(parents, decls) => copyRefinedType(rtp, List.mapConserve(parents)(widen), decls) case _ => -- cgit v1.2.3