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
@@ -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