diff options
author | paltherr <paltherr@epfl.ch> | 2004-06-03 09:18:54 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-06-03 09:18:54 +0000 |
commit | b45360c49e2fd3edb424f642983d67d0b6b980a9 (patch) | |
tree | 0a13479accfdb859b44e48b7e964b509e2f4a952 /sources | |
parent | e5a10b5d5f4dae5ba13006f0d3c1f8a456cf9390 (diff) | |
download | scala-b45360c49e2fd3edb424f642983d67d0b6b980a9.tar.gz scala-b45360c49e2fd3edb424f642983d67d0b6b980a9.tar.bz2 scala-b45360c49e2fd3edb424f642983d67d0b6b980a9.zip |
- Fixed erasure for bug 328
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/transformer/Erasure.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/scalac/transformer/Erasure.java b/sources/scalac/transformer/Erasure.java index 0a1e646c83..e78de5d343 100644 --- a/sources/scalac/transformer/Erasure.java +++ b/sources/scalac/transformer/Erasure.java @@ -318,7 +318,7 @@ public class Erasure extends GenTransformer implements Modifiers { else return coerce(convert(tree, to), pt); } else if (isUnboxedArrayType(tree.type())) { - if (!isUnboxedArrayType(pt)) return coerce(box(tree), pt); + if (!isUnboxedArrayType(pt)) return check(box(tree), pt); } else if (isUnboxedSimpleType(pt)) { Type from = tree.type().erasure(); if (isUnboxedSimpleType(from)) @@ -335,6 +335,13 @@ public class Erasure extends GenTransformer implements Modifiers { return gen.mkAsInstanceOf(tree, pt); } + /** Checks that the given tree is of the given type. */ + private Tree check(Tree tree, Type pt) { + assert isSubType(tree.type(), pt): tree +" - "+ tree.type() +" - "+pt; + return tree; + } + + /** Boxes the given tree. */ private Tree box(Tree tree) { return box(tree, false); |