diff --git a/build.gradle.kts b/build.gradle.kts index 7a14f0e..e23a6af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ apply(plugin = "io.github.gradle-nexus.publish-plugin") allprojects { group = "io.exoquery" - version = "0.1.214" + version = "0.1.215" apply(plugin = "kotlin") apply(plugin = "maven-publish") diff --git a/decomat-ksp/src/main/kotlin/io/decomat/DecomatProcessor.kt b/decomat-ksp/src/main/kotlin/io/decomat/DecomatProcessor.kt index 60bdd31..5bfe777 100644 --- a/decomat-ksp/src/main/kotlin/io/decomat/DecomatProcessor.kt +++ b/decomat-ksp/src/main/kotlin/io/decomat/DecomatProcessor.kt @@ -405,21 +405,9 @@ class DecomatProcessor( val adtFunctions = """ - class CopyEager${className}${genericBlock}(${allMembers.map { "val ${it.fieldName}: ${it.field.type.toString()}" }.commaSep()}) { - operator fun invoke(original: ${model.parametrizedName}) = - original.copy(${allMembers.map { "${it.fieldName} = ${it.fieldName}" }.commaSep()}) - } - fun ${genericBlock} ${companionName}.Companion.${fromFunctionName}Eager(${memberKeyValues}) = CopyEager${className}(${allMembers.map { it.fieldName }.commaSep()}) - context(${model.parametrizedName}) fun ${genericBlock} ${companionName}.Companion.${fromHereFunctionName}Eager(${memberKeyValues}) = - CopyEager${className}(${allMembers.map { it.fieldName }.commaSep()}).invoke(this@${className}) - - class Copy${className}${genericBlock}(${allMembers.map { "val ${it.fieldName}: ${it.field.type.toString()}" }.commaSep()}) { operator fun invoke(original: ${model.parametrizedName}) = - if (${allMembers.map {"original.${it.fieldName} == ${it.fieldName}"}.joinToString(" && ")}) - original - else - original.copy(${allMembers.map { "${it.fieldName} = ${it.fieldName}" }.commaSep()}) + original.copy(${allMembers.map { "${it.fieldName} = ${it.fieldName}" }.commaSep()}) } // Helper function for ADTs that allows you to easily copy the element mentioning only the properties you care about