K1: render receiver DNN type as parenthesized

^KTIJ-20849
This commit is contained in:
Alexey Belkov
2022-10-28 11:03:30 +04:00
parent 7692423e44
commit 2036b65b78
2 changed files with 5 additions and 4 deletions
@@ -9,7 +9,7 @@ public fun </*0*/ F> bar4(/*0*/ x: F?): kotlin.Unit
public fun </*0*/ F> bar5(/*0*/ x: F): kotlin.Unit
public fun </*0*/ F> bar6(/*0*/ x: F): kotlin.Unit
public fun </*0*/ F> bar7(/*0*/ x: F & Any): kotlin.Unit
public fun </*0*/ F> bar8(/*0*/ x: F & Any.() -> kotlin.Unit): kotlin.Unit
public fun </*0*/ F> bar8(/*0*/ x: (F & Any).() -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T : kotlin.Any> foo(/*0*/ x: T, /*1*/ y: kotlin.collections.List<kotlin.String>): kotlin.Unit
public fun </*0*/ F> F & Any.bar9(/*0*/ x: () -> kotlin.Unit): kotlin.Unit
public fun </*0*/ F> (F & Any).bar9(/*0*/ x: () -> kotlin.Unit): kotlin.Unit
@@ -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