[Parcelize] WriteWith Parceler type argument must be subtype of property

K2 checks that the entire Parceler of the WriteWith annotation is a
subtype of the expected Parceler for the property, while K1 only checks
that the type argument of the WriteWith Parceler is a subtype of the
property type. This mismatch leads to inconsistencies between K1 and K2
diagnostic reporting. Switch K2 to K1 behavior so diagnostics are
consistent.

^KT-60019 Fixed
This commit is contained in:
Brian Norman
2024-01-15 09:16:35 -06:00
committed by Space Team
parent be9805ea5e
commit 20340f94d4
5 changed files with 34 additions and 94 deletions
@@ -30,10 +30,10 @@ object Parceler3 : Parceler<String> {
@Parcelize
@TypeParceler<String, Parceler2>
data class Test(
val a: String,
@<!REDUNDANT_TYPE_PARCELER!>TypeParceler<!><String, Parceler1> val b: String,
@TypeParceler<String, Parceler3> val c: CharSequence,
val d: @WriteWith<Parceler3> String
val a: String,
@<!REDUNDANT_TYPE_PARCELER!>TypeParceler<!><String, Parceler1> val b: String,
@TypeParceler<String, Parceler3> val c: CharSequence,
val d: @WriteWith<Parceler3> String
) : Parcelable
fun box() = parcelTest { parcel ->