diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-03 17:46:33 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-03 17:46:33 +0200 |
commit | d3f49de5de32eca71621c77494d5ccd284599e68 (patch) | |
tree | 210461214319a0c7024dc79ec396bd1d0d223179 /src/dotty/tools/dotc/transform/Erasure.scala | |
parent | e6fd1bbbdb8facc5301aaa19cf9293d78dcaba15 (diff) | |
download | dotty-d3f49de5de32eca71621c77494d5ccd284599e68.tar.gz dotty-d3f49de5de32eca71621c77494d5ccd284599e68.tar.bz2 dotty-d3f49de5de32eca71621c77494d5ccd284599e68.zip |
Added assertion that casts never go to singleton types.
Disabled for now, awaiting a fix.
Diffstat (limited to 'src/dotty/tools/dotc/transform/Erasure.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index 1cc00bdee..e5fd9d85d 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -133,7 +133,10 @@ object Erasure { /** Generate a synthetic cast operation from tree.tpe to pt. */ - def cast(tree: Tree, pt: Type)(implicit ctx: Context): Tree = + def cast(tree: Tree, pt: Type)(implicit ctx: Context): Tree = { + // TODO: The commented out assertion fails for tailcall/t6574.scala + // Fix the problem and enable the assertion. + // assert(!pt.isInstanceOf[SingletonType], pt) if (pt isRef defn.UnitClass) unbox(tree, pt) else (tree.tpe, pt) match { case (defn.ArrayType(treeElem), defn.ArrayType(ptElem)) @@ -144,6 +147,7 @@ object Erasure { ctx.log(s"casting from ${tree.showSummary}: ${tree.tpe.show} to ${pt.show}") mkAsInstanceOf(tree, pt) } + } /** Adaptation of an expression `e` to an expected type `PT`, applying the following * rewritings exhaustively as long as the type of `e` is not a subtype of `PT`. |