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:
-1
@@ -114,7 +114,6 @@ class SyntheticClassOrObjectDescriptor(
|
||||
|
||||
private inner class SyntheticTypeConstructor(storageManager: StorageManager) : AbstractClassTypeConstructor(storageManager) {
|
||||
override fun getParameters(): List<TypeParameterDescriptor> = emptyList()
|
||||
override fun isFinal(): Boolean = true
|
||||
override fun isDenotable(): Boolean = true
|
||||
override fun getDeclarationDescriptor(): ClassDescriptor = thisDescriptor
|
||||
override fun computeSupertypes(): Collection<KotlinType> = syntheticSupertypes
|
||||
|
||||
-5
@@ -650,11 +650,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
return parameters.invoke();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return getModality() == Modality.FINAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDenotable() {
|
||||
return true;
|
||||
|
||||
+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
|
||||
}
|
||||
@@ -14241,6 +14241,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastOnExpectClass.kt")
|
||||
public void testSmartCastOnExpectClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("superClass.kt")
|
||||
public void testSuperClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt");
|
||||
|
||||
+6
@@ -14241,6 +14241,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastOnExpectClass.kt")
|
||||
public void testSmartCastOnExpectClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("superClass.kt")
|
||||
public void testSuperClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/superClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user