Skip to content

Commit 47916ad

Browse files
committed
Generalize NewWithArgs
I noted another useless boxing (in Positioned.scala), where we have ``` (new Span(x): Span).coord ``` The allocation should be eliminated but was not.
1 parent d4cd2c0 commit 47916ad

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ object TreeExtractors {
2424
def unapply(t: Tree)(using Context): Option[(Type, List[Tree])] = t match {
2525
case Apply(Select(New(_), nme.CONSTRUCTOR), args) =>
2626
Some((t.tpe, args))
27+
case Typed(expr, _) => unapply(expr)
28+
case Block(Nil, expr) => unapply(expr)
2729
case _ =>
2830
None
2931
}

0 commit comments

Comments
 (0)