Skip to content

Commit 3c4c4ed

Browse files
committed
Add update note about fixed implicit search priority problem
1 parent 9a070cd commit 3c4c4ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

2024_12_09_dependency-injection.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ println(c3.doSomething())
347347

348348
What will be printed?
349349

350-
The correct answer is `“dep1:module:dep2:local”`, because resolving of `Dependency1` from the companion object will be preferred over resolving from the `AppContextProvider` companion object. Unfortunately, I don’t know how to change this.
350+
The correct answer is `"dep1:module:dep2:local"`, because resolving of `Dependency1` from the companion object will be preferred over resolving from the `AppContextProvider` companion object. Unfortunately, I don't know how to change this.
351+
352+
**UPD (2025-12-01):** This problem is now fixed by introducing `AppContextProviderLookup` - an intermediate type that changes the implicit search order. See [Solving the Implicit Search Priority Problem](https://github.com/rssh/notes/blob/master/2025_12_01_implicit_search_priority.md) for details. The workaround described below (`checkAllAreNeeded`) is no longer needed and has been removed.
351353

352354
We can add a check to determine whether supplied providers are needed. Again, unfortunately, we can’t add it ‘behind the scenes' by modifying the generator of `AppContextProvider` because the generator is inlined in the caller context for the component instance, where all dependencies should be resolved.
353355
We can write a macro that should be called from the context inside a component definition. This will require the developer to call it explicitly.

0 commit comments

Comments
 (0)