Skip to content

Commit

Permalink
Generalize NewWithArgs
Browse files Browse the repository at this point in the history
I noted another useless boxing (in Positioned.scala), where we have
```
  (new Span(x): Span).coord
```
The allocation should be eliminated but was not.
  • Loading branch information
odersky committed Jul 23, 2020
1 parent d4cd2c0 commit 47916ad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/TreeExtractors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ object TreeExtractors {
def unapply(t: Tree)(using Context): Option[(Type, List[Tree])] = t match {
case Apply(Select(New(_), nme.CONSTRUCTOR), args) =>
Some((t.tpe, args))
case Typed(expr, _) => unapply(expr)
case Block(Nil, expr) => unapply(expr)
case _ =>
None
}
Expand Down

0 comments on commit 47916ad

Please sign in to comment.