IR: produce new fake override for each static member
This is an addition to d4278250e6. Apparently we still need to produce
a new fake override for each inherited static member, because otherwise
we would try to determine the most specific return type, maximum
visibility, etc, all of which makes no sense for static members.
#KT-66152 Fixed
This commit is contained in:
committed by
Space Team
parent
f204293e4d
commit
5cda3fba12
+6
@@ -34095,6 +34095,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -34095,6 +34095,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
@@ -173,7 +173,9 @@ class IrFakeOverrideBuilder(
|
||||
|
||||
val addedFakeOverrides = mutableListOf<IrOverridableMember>()
|
||||
if (isStaticMembers) {
|
||||
createAndBindFakeOverride(notOverridden.toList(), current, addedFakeOverrides, compatibilityMode)
|
||||
for (member in notOverridden) {
|
||||
createAndBindFakeOverride(listOf(member), current, addedFakeOverrides, compatibilityMode)
|
||||
}
|
||||
} else {
|
||||
createAndBindFakeOverrides(current, notOverridden, addedFakeOverrides, compatibilityMode)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.ir.types
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.utils.newHashMapWithExpectedSize
|
||||
|
||||
@@ -16,7 +17,7 @@ class IrTypeSystemContextWithAdditionalAxioms(
|
||||
) : IrTypeSystemContext by typeSystem {
|
||||
init {
|
||||
assert(firstParameters.size == secondParameters.size) {
|
||||
"different length of type parameter lists: $firstParameters vs $secondParameters"
|
||||
"different length of type parameter lists: ${firstParameters.map { it.render() }} vs ${secondParameters.map { it.render() }}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: A.java
|
||||
public class A {
|
||||
public static <T> String f(T x) {
|
||||
return "Fail";
|
||||
}
|
||||
|
||||
public static String f(CharSequence c) {
|
||||
return c.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
class B : A() {
|
||||
fun g(): String = f("OK")
|
||||
}
|
||||
|
||||
fun box(): String = B().g()
|
||||
+6
@@ -33964,6 +33964,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -32104,6 +32104,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+6
@@ -33964,6 +33964,12 @@ public class FirBlackBoxCodegenTestWithInlineScopesGenerated extends AbstractFir
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
|
||||
+5
@@ -28823,6 +28823,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritTwoStaticMethods3.kt")
|
||||
public void testInheritTwoStaticMethods3() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/inheritTwoStaticMethods3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jkkjk.kt")
|
||||
public void testJkkjk() {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/statics/jkkjk.kt");
|
||||
|
||||
Reference in New Issue
Block a user