scala/scala@bfa1380#diff-6402881c68d306988091172b129869daad7519257b48d97d2632465789d7383a added handling for VarInsnNode at (new) line 744 of Inliner.scala but missed changing the IincInsnNode case just below.
Thus, IINC instructions aren't properly modified when their target is a parameter.
This was found while porting the optimizer to Scala 3, in which the following is a repro:
//> using options -opt-inline:**
object Test {
def foo(b: Option[Int]): Unit =
fooRec(x = 0, b)
private def fooRec(x: Int, b: Option[Int]): Unit = {
if (b.nonEmpty) {
fooRec(x + 1, b)
}
}
def main(args: Array[String]): Unit = {
foo(None)
}
}
I haven't actually tested it with scala2 but the underlying problem should also exist.
scala/scala@bfa1380#diff-6402881c68d306988091172b129869daad7519257b48d97d2632465789d7383a added handling for
VarInsnNodeat (new) line 744 ofInliner.scalabut missed changing theIincInsnNodecase just below.Thus, IINC instructions aren't properly modified when their target is a parameter.
This was found while porting the optimizer to Scala 3, in which the following is a repro:
I haven't actually tested it with scala2 but the underlying problem should also exist.