Report SUPERTYPE_NOT_INITIALIZED even if no constructors in superclass
Before this commit, expect super-class without constructors did not provoke SUPERTYPE_NOT_INITIALIZED. However, it should, but only if sub-type is normal class (not an expect one). So #KT-24597 Fixed
This commit is contained in:
@@ -372,7 +372,6 @@ public class BodyResolver {
|
|||||||
if (descriptor.getKind() != ClassKind.INTERFACE &&
|
if (descriptor.getKind() != ClassKind.INTERFACE &&
|
||||||
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
|
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
|
||||||
superClass.getKind() != ClassKind.INTERFACE &&
|
superClass.getKind() != ClassKind.INTERFACE &&
|
||||||
!superClass.getConstructors().isEmpty() &&
|
|
||||||
!descriptor.isExpect() && !isEffectivelyExternal(descriptor) &&
|
!descriptor.isExpect() && !isEffectivelyExternal(descriptor) &&
|
||||||
!ErrorUtils.isError(superClass)
|
!ErrorUtils.isError(superClass)
|
||||||
) {
|
) {
|
||||||
|
|||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
|
||||||
|
expect open class A
|
||||||
|
expect class B : A
|
||||||
|
open class C : <!SUPERTYPE_NOT_INITIALIZED, JVM:SUPERTYPE_NOT_INITIALIZED!>A<!>
|
||||||
|
|
||||||
|
// MODULE: m1-jvm(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
|
||||||
|
actual open class A
|
||||||
|
actual class B : A()
|
||||||
Vendored
+46
@@ -0,0 +1,46 @@
|
|||||||
|
// -- Module: <m1-common> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public open expect class A {
|
||||||
|
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 expect class B : A {
|
||||||
|
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 open class C : A {
|
||||||
|
public constructor C()
|
||||||
|
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: <m1-jvm> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public open actual class A {
|
||||||
|
public constructor A()
|
||||||
|
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 actual class B : A {
|
||||||
|
public constructor B()
|
||||||
|
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 open class C : A {
|
||||||
|
public constructor C()
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -13055,6 +13055,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/headerClass"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/headerClass"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("baseExpectClassWithoutConstructor.kt")
|
||||||
|
public void testBaseExpectClassWithoutConstructor() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/baseExpectClassWithoutConstructor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classKinds.kt")
|
@TestMetadata("classKinds.kt")
|
||||||
public void testClassKinds() throws Exception {
|
public void testClassKinds() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/classKinds.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/classKinds.kt");
|
||||||
|
|||||||
Generated
+5
@@ -13055,6 +13055,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/headerClass"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/headerClass"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("baseExpectClassWithoutConstructor.kt")
|
||||||
|
public void testBaseExpectClassWithoutConstructor() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/baseExpectClassWithoutConstructor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classKinds.kt")
|
@TestMetadata("classKinds.kt")
|
||||||
public void testClassKinds() throws Exception {
|
public void testClassKinds() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/classKinds.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerClass/classKinds.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user