Completion for sealed class inheritors and a pair of tests
This commit is contained in:
+3
-1
@@ -292,7 +292,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
|||||||
|
|
||||||
|
|
||||||
// FINAL
|
// FINAL
|
||||||
if (isAbstract()) {
|
if (isAbstract() || isSealed()) {
|
||||||
psiModifiers.add(PsiModifier.ABSTRACT)
|
psiModifiers.add(PsiModifier.ABSTRACT)
|
||||||
}
|
}
|
||||||
else if (!(classOrObject.hasModifier(OPEN_KEYWORD) || (classOrObject is JetClass && classOrObject.isEnum()))) {
|
else if (!(classOrObject.hasModifier(OPEN_KEYWORD) || (classOrObject is JetClass && classOrObject.isEnum()))) {
|
||||||
@@ -308,6 +308,8 @@ public open class KotlinLightClassForExplicitDeclaration(
|
|||||||
|
|
||||||
private fun isAbstract(): Boolean = classOrObject.hasModifier(ABSTRACT_KEYWORD) || isInterface
|
private fun isAbstract(): Boolean = classOrObject.hasModifier(ABSTRACT_KEYWORD) || isInterface
|
||||||
|
|
||||||
|
private fun isSealed(): Boolean = classOrObject.hasModifier(SEALED_KEYWORD)
|
||||||
|
|
||||||
override fun hasModifierProperty(@NonNls name: String): Boolean = getModifierList().hasModifierProperty(name)
|
override fun hasModifierProperty(@NonNls name: String): Boolean = getModifierList().hasModifierProperty(name)
|
||||||
|
|
||||||
override fun isDeprecated(): Boolean {
|
override fun isDeprecated(): Boolean {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package sample
|
||||||
|
|
||||||
|
abstract class Foo {
|
||||||
|
object X: Foo()
|
||||||
|
class Y: Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo(){
|
||||||
|
val f : Foo = <caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: { lookupString:"X", itemText:"X", tailText:" (sample.Foo)" }
|
||||||
|
// EXIST: { lookupString:"Y", itemText:"Y", tailText:"() (sample.Foo)" }
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package sample
|
||||||
|
|
||||||
|
sealed class Foo {
|
||||||
|
object X: Foo()
|
||||||
|
class Y: Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo(){
|
||||||
|
val f : Foo = <caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: { lookupString:"X", itemText:"X", tailText:" (sample.Foo)" }
|
||||||
|
// EXIST: { lookupString:"Y", itemText:"Y", tailText:"() (sample.Foo)" }
|
||||||
+12
@@ -31,6 +31,12 @@ import java.util.regex.Pattern;
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionTest {
|
public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionTest {
|
||||||
|
@TestMetadata("AbstractMembers.kt")
|
||||||
|
public void testAbstractMembers() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/AbstractMembers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AfterEmptyArgument.kt")
|
@TestMetadata("AfterEmptyArgument.kt")
|
||||||
public void testAfterEmptyArgument() throws Exception {
|
public void testAfterEmptyArgument() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/AfterEmptyArgument.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/AfterEmptyArgument.kt");
|
||||||
@@ -449,6 +455,12 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("SealedMembers.kt")
|
||||||
|
public void testSealedMembers() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/SealedMembers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SkipDeclarationsOfType.kt")
|
@TestMetadata("SkipDeclarationsOfType.kt")
|
||||||
public void testSkipDeclarationsOfType() throws Exception {
|
public void testSkipDeclarationsOfType() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/SkipDeclarationsOfType.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/smart/SkipDeclarationsOfType.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user