From 57680ae003cd96f707f83a2e13082b7c9e3230a6 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 27 Oct 2016 13:44:58 +0200 Subject: [PATCH] Don't show literals in "show expression type" popup --- .../kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt | 1 + idea/testData/codeInsight/expressionType/IfAsExpression.kt | 1 - .../codeInsight/expressionType/IfAsExpressionInsideBlock.kt | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt index 387e13bdb7c..801994c40d6 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt @@ -48,6 +48,7 @@ class KotlinExpressionTypeProvider : ExpressionTypeProvider() { is KtStatementExpression, is KtDestructuringDeclaration -> false is KtIfExpression, is KtWhenExpression, is KtTryExpression -> shouldShowStatementType() is KtLoopExpression -> false + is KtConstantExpression -> false else -> getQualifiedExpressionForSelector() == null && parent !is KtCallableReferenceExpression } diff --git a/idea/testData/codeInsight/expressionType/IfAsExpression.kt b/idea/testData/codeInsight/expressionType/IfAsExpression.kt index e64b5777d2d..821e17f92e6 100644 --- a/idea/testData/codeInsight/expressionType/IfAsExpression.kt +++ b/idea/testData/codeInsight/expressionType/IfAsExpression.kt @@ -1,5 +1,4 @@ val x = if (2 > 1) 3 else 4 -// TYPE: 3 -> Int // TYPE: if (2 > 1) 3 else 4 -> Int // TYPE: val x = if (2 > 1) 3 else 4 -> Int diff --git a/idea/testData/codeInsight/expressionType/IfAsExpressionInsideBlock.kt b/idea/testData/codeInsight/expressionType/IfAsExpressionInsideBlock.kt index 1e9dfc9d08f..e40e44ece69 100644 --- a/idea/testData/codeInsight/expressionType/IfAsExpressionInsideBlock.kt +++ b/idea/testData/codeInsight/expressionType/IfAsExpressionInsideBlock.kt @@ -2,7 +2,6 @@ val x = if (flag) { if (flag2) 13 else 7 } else 42 -// TYPE: 13 -> Int // TYPE: if (flag2) 13 else 7 -> Int // TYPE: if (flag) { if (flag2) 13 else 7 } else 42 -> Int // TYPE: val x = if (flag) { if (flag2) 13 else 7 } else 42 -> Int