google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.83k stars 265 forks source link

Variance is missing after asMemberOf call #1969

Open kuanyingchou opened 3 months ago

kuanyingchou commented 3 months ago

This is a KSP1 issue. When a Java field is of a generic Kotlin type with declaration site variance, its wildcard is lost after asMemberOf call. For example, the type of the field A<? extends Number> a; becomes (A<(Number..Number?)>..A<(Number..Number?)>?) instead of (A<out (Number..Number?)>..A<out (Number..Number?)>?), where A is defined as interface A<out T>.

Repro: https://github.com/kuanyingchou/ksp/commit/8b1075bf3839732fcacbf9d95919c96ab345784f