bug icon indicating copy to clipboard operation
bug copied to clipboard

Avoid lifting try block in argument of static method into separate methods

Open lrytz opened this issue 7 years ago • 2 comments

Suggested in https://github.com/scala/scala/pull/7312#issuecomment-430893978

class C {
  def b = 0
  def t = java.util.Collections.singletonList(try b catch { case _: ClassCastException => b })
}

The argument is lifted into a method by uncurry, but that's not necessary as there's no value on the stack.

lrytz avatar Oct 18 '18 13:10 lrytz

(Not sure what the right label is to apply here — "backend" typically refers to GenBCode, but uncurry is somewhere in the "middle end".)

SethTisue avatar Jan 26 '24 23:01 SethTisue

Fixed in Scala 3 by https://github.com/lampepfl/dotty/pull/18619

sjrd avatar Jan 26 '24 23:01 sjrd