KT-3750 When without else

#KT-3750 Fixed
This commit is contained in:
Nikolay Krasko
2013-07-05 20:19:22 +04:00
parent abcf5616f7
commit 21fa398380
5 changed files with 34 additions and 0 deletions
@@ -46,6 +46,7 @@ public class ControlFlowAnalyzer {
public void process(@NotNull BodiesResolveContext bodiesResolveContext) {
for (JetFile file : bodiesResolveContext.getFiles()) {
if (!bodiesResolveContext.completeAnalysisNeeded(file)) continue;
checkDeclarationContainer(file);
}
for (JetClass aClass : bodiesResolveContext.getClasses().keySet()) {
@@ -0,0 +1,15 @@
// KT-3750 When without else
enum class A {
e1
e2
}
class B(val a: A)
val B.foo: Int
get() {
// Check absence [NO_ELSE_IN_WHEN] error
return when (a) {
A.e1 -> 1
A.e2 -> 3
}
}
@@ -0,0 +1,9 @@
// FALSE
class B(val a: A)
val B.foo: Int
get() {
return <caret>when (a) {
A.e1 -> 1
A.e2 -> 4
}
}
@@ -268,6 +268,11 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
doTest("idea/testData/checker/When.kt");
}
@TestMetadata("WhenInEnumInExtensionProperty.kt")
public void testWhenInEnumInExtensionProperty() throws Exception {
doTest("idea/testData/checker/WhenInEnumInExtensionProperty.kt");
}
}
@TestMetadata("idea/testData/checker/regression")
@@ -59,6 +59,10 @@ public class OutOfBlockModificationTest extends LightCodeInsightFixtureTestCase
doTest();
}
public void testInGlobalPropertyWithGetter() {
doTest();
}
public void testInMethod() {
doTest();
}