Do not build light classes for expect classes
#KT-15482 Fixed
This commit is contained in:
+2
-1
@@ -61,6 +61,7 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.debugText.getDebugText
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||
import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import java.util.*
|
||||
@@ -340,7 +341,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
|
||||
}
|
||||
|
||||
fun createNoCache(classOrObject: KtClassOrObject): KtLightClassForSourceDeclaration? {
|
||||
if (classOrObject.hasExpectModifier()) {
|
||||
if (classOrObject.parentsWithSelf.filterIsInstance<KtClassOrObject>().any { it.hasExpectModifier() }) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<not generated>
|
||||
@@ -0,0 +1,4 @@
|
||||
// p.B
|
||||
package p
|
||||
|
||||
expect class B
|
||||
@@ -0,0 +1 @@
|
||||
<not generated>
|
||||
@@ -0,0 +1,4 @@
|
||||
// p.B
|
||||
package p
|
||||
|
||||
expect object B
|
||||
+1
@@ -0,0 +1 @@
|
||||
<not generated>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// p.B.Nested
|
||||
package p
|
||||
|
||||
expect class B {
|
||||
class Nested {}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<not generated>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// p.B.Nested
|
||||
package p
|
||||
|
||||
expect object B {
|
||||
class Nested {}
|
||||
}
|
||||
+24
@@ -165,6 +165,30 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectClass.kt")
|
||||
public void testExpectClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectObject.kt")
|
||||
public void testExpectObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectedNestedClass.kt")
|
||||
public void testExpectedNestedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectedNestedClassInObject.kt")
|
||||
public void testExpectedNestedClassInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PrivateInTrait.kt")
|
||||
public void testPrivateInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
|
||||
|
||||
+24
@@ -165,6 +165,30 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectClass.kt")
|
||||
public void testExpectClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectObject.kt")
|
||||
public void testExpectObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectedNestedClass.kt")
|
||||
public void testExpectedNestedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ExpectedNestedClassInObject.kt")
|
||||
public void testExpectedNestedClassInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PrivateInTrait.kt")
|
||||
public void testPrivateInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
|
||||
|
||||
Reference in New Issue
Block a user