Don't show type for reference expressions inside KtCallableReference (KT-14530)

This commit is contained in:
Dmitry Jemerov
2016-10-27 13:25:47 +02:00
parent 4f82958309
commit e6c05c3a19
3 changed files with 16 additions and 1 deletions
@@ -48,7 +48,7 @@ class KotlinExpressionTypeProvider : ExpressionTypeProvider<KtExpression>() {
is KtStatementExpression, is KtDestructuringDeclaration -> false
is KtIfExpression, is KtWhenExpression, is KtTryExpression -> shouldShowStatementType()
is KtLoopExpression -> false
else -> getQualifiedExpressionForSelector() == null
else -> getQualifiedExpressionForSelector() == null && parent !is KtCallableReferenceExpression
}
private fun KtExpression.shouldShowStatementType(): Boolean {
@@ -0,0 +1,9 @@
fun foo() {
}
fun bar() {
run(::<caret>foo)
}
// TYPE: ::foo -> <html>KFunction0&lt;Unit&gt;</html>
// TYPE: run(::foo) -> <html>Unit</html>
@@ -65,6 +65,12 @@ public class ExpressionTypeTestGenerated extends AbstractExpressionTypeTest {
doTest(fileName);
}
@TestMetadata("MethodReference.kt")
public void testMethodReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/expressionType/MethodReference.kt");
doTest(fileName);
}
@TestMetadata("MultiDeclaration.kt")
public void testMultiDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/expressionType/MultiDeclaration.kt");