Do not report lambda return hint twice for postfix and prefix (KT-22653)
#KT-22653 Fixed
This commit is contained in:
@@ -19,7 +19,11 @@ fun provideLambdaReturnValueHints(expression: KtExpression): List<InlayInfo> {
|
||||
}
|
||||
|
||||
val parent = expression.parent
|
||||
if (parent is KtDotQualifiedExpression || parent is KtSafeQualifiedExpression || parent is KtBinaryExpression) {
|
||||
if (parent is KtDotQualifiedExpression ||
|
||||
parent is KtSafeQualifiedExpression ||
|
||||
parent is KtBinaryExpression ||
|
||||
parent is KtUnaryExpression
|
||||
) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
|
||||
@@ -109,4 +109,23 @@ class LambdaReturnValueHintsTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
fun testPostfixPrefixExpressions() {
|
||||
check(
|
||||
"""
|
||||
fun bar() {
|
||||
var test = 0
|
||||
run {
|
||||
test
|
||||
<hint text="^run"/>test++
|
||||
}
|
||||
|
||||
run {
|
||||
test
|
||||
<hint text="^run"/>++test
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user