Skip to content

Commit

Permalink
fix(abg): Use "a.to(b)" instead of "a to b"
Browse files Browse the repository at this point in the history
Or Kotlin Poet sometimes breaks before the "to" which is illegal.
  • Loading branch information
Vampire committed Aug 20, 2024
1 parent f9ac222 commit 4baa120
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ private fun Metadata.linkedMapOfInputs(inputTypings: Map<String, Typing>): 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ public data class ActionWithAllTypesOfInputs private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = 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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public data class ActionWithDeprecatedInputAndNameClash private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"fooBar" to fooBar,
"fooBar".to(fooBar),
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public data class ActionWithFancyCharsInDocs private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = 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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public data class ActionWithInputsSharingType private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = 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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public data class ActionWithNoTypings_Untyped private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"foo" to foo,
bar?.let { "bar" to it },
"foo".to(foo),
bar?.let { "bar".to(it) },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public data class ActionWithOutputs private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"foo-bar" to fooBar,
"foo-bar".to(fooBar),
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public data class ActionWithSomeOptionalInputs private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = 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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public data class SimpleActionWithRequiredStringInputs private constructor(
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"foo-bar" to fooBar,
"baz-goo" to bazGoo,
"foo-bar".to(fooBar),
"baz-goo".to(bazGoo),
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
Expand Down

0 comments on commit 4baa120

Please sign in to comment.