Add test for IC issue with typealias
If typealias is defined in a separate file, then after changing some base types, an incremental compilation of Kotlin could not find all affected files, because of lack of information, which it can not get on the class file analyzing phase. FIR provides a new approach to IC compilation: now we can run the frontend several times, which allows us to obtain all necessary information and use it to mark all affected files for recompilation. Relates to KT-54991 #KT-28233 Fixed
This commit is contained in:
committed by
Space Team
parent
25668ddd01
commit
848e1001f8
+5
@@ -82,6 +82,11 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
+5
@@ -82,6 +82,11 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
+5
@@ -82,6 +82,11 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), null, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), null, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^sealed.*"), false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^sealed.*)|(.*SinceK2)"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+5
@@ -81,6 +81,11 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
@@ -46,26 +46,52 @@ fun main(args: Array<String>) {
|
||||
generateTestGroupSuite(args) {
|
||||
testGroup("compiler/incremental-compilation-impl/test", "jps/jps-plugin/testData") {
|
||||
fun incrementalJvmTestData(targetBackend: TargetBackend, excludePattern: String? = null): TestGroup.TestClass.() -> Unit = {
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, targetBackend = targetBackend, excludedPattern = excludePattern)
|
||||
model(
|
||||
"incremental/pureKotlin",
|
||||
extension = null,
|
||||
recursive = false,
|
||||
targetBackend = targetBackend,
|
||||
excludedPattern = excludePattern
|
||||
)
|
||||
model("incremental/classHierarchyAffected", extension = null, recursive = false, targetBackend = targetBackend)
|
||||
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
model("incremental/withJava", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true, targetBackend = targetBackend)
|
||||
}
|
||||
testClass<AbstractIncrementalJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR))
|
||||
testClass<AbstractIncrementalFirJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR, excludePattern = "^.*Expect.*"))
|
||||
testClass<AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR, excludePattern = "^.*Expect.*"))
|
||||
testClass<AbstractIncrementalFirLightTreeJvmCompilerRunnerTest>(init = incrementalJvmTestData(TargetBackend.JVM_IR, excludePattern = "^.*Expect.*"))
|
||||
testClass<AbstractIncrementalJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
targetBackend = TargetBackend.JVM_IR,
|
||||
excludePattern = ".*SinceK2"
|
||||
)
|
||||
)
|
||||
testClass<AbstractIncrementalFirJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
)
|
||||
)
|
||||
testClass<AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
)
|
||||
)
|
||||
testClass<AbstractIncrementalFirLightTreeJvmCompilerRunnerTest>(
|
||||
init = incrementalJvmTestData(
|
||||
TargetBackend.JVM_IR,
|
||||
excludePattern = "^.*Expect.*"
|
||||
)
|
||||
)
|
||||
|
||||
testClass<AbstractIncrementalJsCompilerRunnerTest> {
|
||||
model("incremental/pureKotlin", extension = null, recursive = false)
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = ".*SinceK2")
|
||||
model("incremental/classHierarchyAffected", extension = null, recursive = false)
|
||||
model("incremental/js", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass<AbstractIncrementalJsKlibCompilerRunnerTest>() {
|
||||
// IC of sealed interfaces are not supported in JS
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = "^sealed.*")
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = "(^sealed.*)|(.*SinceK2)")
|
||||
model("incremental/classHierarchyAffected", extension = null, recursive = false)
|
||||
model("incremental/js", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
@@ -79,7 +105,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractIncrementalJsCompilerRunnerWithMetadataOnlyTest> {
|
||||
model("incremental/pureKotlin", extension = null, recursive = false)
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = ".*SinceK2")
|
||||
model("incremental/classHierarchyAffected", extension = null, recursive = false)
|
||||
model("incremental/js", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,13 @@ fun main(args: Array<String>) {
|
||||
"incremental/multiModule/multiplatform/custom", extension = null, excludeParentDirs = true,
|
||||
targetBackend = TargetBackend.JVM_IR
|
||||
)
|
||||
model("incremental/pureKotlin", extension = null, recursive = false, targetBackend = TargetBackend.JVM_IR)
|
||||
model(
|
||||
"incremental/pureKotlin",
|
||||
extension = null,
|
||||
recursive = false,
|
||||
targetBackend = TargetBackend.JVM_IR,
|
||||
excludedPattern = ".*SinceK2"
|
||||
)
|
||||
model("incremental/withJava", extension = null, excludeParentDirs = true, targetBackend = TargetBackend.JVM_IR)
|
||||
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true, targetBackend = TargetBackend.JVM_IR)
|
||||
model(
|
||||
|
||||
Generated
+1
-1
@@ -733,7 +733,7 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPureKotlin() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM_IR, false);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), TargetBackend.JVM_IR, false);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations")
|
||||
|
||||
+5
@@ -82,6 +82,11 @@ public class IncrementalK2FirICLightTreeJvmJpsTestGenerated extends AbstractIncr
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
Generated
+5
@@ -82,6 +82,11 @@ public class IncrementalK2JvmJpsTestGenerated extends AbstractIncrementalK2JvmJp
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
+5
@@ -82,6 +82,11 @@ public class IncrementalK2LightTreeJvmJpsTestGenerated extends AbstractIncrement
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypeImplicitlyWithCircularDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeTypealiasSinceK2")
|
||||
public void testChangeTypealiasSinceK2() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeTypealiasSinceK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("changeWithRemovingUsage")
|
||||
public void testChangeWithRemovingUsage() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
interface Foo {
|
||||
val values: Type
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class FooImpl : Foo {
|
||||
override val values: Type
|
||||
get() = "0"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class FooImpl : Foo {
|
||||
override val values: Type
|
||||
get() = 0
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/FooImpl.class
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/TypesKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/FooImpl.kt
|
||||
src/types.kt
|
||||
End of files
|
||||
After build round. Marked as dirty by Kotlin:
|
||||
src/Foo.kt
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Cleaning output files:
|
||||
out/production/module/Foo.class
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Foo.kt
|
||||
End of files
|
||||
After build round. Marked as dirty by Kotlin:
|
||||
src/FooImpl.kt
|
||||
Exit code: ADDITIONAL_PASS_REQUIRED
|
||||
------------------------------------------
|
||||
Cleaning output files:
|
||||
out/production/module/FooImpl.class
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
End of files
|
||||
Compiling files:
|
||||
src/FooImpl.kt
|
||||
End of files
|
||||
Exit code: OK
|
||||
------------------------------------------
|
||||
+1
@@ -0,0 +1 @@
|
||||
typealias Type = String
|
||||
+1
@@ -0,0 +1 @@
|
||||
typealias Type = Int
|
||||
Reference in New Issue
Block a user