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

[KSP2] Kotlin Function* types reports inconsistent package and qualified names #1845

Closed
ZacSweers opened this issue Apr 17, 2024 · 0 comments · Fixed by #1873
Closed

[KSP2] Kotlin Function* types reports inconsistent package and qualified names #1845

ZacSweers opened this issue Apr 17, 2024 · 0 comments · Fixed by #1873
Labels
bug Something isn't working
Milestone

Comments

@ZacSweers
Copy link
Contributor

Given a function signature like so

fun example(input: Function0<String>) {

}

In KSP2, the Function0 type here reports the following information in its KSClassDeclaration:

  • packageName resolves to kotlin.jvm.functions
  • qualifiedName resolves to kotlin.Function0
  • simpleName resolves to Function0

(typeOf<Function0<*>>().classifier as KClass<*>).qualifiedName reports kotlin.Function0, but the declaration is defined in the stdlib at kotlin.jvm.functions.Function0.

I'm not sure what the right answer is for this, but more importantly it's also unclear what a code generator (such as KotlinPoet) should use when mapping the type to something like a KotlinPoet TypeName representation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants