When I attempt to annotate these class with @CopyExtensions and have one depend on the other via nullable type
@CopyExtensions data class Person(val name: String, val passport: Passport?)
@CopyExtensions data class Passport(val id: String, val countryCode: String)
Then I get the following compilation error
e: /.../build/generated/ksp/main/kotlin/.../com....Person$Mutable.kt: (24, 13):
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Passport?
The compilation error in generated code is on the fun Person.toMutable. 'passport' is a nullable type.
@`Person$DslMarker`
public class `Person$Mutable`(
public var name: String,
public var passport: `Passport$Mutable`,
public val old: Person,
)
public fun `Person$Mutable`.freeze(): Person = com.a.b.c.Person(name =
name, passport = passport.freeze())
public fun Person.toMutable(): `Person$Mutable` =
com.a.b.c.`Person$Mutable`(
old = this,
name = name,
passport = passport.toMutable()
)
public inline fun Person.copy(block: `Person$Mutable`.() -> Unit): Person =
toMutable().apply(block).freeze()
Note
The following compiles correctly
@CopyExtensions data class Person(val name: String, val passport: Passport?)
data class Passport(val id: String, val countryCode: String)
Given these gradle settings
When I attempt to annotate these class with @CopyExtensions and have one depend on the other via nullable type
Then I get the following compilation error
The compilation error in generated code is on the fun Person.toMutable. 'passport' is a nullable type.
Note The following compiles correctly