Fix checker for -Xjvm-defaults
This commit is contained in:
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/library/a.kt
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
package base
|
||||
|
||||
interface UExpression {
|
||||
fun evaluate(): Any? = "fail"
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/source.kt:12:7: error: explicit override is required for 'public open fun evaluate(): Any? defined in KotlinUBinaryExpressionWithType' in the '-Xjvm-default=all-compatibility' mode. Otherwise, implicit class override 'public open fun evaluate(): Any? defined in KotlinAbstractUExpression' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime
|
||||
class KotlinUBinaryExpressionWithType : KotlinAbstractUExpression(), KotlinEvaluatableUElement {}
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import base.*
|
||||
|
||||
interface KotlinEvaluatableUElement : UExpression {
|
||||
override fun evaluate(): Any? {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
abstract class KotlinAbstractUExpression() : UExpression {}
|
||||
|
||||
@JvmDefaultWithoutCompatibility
|
||||
class KotlinUBinaryExpressionWithType : KotlinAbstractUExpression(), KotlinEvaluatableUElement {}
|
||||
|
||||
fun box(): String {
|
||||
val foo = KotlinUBinaryExpressionWithType()
|
||||
return foo.evaluate() as String
|
||||
}
|
||||
Reference in New Issue
Block a user