summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala22
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala10
2 files changed, 22 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 9bffa01b71..b3a6d5260d 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -21,9 +21,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
// @S: XXX: why is this here? earsure is a typer, if you comment this
// out erasure still works, uses its own typed methods.
lazy val typerXXX = this.typer
- import typerXXX.{typed, typedPos} // methods to type trees
+ import typerXXX.{typed} // methods to type trees
import CODE._
+ def typedPos(pos: Position)(tree: Tree) = typed { atPos(pos)(tree) }
val phaseName: String = "erasure"
@@ -452,12 +453,12 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
ELSE (x())
)
)
- else if (pt.typeSymbol isNonBottomSubClass BoxedArrayClass)
- once (x =>
- (IF (x() IS_OBJ BoxedArrayClass.tpe) THEN (x()) ELSE boxArray(x())))
- else if (isSeqClass(pt.typeSymbol))
- once (x =>
- (IF (x() IS_OBJ pt) THEN (x()) ELSE (boxArray(x()))))
+ else if (pt.typeSymbol isNonBottomSubClass BoxedArrayClass) once (x =>
+ (IF (x() IS_OBJ BoxedArrayClass.tpe) THEN (x()) ELSE boxArray(x()))
+ )
+ else if (isSeqClass(pt.typeSymbol)) once (x =>
+ (IF (x() IS_OBJ pt) THEN (x()) ELSE (boxArray(x())))
+ )
else asPt(tree)
} else asPt(tree)
}
@@ -561,9 +562,12 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
tree match {
case Apply(Select(New(tpt), name), args) if (tpt.tpe.typeSymbol == BoxedArrayClass) =>
assert(name == nme.CONSTRUCTOR);
- assert(args.length < 2)
+ val translated: Tree =
+ if (args.length >= 2) REF(ArrayModule) DOT nme.ofDim
+ else NEW(BoxedAnyArrayClass) DOT name
+
typedPos(tree.pos) {
- Typed(Apply(NEW(BoxedAnyArrayClass) DOT name, args), tpt)
+ Typed(Apply(translated, args), tpt)
}
case Apply(TypeApply(sel @ Select(qual, name), List(targ)), List()) if tree.symbol == Any_asInstanceOf =>
val qual1 = typedQualifier(qual)
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 9b2b9e2248..7af0c4f56c 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -392,7 +392,15 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
if (traversableTpe != NoType && toArray != NoSymbol) {
val arguments =
if (toArray.tpe.paramTypes.isEmpty) List() // !!! old style toArray
- else List(localTyper.getManifestTree(tree.pos, tree.tpe.typeArgs.head, false)) // new style, with manifest
+ else { // new style, with manifest
+ val manifestOpt = localTyper.findManifest(tree.tpe.typeArgs.head, false)
+ if (manifestOpt.tree.isEmpty) {
+ unit.error(tree.pos, "cannot find class manifest for element type of "+tree.tpe)
+ List(Literal(Constant(null)))
+ } else {
+ List(manifestOpt.tree)
+ }
+ }
atPhase(phase.next) {
localTyper.typed {
atPos(pos) {