flatten module order error#1999
Merged
arnaudgiuliani merged 1 commit intoInsertKoinIO:4.1.2from Sep 10, 2025
Merged
Conversation
14e9754 to
0a30953
Compare
0a30953 to
05c7a11
Compare
05c7a11 to
3640db9
Compare
Member
|
I don't see other feedback on that. Let's reopen if needed in 4.2 |
Contributor
Author
the test can illustrate the issue clearly. Without the fix, the result will be m3, m2, m1, which is obviously wrong. |
Contributor
Author
|
Let me explain it in a more practical case: interface Cryptographer {
fun encrypt()
fun decrypt()
}
// implement in common
class SoftwareImplement : Cryptographer
expect val platformCryptographerModule: Module
val cryptographerModule = module {
singleOf(::SoftwareImplement) binds Cryptographer::class
}
// implement in android & iOS
class HarewareAccelerator : Cryptographer
// in androidMain & iOSMain
actual val platformCryptographerModule = module {
singleOf(::HarewareAccelerator) binds Cryptographer::class
}
val appModule = module {
includes(
cryptographerModule,
platformCryptographerModule,
)
}
// without the fix, the result will be
koin.get<Cryptographer>() is SoftwareImplementOf course, if I know the issue, or I just prefer the following usage: val cryptographerModule = module {
singleOf(::SoftwareImplement) binds Cryptographer::class
includes(platformCryptographerModule)
}
val appModule = module {
includes(
cryptographerModule,
)
}
// no problem
koin.get<Cryptographer>() is HarewareAcceleratorThis can cause an issue only when we include two modules, and they contain some overrided parts. This maybe the reason why there is no other feedback. |
Member
|
After re-evaluation let's take it back to 4.1.2 👍 |
|
@arnaudgiuliani Will 4.1.2 be released anytime soon? |
Member
|
4.1.2 has been merged into 4.2 because of some more impactful changes. See 4.2.0 Milestone around 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1998