Perhaps a question for <#C013BA8EQSE|>, but how do...
# kotlin-inject
r
Perhaps a question for #C013BA8EQSE, but how do you debug this error?
Copy code
e: [ksp] java.lang.IllegalArgumentException: Error type '<ERROR TYPE>' is not resolvable in the current round of processing.
        at com.squareup.kotlinpoet.ksp.KsTypesKt.requireNotErrorType(KsTypes.kt:40)
        at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:71)
        at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:199)
        at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:196)
        at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName$default(KsTypes.kt:187)
        at me.tatarka.kotlin.ast.KSAstType.toTypeName(KSAst.kt:555)
        at me.tatarka.kotlin.ast.AstParam.toParameterSpec(Ast.kt:269)
        at me.tatarka.inject.compiler.InjectGenerator.generateInjectComponent(InjectGenerator.kt:118)
        at me.tatarka.inject.compiler.InjectGenerator.generate(InjectGenerator.kt:68)
        at me.tatarka.inject.compiler.ksp.ProcessInjectKt.process(ProcessInject.kt:80)
        at me.tatarka.inject.compiler.ksp.ProcessInjectKt.processInject(ProcessInject.kt:28)
        at me.tatarka.inject.compiler.ksp.ProcessInjectKt.processInject$default(ProcessInject.kt:19)
        at me.tatarka.inject.compiler.ksp.InjectProcessor.process$lambda$1(InjectProcessor.kt:55)
It’s likely that an
api
vs
implementation
dependency was misused. Is there an easy way to find out where this happens? E.g. print the file
z
in github.com/zacsweer/anvil I wrote a helper that basically requires you to provide an AstNode that can be reported with this if there's a failure. Someone else sent a PR that improved it to accept parameters and declarations too
not sure how best to support that in kotlinpoet directly but open to suggestions
r
I feel like similar to your approach this should be addressed in kotlin-inject?
I remember that KAPT had a flag to improve this type error
z
Kapt's is a little different because it's there to try to remap to the original kotlin source rather than the java stub that's normally reported
KI can def do the same approach. We could add an overload to KP to take an optional AstNode that it can report in a typed exception of some sort maybe? The main issue is that you need something to funnel that node to the eventual KSPLogger, which KP doesn't know anything about