Closed matejdro closed 1 month ago
This error is either coming from kotlin-inject (I couldn't find the message though) or the Kotlin compiler itself. There isn't anything this project could do about it. We could check for contributed components and their methods, but then we'd need to rebuild everything kotlin-inject itself does internally. And even then it wouldn't be reliable, because the interfaces could be added manually and not through kotlin-inject-anvil to the final component.
Attempting to compile following code:
Will just fail with the unhelpful
InjectDemoComponent.kt:9:12 Type mismatch: inferred type is Int but String was expected
error.Issue stems from the fact that final merged component contains two methods that are both named
provideSomething
but they return different types. With Anvil allowing decentralized components across the projects, this is a case that could easily happen, where two developers unwittingly create a component with the same method name at two different places in the codebase.