Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unhandled cyclic dependency #582

Closed
xerial opened this issue Aug 8, 2019 · 2 comments
Closed

Unhandled cyclic dependency #582

xerial opened this issue Aug 8, 2019 · 2 comments
Assignees
Milestone

Comments

@xerial
Copy link
Member

xerial commented Aug 8, 2019

reported by @takezoe https://gist.github.com/takezoe/4bfcea77ed53885059f279b35f333733

@xerial
Copy link
Member Author

xerial commented Jan 2, 2020

A reproduction of this issue:

trait A {
  val b = bind[B]
} 
trait B {
  val a = bind[A]
}

The current bind[_] impl doesn't pass the seen surface list between trait object factories.

  • session.getOrElse(Surface.of[A], objectFactory: () => new A with DISupport)
  • buildInstance: call the objectFacotry for A
  • During the initialization of A, bind[B] is called
    • session.getOrElse(Surface.of[B], objectFactory: () => new B with DISupport)
  • buildIntance: call the objectFactory for B <-- This part needs to know B is created while building A
  • During the initialization of B, bind[A] is called (cyclic)

@xerial xerial self-assigned this Jan 2, 2020
xerial added a commit to xerial/airframe that referenced this issue Jan 2, 2020
xerial added a commit to xerial/airframe that referenced this issue Jan 2, 2020
@xerial xerial added this to the Airframe 20 milestone Mar 17, 2020
@xerial xerial mentioned this issue Dec 4, 2020
90 tasks
@xerial xerial modified the milestones: Airframe 20, Airframe 21 Dec 4, 2020
@xerial
Copy link
Member Author

xerial commented Sep 5, 2021

As we will deprecate in-trait binding from Scala3, we don't need to address this issue.

@xerial xerial added wontfix and removed help wanted labels Sep 5, 2021
@xerial xerial closed this as completed Sep 5, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant