diff --git a/interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/KsTypes.kt b/interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/KsTypes.kt index 6ffd36749e..d1379383e2 100644 --- a/interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/KsTypes.kt +++ b/interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/KsTypes.kt @@ -188,7 +188,7 @@ public fun KSTypeReference.toTypeName( receiver = elem.receiverType?.toTypeName(typeParamResolver), parameters = elem.functionParameters.map { ParameterSpec.unnamed(it.type.toTypeName(typeParamResolver)) }, returnType = elem.returnType.toTypeName(typeParamResolver), - ) + ).copy(nullable = resolve().isMarkedNullable) } else -> resolve().toTypeName(typeParamResolver, element?.typeArguments.orEmpty()) } diff --git a/interop/ksp/test-processor/src/test/kotlin/com/squareup/kotlinpoet/ksp/test/processor/TestProcessorTest.kt b/interop/ksp/test-processor/src/test/kotlin/com/squareup/kotlinpoet/ksp/test/processor/TestProcessorTest.kt index e731852b9f..c54c1e22da 100644 --- a/interop/ksp/test-processor/src/test/kotlin/com/squareup/kotlinpoet/ksp/test/processor/TestProcessorTest.kt +++ b/interop/ksp/test-processor/src/test/kotlin/com/squareup/kotlinpoet/ksp/test/processor/TestProcessorTest.kt @@ -133,6 +133,7 @@ class TestProcessorTest { param4: Function0, param5: Function1, param6: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Unit, + param7: ((String) -> String)?, ) { } @@ -296,6 +297,7 @@ class TestProcessorTest { Int, Int, ) -> Unit, + param7: ((String) -> String)?, ) { }