Describe the bug
The order of modules after flattened is wrong.
Koin module and version:
koin-core:4.0.0
Snippet:
interface ComponentInterface1
class Component1 : ComponentInterface1
class Component2 : ComponentInterface1
val m1 = module {
single<Simple.ComponentInterface1> { Simple.Component1() }
}
val m2 = module {
single<Simple.ComponentInterface1> { Simple.Component2() }
}
val m3 = module { includes(m1, m2) }
val app = koinApplication {
modules(m3)
}
val koin = app.koin
val component = koin.get<Simple.ComponentInterface1>()
assertTrue { component is Simple.Component2 } // this fails
Expected behavior
This is because when m3 gets flattened, we get modules in order m3, m2, m1, the expected order is m3, m1, m2.
Describe the bug
The order of modules after flattened is wrong.
Koin module and version:
koin-core:4.0.0Snippet:
Expected behavior
This is because when
m3gets flattened, we get modules in orderm3, m2, m1, the expected order ism3, m1, m2.