Skip to content

dead case field accessor call should be eliminated #6193

@scabug

Description

@scabug

while refining my fix for #5739, I discovered case field accessors are not considered pure -- or so it seems...

shouldn't the body of emptyMethod be completely empty when compiled with -optimize?

case class Foo(bla: Int, blaa: String)

class Test {
  val f = Foo(1, "1")
  // when compiled with -optimize, this method's body should be empty
  // however, both calls to the accessors survive (though they are not stored in local variables)
  def emptyMethod = {
    val x = f.bla // should be considered pure and be eliminated
    val y = f.blaa
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions