Closed hoc081098 closed 2 months ago
still get error, but order is maintained in the reverse order I see 🤔
@Test
fun `allow overrides by type`() {
val app = koinApplication {
modules(
module {
single<Simple.ComponentInterface1> { Simple.Component2() }
},
module {
single<Simple.ComponentInterface1> { Simple.Component1() }
},
)
}
app.assertDefinitionsCount(1)
assertTrue(app.koin.get<Simple.ComponentInterface1>() is Simple.Component1)
}
Good thing is that order seems stable
Could test that with this test too:
@Test
fun test_flatten_list() {
(1..100).all { i ->
val modules = listOf(module { },module { },module { },module { },module { },module { },module { },module { },module { },module { })
val flatten = flatten(modules)
flatten.reversed() == modules
}
}
@arnaudgiuliani just updated
-ArrayDeque(modules)
+ArrayDeque(modules.asReversed())
Sounds good 🎉. Need to check the fails on test examples 🤔
Seen the problem. It's not from your side 👍 Will fix it
to maintain the insertion order