diff options
author | Martin Odersky <odersky@gmail.com> | 2014-12-05 16:29:05 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-12-05 16:29:13 +0100 |
commit | 0b82c376e771e493e4d595bf22b478790f7b5166 (patch) | |
tree | fd476318fd38756d367eb5659ccfac8210f92880 /src | |
parent | 042cee21d2d12445d728b19b896a75ba4a4a7bd9 (diff) | |
download | dotty-0b82c376e771e493e4d595bf22b478790f7b5166.tar.gz dotty-0b82c376e771e493e4d595bf22b478790f7b5166.tar.bz2 dotty-0b82c376e771e493e4d595bf22b478790f7b5166.zip |
Better typing of seqLiteral in erasure.
Fixed two problems with previous commit.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index d00b018c8..874928fcc 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -367,8 +367,11 @@ class TypeApplications(val self: Type) extends AnyVal { } /** The element type of a sequence or array */ - def elemType(implicit ctx: Context): Type = - firstBaseArgInfo(defn.SeqClass) orElse firstBaseArgInfo(defn.ArrayClass) + def elemType(implicit ctx: Context): Type = self match { + case defn.ArrayType(elemtp) => elemtp + case JavaArrayType(elemtp) => elemtp + case _ => firstBaseArgInfo(defn.SeqClass) + } /** Given a type alias * diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index f27fea673..fe8f86722 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -375,7 +375,7 @@ object Erasure extends TypeTestsCasts{ } override def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context) = - super.typedSeqLiteral(tree, tree.typeOpt) + super.typedSeqLiteral(tree, erasure(tree.typeOpt)) // proto type of typed seq literal is original type; this makes elements be adapted to correct type. override def typedValDef(vdef: untpd.ValDef, sym: Symbol)(implicit ctx: Context): ValDef = |