Do not report lambda return hint twice for postfix and prefix (KT-22653)

#KT-22653 Fixed
This commit is contained in:
Nikolay Krasko
2018-05-23 02:19:13 +03:00
parent 5e4d571693
commit 39694835ce
2 changed files with 24 additions and 1 deletions
@@ -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()
)
}
}