[Test] Fix various tests according to switching to kotlin 1.5

This commit is contained in:
Dmitriy Novozhilov
2021-01-15 12:04:05 +03:00
parent 64100eec07
commit 4f8b12c96f
9 changed files with 25 additions and 24 deletions
@@ -3,6 +3,7 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/main.kt] => [[Temp]/hello.jar]
[kotlinc] warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
[kotlinc] [TestData]/main.kt:4:21: error: 'break' and 'continue' are not allowed in 'when' statements. Consider using labels to continue/break from the outer loop
[kotlinc] true -> break
[kotlinc] ^
@@ -4,7 +4,7 @@ Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] logging: using Kotlin home directory [KotlinProjectHome]/dist/kotlinc
[kotlinc] logging: using old JVM backend
[kotlinc] logging: using JVM IR backend
[kotlinc] logging: configuring the compilation environment
[kotlinc] logging: configure scripting: Added template org.jetbrains.kotlin.mainKts.MainKtsScript from [[CompilerLib]/kotlin-main-kts.jar, [CompilerLib]/kotlin-reflect.jar, [CompilerLib]/kotlin-script-runtime.jar, [CompilerLib]/kotlin-stdlib.jar]
@@ -16,7 +16,7 @@ private const val EMPTY_MAIN_FUN = "fun main() {}"
class CustomCliTest : TestCaseWithTmpdir() {
fun testArgfileWithNonTrivialWhitespaces() {
val text = "-include-runtime\r\n\t\t-language-version\n\t1.2\r\n-version"
val text = "-include-runtime\r\n\t\t-language-version\n\t1.5\r\n-version"
val argfile = File(tmpdir, "argfile").apply { writeText(text, Charsets.UTF_8) }
CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("@" + argfile.absolutePath))
}
+10 -10
View File
@@ -1,18 +1,18 @@
// IGNORE_FIR
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</info> class <info textAttributesKey="KOTLIN_CLASS">Foo</info> {
<info textAttributesKey="KOTLIN_KEYWORD">constructor</info>(<warning descr="[UNUSED_PARAMETER] Parameter 'i' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><info textAttributesKey="KOTLIN_PARAMETER">i</info></warning>: <info textAttributesKey="KOTLIN_CLASS">Int</info>)
<info descr="null" textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</info> class <info descr="null" textAttributesKey="KOTLIN_CLASS">Foo</info> {
<info descr="null" textAttributesKey="KOTLIN_KEYWORD">constructor</info>(<warning descr="[UNUSED_PARAMETER] Parameter 'i' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><info descr="null" textAttributesKey="KOTLIN_PARAMETER">i</info></warning>: <info descr="null" textAttributesKey="KOTLIN_CLASS">Int</info>)
}
class <info textAttributesKey="KOTLIN_CLASS">Bar</info> : <info textAttributesKey="KOTLIN_CLASS">Foo</info> {
<error descr="[EXPLICIT_DELEGATION_CALL_REQUIRED] Explicit 'this' or 'super' call is required. There is no constructor in superclass that can be called without arguments" textAttributesKey="ERRORS_ATTRIBUTES"><info textAttributesKey="KOTLIN_KEYWORD">constructor</info>(s: String)</error>
class <info descr="null" textAttributesKey="KOTLIN_CLASS">Bar</info> : <info descr="null" textAttributesKey="KOTLIN_CLASS">Foo</info> {
<error descr="[EXPLICIT_DELEGATION_CALL_REQUIRED] Explicit 'this' or 'super' call is required. There is no constructor in superclass that can be called without arguments" textAttributesKey="ERRORS_ATTRIBUTES"><info descr="null" textAttributesKey="KOTLIN_KEYWORD">constructor</info>(s: String)</error>
}
class <info textAttributesKey="KOTLIN_CLASS">F</info>(<warning descr="[UNUSED_PARAMETER] Parameter 'foo' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><info textAttributesKey="KOTLIN_PARAMETER">foo</info></warning>: <info textAttributesKey="KOTLIN_CLASS">String</info>) {
<error descr="[PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED] Primary constructor call expected" textAttributesKey="ERRORS_ATTRIBUTES"><info textAttributesKey="KOTLIN_KEYWORD">constructor</info>()</error> {}
class <info descr="null" textAttributesKey="KOTLIN_CLASS">F</info>(<warning descr="[UNUSED_PARAMETER] Parameter 'foo' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><info descr="null" textAttributesKey="KOTLIN_PARAMETER">foo</info></warning>: <info descr="null" textAttributesKey="KOTLIN_CLASS">String</info>) {
<error descr="[PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED] Primary constructor call expected" textAttributesKey="ERRORS_ATTRIBUTES"><info descr="null" textAttributesKey="KOTLIN_KEYWORD">constructor</info>()</error> {}
}
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">enum</info> class <info textAttributesKey="KOTLIN_ENUM">E</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info>: <info textAttributesKey="KOTLIN_CLASS">String</info>) {
<info textAttributesKey="KOTLIN_ENUM_ENTRY">A</info>;
<warning descr="[PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED_IN_ENUM] Primary constructor call expected. It's going to be an error in 1.5." textAttributesKey="WARNING_ATTRIBUTES"><info textAttributesKey="KOTLIN_KEYWORD">constructor</info>()</warning>
}
<info descr="null" textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">enum</info> class <info descr="null" textAttributesKey="KOTLIN_ENUM">E</info>(val <info descr="null" textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info>: <info descr="null" textAttributesKey="KOTLIN_CLASS">String</info>) {
<info descr="null" textAttributesKey="KOTLIN_ENUM_ENTRY">A</info>;
<error descr="[PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED] Primary constructor call expected" textAttributesKey="ERRORS_ATTRIBUTES"><info descr="null" textAttributesKey="KOTLIN_KEYWORD">constructor</info>()</error>
}
@@ -458,7 +458,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
assertEquals(1, myProject.modules.size)
val module = myProject.modules.first()
val args = module.kotlinCompilerArguments
args.apiVersion = "1.2"
args.apiVersion = "1.4"
myProject.kotlinCommonCompilerArguments = args
buildAllModules().assertSuccessful()
@@ -458,7 +458,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
assertEquals(1, myProject.modules.size)
val module = myProject.modules.first()
val args = module.kotlinCompilerArguments
args.apiVersion = "1.2"
args.apiVersion = "1.4"
myProject.kotlinCommonCompilerArguments = args
buildAllModules().assertSuccessful()
@@ -6,14 +6,14 @@ interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToo
/**
* Allow using declarations only from the specified version of bundled libraries
* Possible values: "1.2 (DEPRECATED)", "1.3", "1.4", "1.5 (EXPERIMENTAL)", "1.6 (EXPERIMENTAL)"
* Possible values: "1.3 (DEPRECATED)", "1.4", "1.5", "1.6 (EXPERIMENTAL)"
* Default value: null
*/
var apiVersion: kotlin.String?
/**
* Provide source compatibility with the specified version of Kotlin
* Possible values: "1.2 (DEPRECATED)", "1.3", "1.4", "1.5 (EXPERIMENTAL)", "1.6 (EXPERIMENTAL)"
* Possible values: "1.3 (DEPRECATED)", "1.4", "1.5", "1.6 (EXPERIMENTAL)"
* Default value: null
*/
var languageVersion: kotlin.String?
@@ -467,18 +467,18 @@ class KotlinGradleIT : BaseGradleIT() {
}
// check the arguments are always passed if specified explicitly
updateBuildGradle("1.2", "1.2")
updateBuildGradle("1.4", "1.4")
project.build("clean", "compileKotlin") {
assertSuccessful()
assertContains("-language-version 1.2")
assertContains("-api-version 1.2")
assertContains("-language-version 1.4")
assertContains("-api-version 1.4")
}
updateBuildGradle("1.3", "1.3")
updateBuildGradle("1.5", "1.5")
project.build("clean", "compileKotlin") {
assertSuccessful()
assertContains("-language-version 1.3")
assertContains("-api-version 1.3")
assertContains("-language-version 1.5")
assertContains("-api-version 1.5")
}
}
@@ -12,7 +12,7 @@ class UpToDateIT : BaseGradleIT() {
testMutations(
*propertyMutationChain(
"compileKotlin.kotlinOptions.languageVersion",
"null", "'1.3'", "'1.2'", "null"
"null", "'1.5'", "'1.4'", "null"
)
)
}
@@ -22,7 +22,7 @@ class UpToDateIT : BaseGradleIT() {
testMutations(
*propertyMutationChain(
"compileKotlin.kotlinOptions.apiVersion",
"null", "'1.3'", "'1.2'", "null"
"null", "'1.5'", "'1.4'", "null"
)
)
}