Change allConstants test

Currently, FIR compilation of `const val b: Byte = 50 + 50` shows an error, but old compiler doesn't (it shows only warning). Since this is an incremental test, it should not be affected by compiler errors, but should only test for .kt usage without recompilation.

#KT-54991 In Progress
This commit is contained in:
Aleksei.Cherepanov
2022-11-30 15:21:11 +01:00
committed by Space Team
parent a0fa438735
commit 090a58ccc4
26 changed files with 200 additions and 130 deletions
@@ -58,11 +58,6 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^.*Expect.*"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -57,11 +57,6 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), false);
}
@@ -86,6 +81,11 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -57,11 +57,6 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), false);
}
@@ -86,6 +81,11 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -57,11 +57,6 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^sealed.*)|(.*SinceK2)"), false);
}
@@ -86,6 +81,11 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -57,11 +57,6 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("^sealed.*"), false);
}
@@ -91,6 +86,11 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), TargetBackend.JVM_IR, false);
}
@@ -87,6 +82,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -727,11 +727,6 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile(".*SinceK2"), TargetBackend.JVM_IR, false);
}
@@ -756,6 +751,11 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalK2FirICLightTreeJvmJpsTestGenerated extends AbstractIncr
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)|(^companionConstantChanged)"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalK2FirICLightTreeJvmJpsTestGenerated extends AbstractIncr
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalK2JvmJpsTestGenerated extends AbstractIncrementalK2JvmJp
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)|(^companionConstantChanged)"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalK2JvmJpsTestGenerated extends AbstractIncrementalK2JvmJp
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -58,11 +58,6 @@ public class IncrementalK2LightTreeJvmJpsTestGenerated extends AbstractIncrement
runTest("jps/jps-plugin/testData/incremental/pureKotlin/addTopLevelTypeAlias/");
}
@TestMetadata("allConstants")
public void testAllConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/allConstants/");
}
public void testAllFilesPresentInPureKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/pureKotlin"), Pattern.compile("^([^\\.]+)$"), Pattern.compile("(^.*Expect.*)|(^companionConstantChanged)"), TargetBackend.JVM_IR, false);
}
@@ -92,6 +87,11 @@ public class IncrementalK2LightTreeJvmJpsTestGenerated extends AbstractIncrement
runTest("jps/jps-plugin/testData/incremental/pureKotlin/changeWithRemovingUsage/");
}
@TestMetadata("checkConstants")
public void testCheckConstants() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/checkConstants/");
}
@TestMetadata("classInlineFunctionChanged")
public void testClassInlineFunctionChanged() throws Exception {
runTest("jps/jps-plugin/testData/incremental/pureKotlin/classInlineFunctionChanged/");
@@ -1,34 +0,0 @@
================ Step #1 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #2 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
After build round. Marked as dirty by Kotlin:
src/usage.kt
Exit code: ADDITIONAL_PASS_REQUIRED
------------------------------------------
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/Usage.class
End of files
Compiling files:
src/usage.kt
End of files
Exit code: OK
------------------------------------------
@@ -1,19 +0,0 @@
================ Step #1 =================
Compiling files:
src/const.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Type mismatch: inferred type is kotlin/Int but kotlin/Byte was expected
Type mismatch: inferred type is kotlin/Int but kotlin/Short was expected
================ Step #2 =================
Compiling files:
src/const.kt
src/usage.kt
End of files
Exit code: OK
@@ -1,4 +0,0 @@
package test
@Deprecated("$b $s $i $l $f $d $bb $c $str")
class Usage
@@ -0,0 +1,94 @@
================ Step #1 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #2 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #3 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #4 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #5 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #6 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
Exit code: OK
------------------------------------------
================ Step #7 =================
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
End of files
Compiling files:
src/const.kt
End of files
After build round. Marked as dirty by Kotlin:
src/usage.kt
Exit code: ADDITIONAL_PASS_REQUIRED
------------------------------------------
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/Usage.class
End of files
Compiling files:
src/usage.kt
End of files
Exit code: OK
------------------------------------------
@@ -1,12 +1,8 @@
package test
const val b: Byte = 100
const val s: Short = 20000
const val i: Int = 2000000
const val l: Long = 2000000000000L
const val f: Float = 3.14f
const val d: Double = 3.14
const val bb: Boolean = true
const val c: Char = '\u03c0' // pi symbol
const val str: String = ":)"
@@ -0,0 +1,8 @@
package test
const val i: Int = 1000000 + 1000000
const val l: Long = 2000000000000L
const val f: Float = 3.14f
const val d: Double = 3.14
const val bb: Boolean = true
const val str: String = ":)"
@@ -0,0 +1,8 @@
package test
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 3.14f
const val d: Double = 3.14
const val bb: Boolean = true
const val str: String = ":)"
@@ -0,0 +1,8 @@
package test
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 0.0f + 3.14f
const val d: Double = 3.14
const val bb: Boolean = true
const val str: String = ":)"
@@ -0,0 +1,8 @@
package test
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 0.0f + 3.14f
const val d: Double = 0.0 + 3.14
const val bb: Boolean = true
const val str: String = ":)"
@@ -1,12 +1,9 @@
package test
const val b: Byte = 50 + 50
const val s: Short = 10000 + 10000
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 0.0f + 3.14f
const val d: Double = 0.0 + 3.14
const val bb: Boolean = !false
const val c: Char = '\u03c0' // pi symbol
const val str: String = ":)"
@@ -0,0 +1,8 @@
package test
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 0.0f + 3.14f
const val d: Double = 0.0 + 3.14
const val bb: Boolean = !false
const val str: String = ":" + ")"
@@ -1,12 +1,8 @@
package test
const val b: Byte = 0
const val s: Short = 0
const val i: Int = 0
const val l: Long = 0
const val f: Float = 0.0f
const val d: Double = 0.0
const val bb: Boolean = false
const val c: Char = 'x'
const val str: String = ":("
const val str: String = ""
@@ -0,0 +1,4 @@
package test
@Deprecated("$i $l $f $d $bb $str")
class Usage