[kotlin] KTIJ-34996 Fixed postfix not completion inserting redundant parentheses in dot qualified expressions

^KTIJ-34996 fixed

GitOrigin-RevId: 15da0b3c1c50416f19f15c9d1c87ab7f9d3592cb
This commit is contained in:
Frederik Haselmeier
2025-11-18 15:24:02 +00:00
committed by intellij-monorepo-bot
parent e26c3ad1b3
commit 1cf124fa36
10 changed files with 69 additions and 3 deletions
@@ -147,6 +147,7 @@ internal object KotlinPostfixTemplatePsiInfo : PostfixTemplatePsiInfo() {
is KtLambdaExpression,
is KtCallExpression,
is KtConstantExpression,
is KtDotQualifiedExpression,
is KtStringTemplateExpression -> false
else -> true
}
@@ -510,6 +510,21 @@ public abstract class K2PostfixTemplateTestGenerated extends AbstractK2PostfixTe
performTest();
}
@TestMetadata("qualifiedCallInsideWithCall.kt")
public void testQualifiedCallInsideWithCall() throws Exception {
performTest();
}
@TestMetadata("qualifiedCallInsideWithProperty.kt")
public void testQualifiedCallInsideWithProperty() throws Exception {
performTest();
}
@TestMetadata("qualifiedCallWithLambda.kt")
public void testQualifiedCallWithLambda() throws Exception {
performTest();
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
performTest();
@@ -1,5 +1,5 @@
fun test() {
!(Foo().condition())
!Foo().condition()
}
class Foo {
@@ -0,0 +1,9 @@
fun test() {
(!Foo().foo()).condition()
}
fun Boolean.condition(): Boolean = true
class Foo {
fun foo(): Boolean = true
}
@@ -0,0 +1,9 @@
fun test() {
Foo().foo()<caret>.condition()
}
fun Boolean.condition(): Boolean = true
class Foo {
fun foo(): Boolean = true
}
@@ -0,0 +1,9 @@
fun test() {
(!Foo().foo).condition()
}
fun Boolean.condition(): Boolean = true
class Foo {
val foo: Boolean = true
}
@@ -0,0 +1,9 @@
fun test() {
Foo().foo<caret>.condition()
}
fun Boolean.condition(): Boolean = true
class Foo {
val foo: Boolean = true
}
@@ -0,0 +1,7 @@
fun test() {
!Foo().condition { }
}
class Foo {
fun condition(f: () -> Unit): Boolean = true
}
@@ -0,0 +1,7 @@
fun test() {
Foo().condition { }<caret>
}
class Foo {
fun condition(f: () -> Unit): Boolean = true
}
@@ -1,6 +1,6 @@
fun test() {
if (!(Foo().check(1, 2))) {
if (!Foo().check(1, 2)) {
}
}