diff options
author | Dmitry Petrashko <dark@d-d.me> | 2014-12-12 17:42:45 +0100 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2014-12-12 17:42:45 +0100 |
commit | 1ce4c34c65ada5eb6c42fb72a03171467c08ee9b (patch) | |
tree | 38ab3f48395e25878fa22c98b13ed0b80909b763 /src | |
parent | 95ef88f79d4560dde676db9a2439c89a7f9c582a (diff) | |
parent | 0b82c376e771e493e4d595bf22b478790f7b5166 (diff) | |
download | dotty-1ce4c34c65ada5eb6c42fb72a03171467c08ee9b.tar.gz dotty-1ce4c34c65ada5eb6c42fb72a03171467c08ee9b.tar.bz2 dotty-1ce4c34c65ada5eb6c42fb72a03171467c08ee9b.zip |
Merge pull request #265 from dotty-staging/fix/type-seqliteral
Pass right prototype to SeqLiteral elements.
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 | 4 |
2 files changed, 9 insertions, 2 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 1cf0583dc..0c81b81d0 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -387,6 +387,10 @@ object Erasure extends TypeTestsCasts{ } } + override def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context) = + 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 = super.typedValDef(untpd.cpy.ValDef(vdef)( tpt = untpd.TypedSplice(TypeTree(sym.info).withPos(vdef.tpt.pos))), sym) |