Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a test case to reproduce the typealias lambda issue in KSP2 #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kevinguitar
Copy link

@kevinguitar kevinguitar commented Dec 6, 2024

Based on the section in FORK.md, we're trying out KSP2 with Dagger kapt, and we ran into this error:

e: [ksp] The parameters in the factory method must match the @assisted parameters in com.bandlab.playlist.views.CollectionPlayerViewModel.

It's caused by typealias lambda, attaching the code snippet

class CollectionPlayerViewModel @AssistedInject constructor(
    @Assisted private val onCollectionPlayClickListener: OnCollectionPlayClickListener?,
) {
    // ...
    
    @AssistedFactory
    interface Factory {
        fun create(
            // ...
            onCollectionPlayClickListener: OnCollectionPlayClickListener? = null
        ): CollectionPlayerViewModel
    }
}

typealias OnCollectionPlayClickListener = () -> Unit

I'm not sure where the issue resides, it's either on the KSP side or Anvil, but I couldn't find a relevant issue about typealias lambda in KSP repo. I went through the AssistedFactoryGeneratorTest, and I didn't see any test cases related to typealias lambda parameter, so I added one test case. Although it's passing currently, I think maybe it's still worth having it for #22?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant