Repository: cashapp/redwood
Pull request #899 (2023-04-06 10:12:37)

Update dependency com.squareup:kotlinpoet to v1.13.0
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.squareup:kotlinpoet](https://togithub.com/square/kotlinpoet) | `1.12.0` -> `1.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.squareup:kotlinpoet/1.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.squareup:kotlinpoet/1.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.squareup:kotlinpoet/1.13.0/compatibility-slim/1.12.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.squareup:kotlinpoet/1.13.0/confidence-slim/1.12.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>square/kotlinpoet</summary>

### [`v1.13.0`](https://togithub.com/square/kotlinpoet/releases/tag/1.13.0)

[Compare Source](https://togithub.com/square/kotlinpoet/compare/1.12.0...1.13.0)

##### What's Changed

-   New: Kotlin 1.8.0.
-   New: KSP 1.8.0-1.0.9.
-   New: Support context receivers on TypeSpecs + extract ContextReceivable API ([#&#8203;1269](https://togithub.com/square/kotlinpoet/issues/1269)).
-   New: Optimize `OriginatingElements` and `TagMap` implementations ([#&#8203;1270](https://togithub.com/square/kotlinpoet/issues/1270)).
-   New: Auto-generate import aliases for types and members ([#&#8203;1355](https://togithub.com/square/kotlinpoet/issues/1355)).
-   New: Insert underscores into large decimal literals ([#&#8203;1384](https://togithub.com/square/kotlinpoet/issues/1384)).
-   New: New factory function `FileSpec.builder(ClassName)` ([#&#8203;1397](https://togithub.com/square/kotlinpoet/issues/1397)).
-   Fix: Fix StackOverflowError when calling `KSTypeArgument.toTypeName()` for a wildcard in a recursive type bound ([#&#8203;1272](https://togithub.com/square/kotlinpoet/issues/1272)).
-   Fix: Fix transitive aliases ([#&#8203;1306](https://togithub.com/square/kotlinpoet/issues/1306)).
-   Fix: Fix Aliases as TypeArgument ([#&#8203;1321](https://togithub.com/square/kotlinpoet/issues/1321)).
-   Fix: Don't escape special characters inside raw strings ([#&#8203;1331](https://togithub.com/square/kotlinpoet/issues/1331)).
-   Fix: Fix KSP interop's output of the annotation parameter value of type Char ([#&#8203;1338](https://togithub.com/square/kotlinpoet/issues/1338)).
-   Fix: Fix KSP interop's output for primitive arrays ([#&#8203;1340](https://togithub.com/square/kotlinpoet/issues/1340)).
-   Fix: Avoid emitting public if `shouldEmitPublicModifier` returns false ([#&#8203;1342](https://togithub.com/square/kotlinpoet/issues/1342)).
-   Fix: Fix context receivers being rendered in an incorrect position when on a nullable/suspending `LambdaTypeName` ([#&#8203;1454](https://togithub.com/square/kotlinpoet/issues/1454)).
-   Fix: Do not use `bestGuess` for `KClass.asClassName` ([#&#8203;1469](https://togithub.com/square/kotlinpoet/issues/1469)).
-   Fix: Handle fake nested types with platform mapped parents ([#&#8203;1472](https://togithub.com/square/kotlinpoet/issues/1472)).
-   Fix: Fix `TypeName` equals ([#&#8203;1477](https://togithub.com/square/kotlinpoet/issues/1477)).
-   Fix: Make equals consistent with compareTo for `ClassName` ([#&#8203;1506](https://togithub.com/square/kotlinpoet/issues/1506)).

##### New Contributors

-   [@&#8203;popematt](https://togithub.com/popematt) made their first contribution in [https://github.com/square/kotlinpoet/pull/1272](https://togithub.com/square/kotlinpoet/pull/1272)
-   [@&#8203;bitPogo](https://togithub.com/bitPogo) made their first contribution in [https://github.com/square/kotlinpoet/pull/1306](https://togithub.com/square/kotlinpoet/pull/1306)
-   [@&#8203;mars885](https://togithub.com/mars885) made their first contribution in [https://github.com/square/kotlinpoet/pull/1338](https://togithub.com/square/kotlinpoet/pull/1338)
-   [@&#8203;sjudd](https://togithub.com/sjudd) made their first contribution in [https://github.com/square/kotlinpoet/pull/1344](https://togithub.com/square/kotlinpoet/pull/1344)
-   [@&#8203;Sironheart](https://togithub.com/Sironheart) made their first contribution in [https://github.com/square/kotlinpoet/pull/1384](https://togithub.com/square/kotlinpoet/pull/1384)
-   [@&#8203;polarene](https://togithub.com/polarene) made their first contribution in [https://github.com/square/kotlinpoet/pull/1397](https://togithub.com/square/kotlinpoet/pull/1397)
-   [@&#8203;DeoTimeTheGithubUser](https://togithub.com/DeoTimeTheGithubUser) made their first contribution in [https://github.com/square/kotlinpoet/pull/1454](https://togithub.com/square/kotlinpoet/pull/1454)
-   [@&#8203;drawers](https://togithub.com/drawers) made their first contribution in [https://github.com/square/kotlinpoet/pull/1477](https://togithub.com/square/kotlinpoet/pull/1477)

**Full Changelog**: https://github.com/square/kotlinpoet/compare/1.12.0...1.13.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/cashapp/redwood).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzUuMzQuMSJ9-->



Patch:
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 74fdf7c9d..d18a4d1da 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -26,7 +26,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa
 xmlutil-serialization = 'io.github.pdvrieze.xmlutil:serialization:0.85.0'
 
 dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
-spotlessPlugin = "com.diffplug.spotless:spotless-plugin-gradle:6.17.0"
+spotlessPlugin = "com.diffplug.spotless:spotless-plugin-gradle:6.18.0"
 gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.25.1"
 buildConfigPlugin = "com.github.gmazzo:gradle-buildconfig-plugin:3.1.0"
 
@@ -51,7 +51,7 @@ jetbrains-compose-ui-tooling = { module = "org.jetbrains.compose.ui:ui-tooling",
 jetbrains-compose-ui-tooling-preview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "jbCompose" }
 
 androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.4.2" }
-kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.12.0" }
+kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.13.0" }
 clikt = { module = "com.github.ajalt.clikt:clikt", version = "3.5.2" }
 junit = { module = "junit:junit", version = "4.13.2" }
 testParameterInjector = { module = "com.google.testparameterinjector:test-parameter-injector", version = "1.11" }
diff --git a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeGeneration.kt b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeGeneration.kt
index e47f2ad3d..3dc931277 100644
--- a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeGeneration.kt
+++ b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeGeneration.kt
@@ -191,7 +191,7 @@ internal object RowScopeImpl : RowScope
 internal fun generateScope(schema: Schema, scope: FqType): FileSpec {
   val scopeName = scope.flatName
   val scopeType = ClassName(schema.composePackage(), scopeName)
-  return FileSpec.builder(scopeType.packageName, scopeType.simpleName)
+  return FileSpec.builder(scopeType)
     .apply {
       val scopeBuilder = TypeSpec.interfaceBuilder(scopeType)
         .addAnnotation(Redwood.LayoutScopeMarker)
diff --git a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeProtocolGeneration.kt b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeProtocolGeneration.kt
index 155485397..8aa737e38 100644
--- a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeProtocolGeneration.kt
+++ b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/composeProtocolGeneration.kt
@@ -86,7 +86,7 @@ internal fun generateProtocolBridge(
   val schema = schemaSet.schema
   val type = schema.protocolBridgeType()
   val providerType = schema.getWidgetFactoryProviderType().parameterizedBy(NOTHING)
-  return FileSpec.builder(type.packageName, type.simpleName)
+  return FileSpec.builder(type)
     .addType(
       TypeSpec.classBuilder(type)
         .addSuperinterface(ComposeProtocol.ProtocolBridge)
@@ -183,7 +183,7 @@ internal fun generateProtocolWidgetFactory(
   host: ProtocolSchema = schema,
 ): FileSpec {
   val type = schema.protocolWidgetFactoryType(host)
-  return FileSpec.builder(type.packageName, type.simpleName)
+  return FileSpec.builder(type)
     .addType(
       TypeSpec.classBuilder(type)
         .addModifiers(INTERNAL)
@@ -279,7 +279,7 @@ internal fun generateProtocolWidget(
 ): FileSpec {
   val type = schema.protocolWidgetType(widget, host)
   val widgetName = schema.widgetType(widget)
-  return FileSpec.builder(type.packageName, type.simpleName)
+  return FileSpec.builder(type)
     .addType(
       TypeSpec.classBuilder(type)
         .addModifiers(INTERNAL)
diff --git a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/diffConsumingGeneration.kt b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/diffConsumingGeneration.kt
index 6d96f20fe..d91084e85 100644
--- a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/diffConsumingGeneration.kt
+++ b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/diffConsumingGeneration.kt
@@ -63,7 +63,7 @@ internal fun generateDiffConsumingNodeFactory(
   val schema = schemaSet.schema
   val provider = schema.getWidgetFactoryProviderType().parameterizedBy(typeVariableW)
   val type = schema.diffConsumingNodeFactoryType()
-  return FileSpec.builder(type.packageName, type.simpleName)
+  return FileSpec.builder(type)
     .addType(
       TypeSpec.classBuilder(type)
         .addTypeVariable(typeVariableW)
@@ -174,7 +174,7 @@ internal fun generateDiffConsumingWidget(
   val type = schema.diffConsumingNodeType(widget, host)
   val widgetType = schema.widgetType(widget).parameterizedBy(typeVariableW)
   val protocolType = WidgetProtocol.DiffConsumingNode.parameterizedBy(typeVariableW)
-  return FileSpec.builder(type.packageName, type.simpleName)
+  return FileSpec.builder(type)
     .addType(
       TypeSpec.classBuilder(type)
         .addModifiers(INTERNAL)
diff --git a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/widgetGeneration.kt b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/widgetGeneration.kt
index f4343ad2d..9ba9dc4a9 100644
--- a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/widgetGeneration.kt
+++ b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/widgetGeneration.kt
@@ -45,7 +45,7 @@ interface SunspotWidgetFactoryProvider<W : Any> : RedwoodLayoutWidgetFactoryProv
 internal fun generateWidgetFactories(schemaSet: SchemaSet): FileSpec {
   val schema = schemaSet.schema
   val widgetFactoriesType = schema.getWidgetFactoriesType()
-  return FileSpec.builder(widgetFactoriesType.packageName, widgetFactoriesType.simpleName)
+  return FileSpec.builder(widgetFactoriesType)
     .addType(
       TypeSpec.classBuilder(widgetFactoriesType)
         .addTypeVariable(typeVariableW)
@@ -92,7 +92,7 @@ interface SunspotWidgetFactory<W : Any> : Widget.Factory<W> {
 */
 internal fun generateWidgetFactory(schema: Schema): FileSpec {
   val widgetFactoryType = schema.getWidgetFactoryType()
-  return FileSpec.builder(widgetFactoryType.packageName, widgetFactoryType.simpleName)
+  return FileSpec.builder(widgetFactoryType)
     .addType(
       TypeSpec.interfaceBuilder(widgetFactoryType)
         .addTypeVariable(typeVariableW)


Test patch:
diff --git a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/testingGeneration.kt b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/testingGeneration.kt
index b5985a10f..235996073 100644
--- a/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/testingGeneration.kt
+++ b/redwood-tooling-codegen/src/main/kotlin/app/cash/redwood/tooling/codegen/testingGeneration.kt
@@ -83,7 +83,7 @@ public class MutableSunspotWidgetFactory : SunspotWidgetFactory<MutableWidget> {
 */
 internal fun generateMutableWidgetFactory(schema: Schema): FileSpec {
   val mutableWidgetFactoryType = schema.getMutableWidgetFactoryType()
-  return FileSpec.builder(mutableWidgetFactoryType.packageName, mutableWidgetFactoryType.simpleName)
+  return FileSpec.builder(mutableWidgetFactoryType)
     .addType(
       TypeSpec.classBuilder(mutableWidgetFactoryType)
         .addSuperinterface(schema.getWidgetFactoryType().parameterizedBy(RedwoodTesting.MutableWidget))
@@ -132,7 +132,7 @@ internal class MutableSunspotButton : SunspotButton<MutableWidget>, MutableWidge
 internal fun generateMutableWidget(schema: Schema, widget: Widget): FileSpec {
   val mutableWidgetType = schema.mutableWidgetType(widget)
   val widgetValueType = schema.widgetValueType(widget)
-  return FileSpec.builder(mutableWidgetType.packageName, mutableWidgetType.simpleName)
+  return FileSpec.builder(mutableWidgetType)
     .addType(
       TypeSpec.classBuilder(mutableWidgetType)
         .addModifiers(INTERNAL)
@@ -337,7 +337,7 @@ internal fun generateWidgetValue(schema: Schema, widget: Widget): FileSpec {
 
   toStringBuilder.append(")")
 
-  return FileSpec.builder(widgetValueType.packageName, widgetValueType.simpleName)
+  return FileSpec.builder(widgetValueType)
     .addType(
       classBuilder
         .primaryConstructor(constructorBuilder.build())
diff --git a/redwood-tooling-codegen/src/test/kotlin/app/cash/redwood/tooling/codegen/DiffConsumingGenerationTest.kt b/redwood-tooling-codegen/src/test/kotlin/app/cash/redwood/tooling/codegen/DiffConsumingGenerationTest.kt
index f450ebd80..9e73f38b4 100644
--- a/redwood-tooling-codegen/src/test/kotlin/app/cash/redwood/tooling/codegen/DiffConsumingGenerationTest.kt
+++ b/redwood-tooling-codegen/src/test/kotlin/app/cash/redwood/tooling/codegen/DiffConsumingGenerationTest.kt
@@ -62,7 +62,7 @@ class DiffConsumingGenerationTest {
     val fileSpec = generateDiffConsumingLayoutModifierSerialization(schema)
     assertThat(fileSpec.toString()).apply {
       contains("1 -> PrimaryModifierImpl.serializer()")
-      contains("1000001 -> SecondaryModifierImpl.serializer()")
+      contains("1_000_001 -> SecondaryModifierImpl.serializer()")
     }
   }
 }