summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McDirmid <sean.mcdirmid@gmail.com>2007-10-19 14:21:37 +0000
committerSean McDirmid <sean.mcdirmid@gmail.com>2007-10-19 14:21:37 +0000
commit810a709dd76ffda5ad4fd69b9be7224c86884e0b (patch)
tree64d0567f079c1916c342765481f60a07456b71e8
parent0ff28e0305f1c1a2e8a4284a0520fad1cdb4e7f1 (diff)
downloadscala-810a709dd76ffda5ad4fd69b9be7224c86884e0b.tar.gz
scala-810a709dd76ffda5ad4fd69b9be7224c86884e0b.tar.bz2
scala-810a709dd76ffda5ad4fd69b9be7224c86884e0b.zip
Rolling back my Erasure commit, my change has a...
Rolling back my Erasure commit, my change has a big whole in it even though it passes the test suite.
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 8e6e315f7d..a2575e59ad 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -180,11 +180,6 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
private def isSeqClass(sym: Symbol) =
(SeqClass isNonBottomSubClass sym) && (sym != ObjectClass)
- /** Decides if sym is a supertype of array, right now that includes
- from RandomAccessSeq.Mutable */
- private def isArraySuper(sym: Symbol) =
- (RandomAccessSeqMutableClass isNonBottomSubClass sym) //&& (sym != ObjectClass)
-
// -------- boxing/unboxing --------------------------------------------------------
override def newTyper(context: Context) = new Eraser(context)
@@ -282,8 +277,8 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
private def cast(tree: Tree, pt: Type): Tree = {
assert(pt eq pt.normalize)
- if (isArraySuper(tree.tpe.typeSymbol)) { // == ObjectClass) {
- if (pt.typeSymbol == ArrayClass) {
+ if (tree.tpe.typeSymbol == ObjectClass) {
+ if (pt.typeSymbol == ArrayClass)
typed {
atPos(tree.pos) {
gen.evalOnce(tree, context.owner, context.unit) { x =>
@@ -300,7 +295,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
}
}
- } else if (pt.typeSymbol isNonBottomSubClass BoxedArrayClass) {
+ else if (pt.typeSymbol isNonBottomSubClass BoxedArrayClass)
typed {
atPos(tree.pos) {
gen.evalOnce(tree, context.owner, context.unit) { x =>
@@ -317,7 +312,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
}
}
- } else if (isArraySuper(pt.typeSymbol)) {
+ else if (isSeqClass(pt.typeSymbol))
typed {
atPos(tree.pos) {
gen.evalOnce(tree, context.owner, context.unit) { x =>
@@ -334,7 +329,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
}
}
- } else gen.mkAttributedCast(tree, pt)
+ else gen.mkAttributedCast(tree, pt)
} else gen.mkAttributedCast(tree, pt)
}
@@ -444,18 +439,16 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
val qual1 = typedQualifier(qual)
val qualClass = qual1.tpe.typeSymbol
val targClass = targ.tpe.typeSymbol
-
/*
if (isNumericValueClass(qualClass) && isNumericValueClass(targClass))
// convert numeric type casts
atPos(tree.pos)(Apply(Select(qual1, "to" + targClass.name), List()))
else
*/
- assert(true)
if (isValueType(targClass) ||
(targClass == ArrayClass && (qualClass isNonBottomSubClass BoxedArrayClass)))
unbox(qual1, targ.tpe)
- else if (((targClass == ArrayClass || isArraySuper(targClass)) && isArraySuper(qualClass)))
+ else if (targClass == ArrayClass && qualClass == ObjectClass || isSeqClass(targClass))
cast(qual1, targ.tpe)
else
tree
@@ -832,7 +825,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
}
case _ =>
- if (isArraySuper(targ.tpe.typeSymbol)) {
+ if (isSeqClass(targ.tpe.typeSymbol)) {
atPos(tree.pos) {
gen.evalOnce(qual, currentOwner, unit) { q =>
gen.mkOr(
@@ -842,12 +835,6 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
})
}
}
- } else if (isArraySuper(qual.tpe.typeSymbol) && targ.tpe.typeSymbol == ArrayClass) {
- gen.evalOnce(qual, currentOwner, unit) { q =>
- atPos(tree.pos) {
- Apply(gen.mkAttributedRef(isArrayMethod), List(q()))
- }
- }
} else tree
}
case _ => tree