Mark incompatibilities related to the declaration signature as STRONG
This commit is contained in:
+3
-3
@@ -306,13 +306,13 @@ object ExpectedActualDeclarationChecker : DeclarationChecker {
|
||||
sealed class Incompatible(val reason: String?, val kind: IncompatibilityKind = IncompatibilityKind.WEAK) : Compatibility() {
|
||||
// Callables
|
||||
|
||||
object ParameterShape : Incompatible("parameter shapes are different (extension vs non-extension)")
|
||||
object ParameterShape : Incompatible("parameter shapes are different (extension vs non-extension)", IncompatibilityKind.STRONG)
|
||||
|
||||
object ParameterCount : Incompatible("number of value parameters is different", IncompatibilityKind.STRONG)
|
||||
object TypeParameterCount : Incompatible("number of type parameters is different")
|
||||
object TypeParameterCount : Incompatible("number of type parameters is different", IncompatibilityKind.STRONG)
|
||||
|
||||
object ParameterTypes : Incompatible("parameter types are different", IncompatibilityKind.STRONG)
|
||||
object ReturnType : Incompatible("return type is different")
|
||||
object ReturnType : Incompatible("return type is different", IncompatibilityKind.STRONG)
|
||||
|
||||
object ParameterNames : Incompatible("parameter names are different")
|
||||
object TypeParameterNames : Incompatible("names of type parameters are different")
|
||||
|
||||
+6
@@ -8,6 +8,9 @@ expect fun foo2<!JVM:NO_ACTUAL_FOR_EXPECT!>(x: Int)<!>
|
||||
|
||||
expect class NoArgConstructor()
|
||||
|
||||
expect fun foo3(): <!JVM:NO_ACTUAL_FOR_EXPECT!>Int<!>
|
||||
expect fun foo4<!JVM:NO_ACTUAL_FOR_EXPECT!>()<!>: Int
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
|
||||
// FILE: jvm.kt
|
||||
@@ -20,6 +23,9 @@ fun foo1(x: String) {}
|
||||
fun foo2(x: Int, y: Int) {}
|
||||
fun foo2(x: String) {}
|
||||
|
||||
actual fun foo3(): <!ACTUAL_WITHOUT_EXPECT!>String<!> = ""
|
||||
fun foo4(x: Int): String = ""
|
||||
|
||||
actual class NoArgConstructor {
|
||||
actual constructor()
|
||||
actual constructor<!ACTUAL_WITHOUT_EXPECT!>(x: Int)<!>
|
||||
|
||||
+4
@@ -3,6 +3,8 @@ package
|
||||
|
||||
public expect fun foo1(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public expect fun foo2(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public expect fun foo3(): kotlin.Int
|
||||
public expect fun foo4(): kotlin.Int
|
||||
|
||||
public final expect class NoArgConstructor {
|
||||
public constructor NoArgConstructor()
|
||||
@@ -20,6 +22,8 @@ public fun foo1(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public fun foo1(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public actual fun foo3(): kotlin.String
|
||||
public fun foo4(/*0*/ x: kotlin.Int): kotlin.String
|
||||
|
||||
public final actual class NoArgConstructor {
|
||||
public constructor NoArgConstructor()
|
||||
|
||||
+10
-5
@@ -6,18 +6,23 @@
|
||||
expect class Foo1
|
||||
expect class Foo2
|
||||
|
||||
expect fun foo1(): Int
|
||||
expect fun foo2(): Int
|
||||
expect fun foo3<!JVM:NO_ACTUAL_FOR_EXPECT!>()<!>: Int
|
||||
|
||||
expect val s: String
|
||||
|
||||
expect open class <!JVM:PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
|
||||
// FILE: jvm.kt
|
||||
|
||||
<!DECLARATION_WITH_INCOMPATIBLE_EXPECT!>interface<!> Foo1
|
||||
<!ACTUAL_WITHOUT_EXPECT!>interface<!> Foo1
|
||||
actual <!ACTUAL_WITHOUT_EXPECT!>interface<!> Foo2
|
||||
|
||||
actual fun foo1(): <!ACTUAL_WITHOUT_EXPECT!>String<!> = ""
|
||||
actual <!ACTUAL_WITHOUT_EXPECT!>var<!> s: String = "value"
|
||||
|
||||
fun <!ACTUAL_MISSING!>foo2<!>(): Int = 0
|
||||
fun foo3(x: Int): String = ""
|
||||
|
||||
actual class <!PACKAGE_OR_CLASSIFIER_REDECLARATION, ACTUAL_WITHOUT_EXPECT!>Foo3<!>
|
||||
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION, ACTUAL_WITHOUT_EXPECT!>Foo3<!>
|
||||
|
||||
+22
-4
@@ -1,9 +1,8 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public expect fun foo1(): kotlin.Int
|
||||
public expect val s: kotlin.String
|
||||
public expect fun foo2(): kotlin.Int
|
||||
public expect fun foo3(): kotlin.Int
|
||||
|
||||
public final expect class Foo1 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@@ -17,13 +16,18 @@ public final expect class Foo2 {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open expect class Foo3 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public actual fun foo1(): kotlin.String
|
||||
public actual var s: kotlin.String
|
||||
public fun foo2(): kotlin.Int
|
||||
public fun foo3(/*0*/ x: kotlin.Int): kotlin.String
|
||||
|
||||
public interface Foo1 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@@ -36,3 +40,17 @@ public actual interface Foo2 {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final actual class Foo3 {
|
||||
public constructor Foo3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo3 {
|
||||
public constructor Foo3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ open class Open {
|
||||
}
|
||||
|
||||
actual open class Foo1 : Open() {
|
||||
override val <!DECLARATION_WITH_INCOMPATIBLE_EXPECT!>x<!> = super.x
|
||||
override val <!ACTUAL_WITHOUT_EXPECT!>x<!> = super.x
|
||||
}
|
||||
|
||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo2<!> : Open()
|
||||
|
||||
+9
@@ -5,6 +5,15 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:1:14: error: actual class 'Foo' has no corresponding members for expected class members:
|
||||
|
||||
public final expect fun function(b: ByteArray): Int
|
||||
|
||||
The following declaration is incompatible because return type is different:
|
||||
public final actual fun function(b: ByteArray): Long
|
||||
|
||||
actual class Foo {
|
||||
^
|
||||
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:40: error: actual function 'function' has no corresponding expected declaration
|
||||
The following declaration is incompatible because return type is different:
|
||||
public final expect fun function(b: ByteArray): Int
|
||||
|
||||
@@ -8,6 +8,12 @@ expect fun f21(c: suspend Unit.() -> Unit)
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:1:12: error: expected function 'f1' has no actual declaration in module
|
||||
The following declaration is incompatible because return type is different:
|
||||
public actual fun f1(): String
|
||||
|
||||
expect fun f1()
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:5:14: error: expected function 'f3' has no actual declaration in module
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public actual fun f3(name: Double): Unit
|
||||
@@ -20,12 +26,30 @@ The following declaration is incompatible because parameter types are different:
|
||||
|
||||
expect fun String.f3ext()
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:8:14: error: expected function 'f4' has no actual declaration in module
|
||||
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
|
||||
public actual fun String.f4(): Unit
|
||||
|
||||
expect fun f4(name: String)
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:10:12: error: expected function 'f5' has no actual declaration in module
|
||||
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
|
||||
public actual fun f5(name: String): Unit
|
||||
|
||||
expect fun String.f5()
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:12:14: error: expected function 'f6' has no actual declaration in module
|
||||
The following declaration is incompatible because number of value parameters is different:
|
||||
public actual fun f6(p2: Int): Unit
|
||||
|
||||
expect fun f6(p1: String, p2: Int)
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:14:12: error: expected function 'f7' has no actual declaration in module
|
||||
The following declaration is incompatible because number of type parameters is different:
|
||||
public actual fun <K, V> f7(): Unit
|
||||
|
||||
expect fun <T> f7()
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:32:15: error: expected function 'f21' has no actual declaration in module
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public actual fun f21(c: Unit.() -> Unit): Unit
|
||||
|
||||
@@ -5,6 +5,12 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleClasses/common.kt:14:16: error: expected class 'C1' has no actual declaration in module
|
||||
The following declaration is incompatible because number of type parameters is different:
|
||||
public final actual class C1<A, Extra>
|
||||
|
||||
expect class C1<A>
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:8: error: actual interface 'PClass' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public final expect class PClass
|
||||
|
||||
Reference in New Issue
Block a user