From 4baa120dd02008b7dc9a684ae7a7ee7cac96932a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Mon, 19 Aug 2024 14:37:09 +0200 Subject: [PATCH] fix(abg): Use "a.to(b)" instead of "a to b" Or Kotlin Poet sometimes breaks before the "to" which is illegal. --- .../generation/Generation.kt | 4 +-- .../ActionWithAllTypesOfInputs.kt | 26 +++++++++---------- .../ActionWithDeprecatedInputAndNameClash.kt | 2 +- .../ActionWithFancyCharsInDocs.kt | 4 +-- .../ActionWithInputsSharingType.kt | 6 ++--- .../ActionWithNoTypings_Untyped.kt | 4 +-- .../ActionWithOutputs.kt | 2 +- .../ActionWithSomeOptionalInputs.kt | 10 +++---- .../SimpleActionWithRequiredStringInputs.kt | 4 +-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt index fae310210f..0a5e373988 100644 --- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt +++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt @@ -307,9 +307,9 @@ private fun Metadata.linkedMapOfInputs(inputTypings: Map): CodeB inputs.forEach { (key, value) -> val asStringCode = inputTypings.getInputTyping(key).asString() if (!value.shouldBeNonNullInBinding()) { - add("%N?.let { %S to it$asStringCode },\n", key.toCamelCase(), key) + add("%N?.let { %S.to(it$asStringCode) },\n", key.toCamelCase(), key) } else { - add("%S to %N$asStringCode,\n", key, key.toCamelCase()) + add("%S.to(%N$asStringCode),\n", key, key.toCamelCase()) } } add("*$CUSTOM_INPUTS.%M().%M(),\n", Types.mapToList, Types.listToArray) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt index 534b01aba3..2ed0096e95 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt @@ -130,19 +130,19 @@ public data class ActionWithAllTypesOfInputs private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "foo-bar" to fooBar, - "baz-goo" to bazGoo.toString(), - binKin?.let { "bin-kin" to it.toString() }, - "int-pint" to intPint.toString(), - "flo-pint" to floPint.toString(), - "fin-bin" to finBin.stringValue, - "goo-zen" to gooZen.integerValue.toString(), - "bah-enum" to bahEnum.stringValue, - listStrings?.let { "list-strings" to it.joinToString(",") }, - listInts?.let { "list-ints" to it.joinToString(",") { it.toString() } }, - listEnums?.let { "list-enums" to it.joinToString(",") { it.stringValue } }, - listIntSpecial?.let { "list-int-special" to it.joinToString(",") { - it.integerValue.toString() } }, + "foo-bar".to(fooBar), + "baz-goo".to(bazGoo.toString()), + binKin?.let { "bin-kin".to(it.toString()) }, + "int-pint".to(intPint.toString()), + "flo-pint".to(floPint.toString()), + "fin-bin".to(finBin.stringValue), + "goo-zen".to(gooZen.integerValue.toString()), + "bah-enum".to(bahEnum.stringValue), + listStrings?.let { "list-strings".to(it.joinToString(",")) }, + listInts?.let { "list-ints".to(it.joinToString(",") { it.toString() }) }, + listEnums?.let { "list-enums".to(it.joinToString(",") { it.stringValue }) }, + listIntSpecial?.let { "list-int-special".to(it.joinToString(",") { + it.integerValue.toString() }) }, *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt index eaee489740..d91fe3c5a8 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt @@ -57,7 +57,7 @@ public data class ActionWithDeprecatedInputAndNameClash private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "fooBar" to fooBar, + "fooBar".to(fooBar), *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt index 373d952812..0a92c99c06 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt @@ -64,8 +64,8 @@ public data class ActionWithFancyCharsInDocs private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - nestedKotlinComments?.let { "nested-kotlin-comments" to it }, - percent?.let { "percent" to it }, + nestedKotlinComments?.let { "nested-kotlin-comments".to(it) }, + percent?.let { "percent".to(it) }, *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt index 032de99e1c..9d484fa141 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt @@ -59,9 +59,9 @@ public data class ActionWithInputsSharingType private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "foo-one" to fooOne.integerValue.toString(), - "foo-two" to fooTwo.integerValue.toString(), - fooThree?.let { "foo-three" to it.integerValue.toString() }, + "foo-one".to(fooOne.integerValue.toString()), + "foo-two".to(fooTwo.integerValue.toString()), + fooThree?.let { "foo-three".to(it.integerValue.toString()) }, *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt index 9fe30ca92c..b1ee741610 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt @@ -74,8 +74,8 @@ public data class ActionWithNoTypings_Untyped private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "foo" to foo, - bar?.let { "bar" to it }, + "foo".to(foo), + bar?.let { "bar".to(it) }, *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt index a928288b04..3de4aa892c 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt @@ -57,7 +57,7 @@ public data class ActionWithOutputs private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "foo-bar" to fooBar, + "foo-bar".to(fooBar), *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt index 48ac216cad..0dbd11d3e1 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt @@ -82,11 +82,11 @@ public data class ActionWithSomeOptionalInputs private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - fooBar?.let { "foo-bar" to it }, - bazGoo?.let { "baz-goo" to it }, - zooDar?.let { "zoo-dar" to it }, - cooPoo?.let { "coo-poo" to it }, - "package" to `package`, + fooBar?.let { "foo-bar".to(it) }, + bazGoo?.let { "baz-goo".to(it) }, + zooDar?.let { "zoo-dar".to(it) }, + cooPoo?.let { "coo-poo".to(it) }, + "package".to(`package`), *_customInputs.toList().toTypedArray(), ).toTypedArray() ) diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt index bc2daa899d..865b2027b8 100644 --- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt +++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt @@ -70,8 +70,8 @@ public data class SimpleActionWithRequiredStringInputs private constructor( @Suppress("SpreadOperator") override fun toYamlArguments(): LinkedHashMap = linkedMapOf( *listOfNotNull( - "foo-bar" to fooBar, - "baz-goo" to bazGoo, + "foo-bar".to(fooBar), + "baz-goo".to(bazGoo), *_customInputs.toList().toTypedArray(), ).toTypedArray() )