diff options
author | Paul Phillips <paulp@improving.org> | 2011-11-19 08:39:59 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-11-19 08:39:59 +0000 |
commit | 214c145943ac2c6bf37bd40f5e07e225350201c5 (patch) | |
tree | 9ae086954e4e855e9561bbef0b812d34c82d967c /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 334872e33be8385678697f3d670c8102d38cdca7 (diff) | |
download | scala-214c145943ac2c6bf37bd40f5e07e225350201c5.tar.gz scala-214c145943ac2c6bf37bd40f5e07e225350201c5.tar.bz2 scala-214c145943ac2c6bf37bd40f5e07e225350201c5.zip |
Cleanups in TypeApply creation and casting.
There's every hint that it's a requirement that a TypeApply have
non-empty typeArgs, but testing for and handling the empty condition
is done irregularly. Made a mkTypeApply which handles the isEmpty case
(returning "fun" unchanged.) Also unified most of the variations of
casts under one umbrella. Review by moors.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 65eb6466df..41e0819fe2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1913,12 +1913,8 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { if (!context.savedTypeBounds.isEmpty) { body1.tpe = context.restoreTypeBounds(body1.tpe) if (isFullyDefined(pt) && !(body1.tpe <:< pt)) { - body1 = - typed { - atPos(body1.pos) { - TypeApply(Select(body1, Any_asInstanceOf), List(TypeTree(pt))) // @M no need for pt.normalize here, is done in erasure - } - } + // @M no need for pt.normalize here, is done in erasure + body1 = typedPos(body1.pos)(gen.mkCast(body1, pt)) } } // body1 = checkNoEscaping.locals(context.scope, pt, body1) |