Skip to content

Side effects incorrectly elided by Erasure's handling of Unit #8666

Closed
@scabug

Description

@scabug

next code:

object A {
  val init = println("hello")
}

object Main {
  def main(args: Array[String]) {
      val a = A.init
  }
}

produces no output, but "hello" is expected.
This behaviour was observed when trying code described here http://stackoverflow.com/questions/24221601/scala-object-initialization

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions