From f3c134a70b0c0094eb0193c85987ee13a68b5a49 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 20 Jul 2007 12:27:22 +0000 Subject: a better fix than in r12370: delaying normaliza... a better fix than in r12370: delaying normalization of T in classOf[T] until it is actually necessary (in toTypeKind) --- src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 5e552faddb..1bf5455a13 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -380,7 +380,7 @@ trait TypeKinds { self: ICodes => /** Return the TypeKind of the given type */ - def toTypeKind(t: Type): TypeKind = t match { + def toTypeKind(t: Type): TypeKind = t.normalize match { case ThisType(sym) => REFERENCE(sym) case SingleType(pre, sym) => diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 6370eb244d..5799e3f494 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2070,7 +2070,8 @@ trait Typers { self: Analyzer => if (fun.symbol == Predef_classOf) { if (!targs.head.typeSymbol.isClass || targs.head.typeSymbol.isRefinementClass) error(args.head.pos, "class type required"); - Literal(Constant(targs.head.normalize)) setPos tree.pos setType ClassClass.tpe + Literal(Constant(targs.head)) setPos tree.pos setType ClassClass.tpe + // @M: targs.head.normalize is not necessary --> toTypeKind eventually normalizes the type } else { val resultpe0 = restpe.instantiateTypeParams(tparams, targs) //@M TODO -- probably ok -- cgit v1.2.3