diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-28 18:30:12 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-28 18:30:12 +0200 |
commit | 11ffd9ed2df33299351fdb2db7bccbafa3806a0b (patch) | |
tree | 3baf55b1d4058b81ee1a7cbfa27ee678ff95087e | |
parent | cdaa3a0249977bc2a9eb385fb840d62e01273f71 (diff) | |
download | dotty-11ffd9ed2df33299351fdb2db7bccbafa3806a0b.tar.gz dotty-11ffd9ed2df33299351fdb2db7bccbafa3806a0b.tar.bz2 dotty-11ffd9ed2df33299351fdb2db7bccbafa3806a0b.zip |
Avoid writing ExprTypes in result types of DefDefs
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 7208d4560..a9b1f1197 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -192,7 +192,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val params = (paramNames, paramTypes).zipped.map(valueParam) val (paramss, rtp) = valueParamss(tp.instantiate(params map (_.termRef))) (params :: paramss, rtp) - case tp => (Nil, tp) + case tp => (Nil, tp.widenExpr) } val (vparamss, rtp) = valueParamss(mtp) val targs = tparams map (_.typeRef) @@ -563,8 +563,10 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def isInstance(tp: Type)(implicit ctx: Context): Tree = tree.select(defn.Any_isInstanceOf).appliedToType(tp) - def asInstance(tp: Type)(implicit ctx: Context): Tree = + def asInstance(tp: Type)(implicit ctx: Context): Tree = { + assert(tp.isValueType, i"bad cast: $tree.asInstanceOf[$tp]") tree.select(defn.Any_asInstanceOf).appliedToType(tp) + } def ensureConforms(tp: Type)(implicit ctx: Context): Tree = if (tree.tpe <:< tp) tree else asInstance(tp) |