google / ksp

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

[KSP2] Equality tests on types with declaration-site variance return different results #1778

Open kuanyingchou opened 8 months ago

kuanyingchou commented 8 months ago

Given a generic type with declaration-site variance like this:

interface BarIn<in T>

Types BarIn<in String> and BarIn<String> are the same in KSP2 but not in KSP1.

Repro: https://github.com/google/ksp/commit/904572fd590c5a3feff75cf31be6a614e8118a73

neetopia commented 8 months ago

They do look to be same type to me tbh, do you feel KSP1's behavior is more close to your expectation?

kuanyingchou commented 8 months ago

Got it. We can change the logic on our side (in Java codegen they're different). I think maybe the issue can be kept for documentation, but feel free to close it. Thanks!