Open luozejiaqun opened 1 month ago
Describe the bug The order of modules after flattened is wrong.
Koin module and version: koin-core:4.0.0
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.
m3
m3, m2, m1
m3, m1, m2
any regression over 3.5?
@arnaudgiuliani 3.5 works fine. The module flattening refactor in 4.0 introduced this issue.
Describe the bug The order of modules after flattened is wrong.
Koin module and version:
koin-core:4.0.0
Snippet:
Expected behavior This is because when
m3
gets flattened, we get modules in orderm3, m2, m1
, the expected order ism3, m1, m2
.