Skip to content

Optimizer: Tuple copy and copy$default are not inlined #11669

Open
@lrytz

Description

@lrytz

This could probably be improved

class C {
   final def f = {
      val tup = (1, 2)
      tup.copy(_1 = 3)
   }
}
$> scalac Test.scala -opt:l:inline '-opt-inline-from:**' -opt-warnings:_
Test.scala:4: warning: there was a problem determining if method copy$default$2 can be inlined:
No inline information for method scala/Tuple2$mcII$sp::copy$default$2()Ljava/lang/Object; could be found.
      tup.copy(_1 = 3)
          ^
one warning found
$> cfr-decompiler C.class
public class C {
    public final Tuple2<Object, Object> f() {
        Tuple2$mcII$sp tup = new Tuple2$mcII$sp(1, 2);
        return tup.copy$mIIc$sp(3, BoxesRunTime.unboxToInt(((Tuple2)tup).copy$default$2()));
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions