kotlin-inject
kotlin-inject copied to clipboard
Bug in code generation for `@AssistedFactory`
I started to migrate a few lambda factories to interfaces and got Unresolved reference '_scoped'. It appears that components are not always cast to ScopedComponent when _scoped is accessed.
Thanks for the report, if you can share a component graph that reproduces the issue that'd help a lot
I have the same issue. My DI graph
I have Singleton scope
@Scope
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER)
annotation class Singleton
Have KmpComponent
@Singleton
@Component
abstract class KmpComponent {
@Provides
@Singleton
fun dependencyA(): A = AImpl()
}
interface A
class AImpl : A
Have DecomposeFactoryComponent
@Component
abstract class DecomposeFactoryComponent(parent: KmpComponent) {
abstract val factory: CreateFactory
}
@Inject
class B(@Assisted assisted: Boolean, a: A)
@AssistedFactory
interface CreateFactory {
fun create(
assisted: Boolean
): B
}
When run app got such error:
Argument type mismatch: actual type is 'MatchGroup?', but 'A' was expected.