Don't show type for reference expressions inside KtCallableReference (KT-14530)
This commit is contained in:
@@ -48,7 +48,7 @@ class KotlinExpressionTypeProvider : ExpressionTypeProvider<KtExpression>() {
|
|||||||
is KtStatementExpression, is KtDestructuringDeclaration -> false
|
is KtStatementExpression, is KtDestructuringDeclaration -> false
|
||||||
is KtIfExpression, is KtWhenExpression, is KtTryExpression -> shouldShowStatementType()
|
is KtIfExpression, is KtWhenExpression, is KtTryExpression -> shouldShowStatementType()
|
||||||
is KtLoopExpression -> false
|
is KtLoopExpression -> false
|
||||||
else -> getQualifiedExpressionForSelector() == null
|
else -> getQualifiedExpressionForSelector() == null && parent !is KtCallableReferenceExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KtExpression.shouldShowStatementType(): Boolean {
|
private fun KtExpression.shouldShowStatementType(): Boolean {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun foo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
run(::<caret>foo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TYPE: ::foo -> <html>KFunction0<Unit></html>
|
||||||
|
// TYPE: run(::foo) -> <html>Unit</html>
|
||||||
@@ -65,6 +65,12 @@ public class ExpressionTypeTestGenerated extends AbstractExpressionTypeTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("MultiDeclaration.kt")
|
||||||
public void testMultiDeclaration() throws Exception {
|
public void testMultiDeclaration() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/expressionType/MultiDeclaration.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/expressionType/MultiDeclaration.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user