diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.txt index 1bae99eab5f..a68b05faf47 100644 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.txt +++ b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection/notApplicable.txt @@ -9,7 +9,7 @@ public fun bar4(/*0*/ x: F?): kotlin.Unit public fun bar5(/*0*/ x: F): kotlin.Unit public fun bar6(/*0*/ x: F): kotlin.Unit public fun bar7(/*0*/ x: F & Any): kotlin.Unit -public fun bar8(/*0*/ x: F & Any.() -> kotlin.Unit): kotlin.Unit +public fun bar8(/*0*/ x: (F & Any).() -> kotlin.Unit): kotlin.Unit public fun foo(/*0*/ x: T, /*1*/ y: kotlin.collections.List): kotlin.Unit -public fun F & Any.bar9(/*0*/ x: () -> kotlin.Unit): kotlin.Unit +public fun (F & Any).bar9(/*0*/ x: () -> kotlin.Unit): kotlin.Unit diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt index 59840f2499d..f9248ec115a 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt @@ -364,7 +364,8 @@ internal class DescriptorRendererImpl( if (receiverType != null) { val surroundReceiver = shouldRenderAsPrettyFunctionType(receiverType) && !receiverType.isMarkedNullable || - receiverType.hasModifiersOrAnnotations() + receiverType.hasModifiersOrAnnotations() || + receiverType is DefinitelyNotNullType if (surroundReceiver) { append("(") } @@ -743,7 +744,7 @@ internal class DescriptorRendererImpl( private fun KotlinType.renderForReceiver(): String { var result = renderType(this) - if (shouldRenderAsPrettyFunctionType(this) && !TypeUtils.isNullableType(this)) { + if ((shouldRenderAsPrettyFunctionType(this) && !TypeUtils.isNullableType(this)) || this is DefinitelyNotNullType) { result = "($result)" } return result