Don't show type hints for destructuring declarations with explicit type
#KT-21833 Fixed
This commit is contained in:
+1
-1
@@ -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) ||
|
override fun isApplicable(elem: PsiElement): Boolean = (elem is KtProperty && elem.getReturnTypeReference() == null && elem.isLocal) ||
|
||||||
(elem is KtParameter && elem.isLoopParameter && elem.typeReference == null) ||
|
(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) {
|
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")
|
||||||
|
}""")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user