diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-04-20 09:25:45 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-04-20 09:25:45 +0000 |
commit | c98ed47ebb0e54f155bf3bd8827658371726711f (patch) | |
tree | 576d8c7965719a0c3b4519abb0d9e92b6820c0d7 /src/compiler | |
parent | 3fb252a9041e74f134da2cecb8261033ac9bed3e (diff) | |
download | scala-c98ed47ebb0e54f155bf3bd8827658371726711f.tar.gz scala-c98ed47ebb0e54f155bf3bd8827658371726711f.tar.bz2 scala-c98ed47ebb0e54f155bf3bd8827658371726711f.zip |
- problem with normalisation in the back-end wa...
- problem with normalisation in the back-end was due to Array not being
- erased. Solution: don't use type-aliases in the definition of the
- class scala.Array removed troublesome assert from typed1 as there are
- legit cases (see added comment in Typers)
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 2325d27060..e223ab112a 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -624,7 +624,7 @@ abstract class GenICode extends SubComponent { assert(ctor.isClassConstructor, "'new' call to non-constructor: " + tree) - generatedType = toTypeKind(tpt.tpe.normalize) // @M: because typedTypeConstructor doesn't normalize anymore + generatedType = toTypeKind(tpt.tpe) assert(generatedType.isReferenceType || generatedType.isArrayType, "Non reference type cannot be instantiated: " + generatedType) diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index a9617225a6..2cfd6886f8 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -82,7 +82,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { * - if symbol is a def parameter with transformed type T, return () => T */ def transformInfo(sym: Symbol, tp: Type): Type = - if (sym.isType) uncurryType(tp.normalize) else uncurry(tp.normalize) + if (sym.isType) uncurryType(tp.normalize) else uncurry(tp.normalize) // @MAT class UnCurryTransformer(unit: CompilationUnit) extends TypingTransformer(unit) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index c56e873525..8a03ae3a44 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2513,11 +2513,12 @@ trait Typers requires Analyzer { //@M! the polytype denotes the expected kind (arg, tparam) => typedHigherKindedType(arg, parameterizedType(tparam.typeParams, AnyClass.tpe)) } else { - assert(fun1.symbol.info.isInstanceOf[OverloadedType] || fun1.symbol.isError) - // @M this branch is hit for an overloaded polymorphic type. - // Until the right alternative is known, be very liberal, + //@M this branch is correctly hit for an overloaded polymorphic type. It also has to handle erroneous cases. + // Until the right alternative for an overloaded method is known, be very liberal, // typedTypeApply will find the right alternative and then do the same check as // in the then-branch above. (see pos/tcpoly_overloaded.scala) + // this assert is too strict: be tolerant for errors like trait A { def foo[m[x], g]=error(""); def x[g] = foo[g/*ERR: missing argument type*/] } + //assert(fun1.symbol.info.isInstanceOf[OverloadedType] || fun1.symbol.isError) //, (fun1.symbol,fun1.symbol.info,fun1.symbol.info.getClass,args,tparams)) List.mapConserve(args)(typedHigherKindedType) } @@ -2691,7 +2692,7 @@ trait Typers requires Analyzer { val result = withNoGlobalVariance{ typed(tree, TYPEmode | FUNmode, WildcardType) } if (!phase.erasedTypes && result.tpe.isInstanceOf[TypeRef] && !result.tpe.prefix.isStable) error(tree.pos, result.tpe.prefix+" is not a legal prefix for a constructor") - result setType(result.tpe) // @M: no need to normalize here, see GenICode line 627: generatedType = toTypeKind(tpt.tpe.normalize) + result setType(result.tpe) // @M: normalization is done during erasure } def computeType(tree: Tree, pt: Type): Type = { |