[AA] KtExpressionInfoProvider.getMissingCases: fix no subject case
return missing else branch (even if it's present, see kdoc) ^ KT-62875 fixed
This commit is contained in:
+18
@@ -58,6 +58,24 @@ public class Fe10IdeNormalAnalysisSourceModuleWhenMissingCasesTestGenerated exte
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_empty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject.kt")
|
||||
public void testBoolean_noSubject() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubjectIncorrectCode.kt")
|
||||
public void testBoolean_noSubjectIncorrectCode() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubjectIncorrectCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject_else.kt")
|
||||
public void testBoolean_noSubject_else() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject_else.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_partial.kt")
|
||||
public void testBoolean_partial() throws Exception {
|
||||
|
||||
+18
@@ -58,6 +58,24 @@ public class FirIdeDependentAnalysisSourceModuleWhenMissingCasesTestGenerated ex
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_empty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject.kt")
|
||||
public void testBoolean_noSubject() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubjectIncorrectCode.kt")
|
||||
public void testBoolean_noSubjectIncorrectCode() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubjectIncorrectCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject_else.kt")
|
||||
public void testBoolean_noSubject_else() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject_else.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_partial.kt")
|
||||
public void testBoolean_partial() throws Exception {
|
||||
|
||||
+18
@@ -58,6 +58,24 @@ public class FirIdeNormalAnalysisSourceModuleWhenMissingCasesTestGenerated exten
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_empty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject.kt")
|
||||
public void testBoolean_noSubject() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubjectIncorrectCode.kt")
|
||||
public void testBoolean_noSubjectIncorrectCode() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubjectIncorrectCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject_else.kt")
|
||||
public void testBoolean_noSubject_else() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject_else.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_partial.kt")
|
||||
public void testBoolean_partial() throws Exception {
|
||||
|
||||
+18
@@ -58,6 +58,24 @@ public class FirStandaloneNormalAnalysisSourceModuleWhenMissingCasesTestGenerate
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_empty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject.kt")
|
||||
public void testBoolean_noSubject() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubjectIncorrectCode.kt")
|
||||
public void testBoolean_noSubjectIncorrectCode() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubjectIncorrectCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_noSubject_else.kt")
|
||||
public void testBoolean_noSubject_else() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionInfoProvider/whenMissingCases/boolean_noSubject_else.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boolean_partial.kt")
|
||||
public void testBoolean_partial() throws Exception {
|
||||
|
||||
+9
@@ -36,6 +36,15 @@ public interface KtExpressionInfoProviderMixIn : KtAnalysisSessionMixIn {
|
||||
* else -> 3
|
||||
* }
|
||||
*
|
||||
* If when-expression has no subject, then else-branch would be reported as missing even if it is explicitly present:
|
||||
*
|
||||
* fun test() {
|
||||
* when {
|
||||
* true -> {}
|
||||
* else -> {}
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Note that this function returns the same missing cases regardless of the existence of the else branch.
|
||||
* If you have to assume that it does not have the missing cases when it has an else branch,
|
||||
* you need a separate check whether it has an else branch or not.
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
<caret>when {
|
||||
true -> {}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Unknown - else
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
<caret>when() {
|
||||
true -> {}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Unknown - else
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
<caret>when {
|
||||
true -> {}
|
||||
else -> { }
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Unknown - else
|
||||
Reference in New Issue
Block a user