File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -367,8 +367,11 @@ class TypeApplications(val self: Type) extends AnyVal {
367
367
}
368
368
369
369
/** The element type of a sequence or array */
370
- def elemType (implicit ctx : Context ): Type =
371
- firstBaseArgInfo(defn.SeqClass ) orElse firstBaseArgInfo(defn.ArrayClass )
370
+ def elemType (implicit ctx : Context ): Type = self match {
371
+ case defn.ArrayType (elemtp) => elemtp
372
+ case JavaArrayType (elemtp) => elemtp
373
+ case _ => firstBaseArgInfo(defn.SeqClass )
374
+ }
372
375
373
376
/** Given a type alias
374
377
*
Original file line number Diff line number Diff line change @@ -387,6 +387,10 @@ object Erasure extends TypeTestsCasts{
387
387
}
388
388
}
389
389
390
+ override def typedSeqLiteral (tree : untpd.SeqLiteral , pt : Type )(implicit ctx : Context ) =
391
+ super .typedSeqLiteral(tree, erasure(tree.typeOpt))
392
+ // proto type of typed seq literal is original type; this makes elements be adapted to correct type.
393
+
390
394
override def typedValDef (vdef : untpd.ValDef , sym : Symbol )(implicit ctx : Context ): ValDef =
391
395
super .typedValDef(untpd.cpy.ValDef (vdef)(
392
396
tpt = untpd.TypedSplice (TypeTree (sym.info).withPos(vdef.tpt.pos))), sym)
You can’t perform that action at this time.
0 commit comments