Skip to content

Commit 73a8c83

Browse files
committed
Only strip the type ascription
1 parent f3beaa8 commit 73a8c83

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/src/dotty/tools/dotc/transform/ArrayApply.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class ArrayApply extends MiniPhase {
2525
override def transformApply(tree: tpd.Apply)(implicit ctx: Context): tpd.Tree = {
2626
if (tree.symbol.name == nme.apply && tree.symbol.owner == defn.ArrayModule) { // Is `Array.apply`
2727
tree.args match {
28-
case CleanTree(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: ct :: Nil
28+
case StripAscription(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: ct :: Nil
2929
if defn.WrapArrayMethods().contains(wrapRefArrayMeth.symbol) && elideClassTag(ct) =>
3030
seqLit
3131

32-
case elem0 :: CleanTree(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: Nil
32+
case elem0 :: StripAscription(Apply(wrapRefArrayMeth, (seqLit: tpd.JavaSeqLiteral) :: Nil)) :: Nil
3333
if defn.WrapArrayMethods().contains(wrapRefArrayMeth.symbol) =>
3434
tpd.JavaSeqLiteral(elem0 :: seqLit.elems, seqLit.elemtpt)
3535

@@ -63,9 +63,8 @@ class ArrayApply extends MiniPhase {
6363
case _ => false
6464
}
6565

66-
object CleanTree {
66+
object StripAscription {
6767
def unapply(tree: Tree)(implicit ctx: Context): Some[Tree] = tree match {
68-
case Block(Nil, expr) => unapply(expr)
6968
case Typed(expr, _) => unapply(expr)
7069
case _ => Some(tree)
7170
}

0 commit comments

Comments
 (0)