Don't show type hints for destructuring declarations with explicit type

#KT-21833 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-19 14:23:42 +01:00
parent b0b69b2ad0
commit 94a7673c2d
2 changed files with 12 additions and 1 deletions
@@ -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) {
@@ -105,4 +105,15 @@ class InlayTypeHintsTest : KotlinLightCodeInsightFixtureTestCase() {
}
}""")
}
fun testDestructuring() {
HintType.LOCAL_VARIABLE_HINT.option.set(true)
check("""fun main(args: Array<String>) {
val (a: String, b: String, c: String) = x()
}
fun x() :Triple<String, String,String> {
return Triple(<hint text="first:" />"A", <hint text="second:" />"B", <hint text="third:" />"C")
}""")
}
}