Weaver
Weaver copied to clipboard
Crash when dependency cycle allowed with self reference
There's a case where Weaver allows for a dependency cycle to be built even though the code crashes at runtime.
class App {
// weaver: foo = Foo
// weaver: bar = Bar
}
class Foo {
// weaver: bar <- Bar
// self reference causing Weaver to accept the cycle foo <-> bar.
// weaver: foo <- Foo
}
class Bar {
// weaver: foo <- Foo
}
Because foo and bar are built outside of the dependency cycle, the self reference doesn't break that cycle. Weaver should detect that and output an error.
@trupin I have same case, can do you provide small recommendations, how to break this cycles? I try to configure VIPER with this DI, moving from Typhoon DI. And I have presenter which resolve viewInput protocol, and view which resolving ViewOutput protocol and got cycloramic dependency. I tried to make weak scope in registration, and others variants with reference but nothing help.