-
-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Describe the bug
Using an @InjectedParam with some type that has nested type arguments (e.g. List<List<Int>>) causes incorrect generation of a lambda factory in the containing module. Probably related to #240 and #272 . I guess it's directly caused by this line:
Line 120 in b051006
| val typeArgs = if (it.type.arguments.isNotEmpty()) it.type.arguments.mapNotNull { it.type?.resolve()?.declaration?.qualifiedName?.asString() }.joinToString(",", prefix = "<", postfix = ">") else "" |
To Reproduce
Here's an MRE: https://github.com/Terenfear/koin-bug-reproducible-example. Just run :compileKotlinWasmJs or :compileAndroidMain.
Steps to reproduce the behavior:
- Create a class
@Single
class Foo(
@InjectedParam bar: List<List<String>>
)- Add it to some module using
@ComponentScan - Try to compile the app.
Alternatively, instead of writing an annotated class declare a provider function with an injected parameter in a module. The behavior is the same.
Expected behavior
No compilation error. The generated code looks something like this:
public val org_example_project_TestModule : Module get() = module {
single() { (bar : kotlin.collections.List<kotlin.collections.List<String>>) -> org.example.project.Foo(bar)}
}Actual behavior
A compilation error. It generates this code (notice a lack of the type argument of the second List):
public val org_example_project_TestModule : Module get() = module {
single() { (bar : kotlin.collections.List<kotlin.collections.List>) -> org.example.project.Foo(bar)}
}Koin project used and used version (please complete the following information):
koin-core version 4.1.1koin-annotations version 2.3.0koin-ksp-compiler version 2.3.0