KT-8442 related: destructuring declarations aren't taken into account during light classes generation, fixes EA-81204
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
|||||||
|
public final class TopLevelDestructuringKt {
|
||||||
|
private static final int z = 3;
|
||||||
|
|
||||||
|
public static final int getZ() { /* compiled code */ }
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
// TopLevelDestructuringKt
|
||||||
|
|
||||||
|
data class Pair(val x: Int, val y: Int)
|
||||||
|
|
||||||
|
val (x, y) = Pair(1, 2)
|
||||||
|
|
||||||
|
val z = 3
|
||||||
@@ -59,6 +59,21 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/asJava/lightClasses/compilationErrors")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class CompilationErrors extends AbstractCompilerLightClassTest {
|
||||||
|
public void testAllFilesPresentInCompilationErrors() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TopLevelDestructuring.kt")
|
||||||
|
public void testTopLevelDestructuring() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/TopLevelDestructuring.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/asJava/lightClasses/delegation")
|
@TestMetadata("compiler/testData/asJava/lightClasses/delegation")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -931,7 +931,7 @@ fun main(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractIdeCompiledLightClassTest> {
|
testClass<AbstractIdeCompiledLightClassTest> {
|
||||||
model("asJava/lightClasses", excludeDirs = listOf("local"), pattern = KT_WITHOUT_DOTS_IN_NAME)
|
model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors"), pattern = KT_WITHOUT_DOTS_IN_NAME)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -282,8 +282,9 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
|||||||
ForceResolveUtil.forceResolveAllContents(descriptor)
|
ForceResolveUtil.forceResolveAllContents(descriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (declaration is KtClassOrObject || declaration is KtTypeAlias) {
|
else if (declaration is KtClassOrObject || declaration is KtTypeAlias || declaration is KtDestructuringDeclaration) {
|
||||||
// Do nothing: we are not interested in classes or type aliases
|
// Do nothing: we are not interested in classes or type aliases,
|
||||||
|
// and all destructuring declarations are erroneous at top level
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG.error("Unsupported declaration kind: " + declaration + " in file " + file.name + "\n" + file.text)
|
LOG.error("Unsupported declaration kind: " + declaration + " in file " + file.name + "\n" + file.text)
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ import java.util.regex.Pattern;
|
|||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLightClassTest {
|
public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLightClassTest {
|
||||||
public void testAllFilesPresentInLightClasses() throws Exception {
|
public void testAllFilesPresentInLightClasses() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), true, "local");
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), true, "local", "compilationErrors");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationClass.kt")
|
@TestMetadata("AnnotationClass.kt")
|
||||||
|
|||||||
@@ -59,6 +59,21 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/asJava/lightClasses/compilationErrors")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class CompilationErrors extends AbstractIdeLightClassTest {
|
||||||
|
public void testAllFilesPresentInCompilationErrors() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TopLevelDestructuring.kt")
|
||||||
|
public void testTopLevelDestructuring() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/TopLevelDestructuring.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/asJava/lightClasses/facades")
|
@TestMetadata("compiler/testData/asJava/lightClasses/facades")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user