Skip to content

Multiple nested object initialization deadlock #9428

@scabug

Description

@scabug

Repro case below

import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global

trait Foo {
  def a = Inner.a
  private[this] object Inner { val a = 1 }
}

trait Bar { self: Foo =>
  def b = Inner.b
  private[this] object Inner {
    val b = Await.result(Future(a), 1.seconds)
  }
}

object Baz extends Foo with Bar {
  val c = 1
}

object Main extends App {
  println(Baz.c)
  println(Baz.b) // Throws timeout here
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions