You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Arrow Optics KSP plugin generates bad code for sealed hierarchies that contains nullable properties in the parent, but that becomes non-nullable in a child class.
This is a new issue with arrow-optics 1.2.2 that was not present in 1.1.5.
The following will generate code that does not compile in arrow-optics 1.2.2:
importarrow.optics.optics
@optics
sealedinterfaceBase {
val prop:String?companionobject
}
@optics
data classChild(overridevalprop:String) : Base {
companionobject
}
The generated bad code:
inlinevalBase.Companion.nullableProp:Lens<Base, String?>
inline get() =Lens(
get = { base:Base-> base.`prop` },
set = { base:Base, value:String?->when (base) {
isChild-> base.copy(`prop` = value) // value: String? cannot be passed to prop: String
}
},
)
The text was updated successfully, but these errors were encountered:
The Arrow Optics KSP plugin generates bad code for sealed hierarchies that contains nullable properties in the parent, but that becomes non-nullable in a child class.
This is a new issue with arrow-optics 1.2.2 that was not present in 1.1.5.
Library: io.arrow-kt:arrow-optics-ksp-plugin 1.2.2
Reproduction
The following will generate code that does not compile in arrow-optics 1.2.2:
The generated bad code:
The text was updated successfully, but these errors were encountered: