Skip to content

Commit 9a070cd

Browse files
committed
better wording
1 parent 9b8d317 commit 9a070cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

2025_12_01_implicit_search_priority.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ println(c.doSomething()) // Prints "dep1:module, dep2:local" - not what we want
2727

2828
The problem was that `AppContextProvider[Dependency1]` defined in `Dependency1`'s companion object takes priority over the one extracted from `AppContextProviders`, because Scala's implicit search gives high priority to the companion object of the result type.
2929

30-
We had a workaround - `AppContextProviders.checkAllAreNeeded` - to detect such issues at compile time. But now we can solve the problem properly. I don't know why I missed this during writing a first variant, becouse now it looks obviously.
30+
We had a workaround - `AppContextProviders.checkAllAreNeeded` - to detect such issues at compile time. But now we can solve the problem properly. I don't know why I missed this during writing a first variant, now it looks trivial.
3131

3232
It turns out we can easy solve this problem by introducing an intermediate lookup type. If we search for a different type, which requere AppContextProvider[X], Scala compiler won't look in the companion object.
3333

0 commit comments

Comments
 (0)