From 94a7673c2d7a394b49aabc3346a83fe27e7538f8 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 19 Dec 2017 14:23:42 +0100 Subject: [PATCH] Don't show type hints for destructuring declarations with explicit type #KT-21833 Fixed --- .../KotlinInlayParameterHintsProvider.kt | 2 +- .../kotlin/idea/parameterInfo/InlayTypeHintsTest.kt | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinInlayParameterHintsProvider.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinInlayParameterHintsProvider.kt index 19eca74d3f6..c850badffe0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinInlayParameterHintsProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinInlayParameterHintsProvider.kt @@ -53,7 +53,7 @@ enum class HintType(desc: String, enabled: Boolean) { override fun isApplicable(elem: PsiElement): Boolean = (elem is KtProperty && elem.getReturnTypeReference() == null && elem.isLocal) || (elem is KtParameter && elem.isLoopParameter && elem.typeReference == null) || - (elem is KtDestructuringDeclarationEntry) + (elem is KtDestructuringDeclarationEntry && elem.getReturnTypeReference() == null) }, FUNCTION_HINT("Show function return type hints", false) { diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayTypeHintsTest.kt b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayTypeHintsTest.kt index fb75432cd1f..42c9ac983eb 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayTypeHintsTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayTypeHintsTest.kt @@ -105,4 +105,15 @@ class InlayTypeHintsTest : KotlinLightCodeInsightFixtureTestCase() { } }""") } + + fun testDestructuring() { + HintType.LOCAL_VARIABLE_HINT.option.set(true) + check("""fun main(args: Array) { + val (a: String, b: String, c: String) = x() + } + + fun x() :Triple { + return Triple("A", "B", "C") + }""") + } }