K1: fix IIOBE in expect-actual checker with different type parameter number
#KT-54827 Fixed
This commit is contained in:
committed by
Space Team
parent
c5e5140c08
commit
82f1535007
+6
@@ -21004,6 +21004,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/incompatibles.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54827.kt")
|
||||
public void testKt54827() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("modifierApplicability.kt")
|
||||
public void testModifierApplicability() throws Exception {
|
||||
|
||||
+6
@@ -21004,6 +21004,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/incompatibles.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54827.kt")
|
||||
public void testKt54827() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("modifierApplicability.kt")
|
||||
public void testModifierApplicability() throws Exception {
|
||||
|
||||
+6
@@ -21004,6 +21004,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/incompatibles.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54827.kt")
|
||||
public void testKt54827() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("modifierApplicability.kt")
|
||||
public void testModifierApplicability() throws Exception {
|
||||
|
||||
+4
-3
@@ -80,9 +80,10 @@ object ExpectedActualResolver {
|
||||
if (container is ClassDescriptor) {
|
||||
val expectedClass = declaration.containingDeclaration as ClassDescriptor
|
||||
// TODO: this might not work for members of inner generic classes
|
||||
Substitutor(expectedClass.declaredTypeParameters, container.declaredTypeParameters)
|
||||
}
|
||||
else null
|
||||
if (expectedClass.declaredTypeParameters.size == container.declaredTypeParameters.size) {
|
||||
Substitutor(expectedClass.declaredTypeParameters, container.declaredTypeParameters)
|
||||
} else null
|
||||
} else null
|
||||
areCompatibleCallables(declaration, actual, parentSubstitutor = substitutor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
expect class SomeClass<T> {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual class SomeClass {
|
||||
actual fun foo() {}
|
||||
}<!>
|
||||
@@ -0,0 +1,11 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
expect class SomeClass<!NO_ACTUAL_FOR_EXPECT{JVM}!><T><!> {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
actual class <!ACTUAL_WITHOUT_EXPECT!>SomeClass<!> {
|
||||
actual fun foo() {}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public final expect class SomeClass</*0*/ T> {
|
||||
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
|
||||
}
|
||||
|
||||
// -- Module: <m1-jvm> --
|
||||
package
|
||||
|
||||
public final actual class SomeClass {
|
||||
public constructor SomeClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final actual fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
Generated
+6
@@ -21010,6 +21010,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/incompatibles.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt54827.kt")
|
||||
public void testKt54827() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/kt54827.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("modifierApplicability.kt")
|
||||
public void testModifierApplicability() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user