Do not consider 'expect' class type constructors final
Because even a final expected class can be actualized with an open actual class and thus have subtypes in the platform code
This commit is contained in:
+2
@@ -6,6 +6,8 @@ expect class Foo
|
||||
|
||||
expect fun getFoo(): Foo
|
||||
|
||||
fun <T : Foo> bar() {} // no "Foo is final" warning should be here
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public fun </*0*/ T : Foo> bar(): kotlin.Unit
|
||||
public expect fun getFoo(): Foo
|
||||
|
||||
public final expect class Foo {
|
||||
@@ -13,6 +14,7 @@ public final expect class Foo {
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public fun </*0*/ T : Foo> bar(): kotlin.Unit
|
||||
public actual fun getFoo(): Foo
|
||||
|
||||
public final class Bar : Foo {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect class Foo { // also, it's important that Foo doesn't override equals
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun check(x1: Foo, x: Any) {
|
||||
if (x1 == x) {
|
||||
x.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
public fun check(/*0*/ x1: Foo, /*1*/ x: kotlin.Any): kotlin.Unit
|
||||
|
||||
public final expect class Foo {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final expect fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user