diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt index cd52ee48afc..7bf2cd7998b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt @@ -161,9 +161,10 @@ private fun findSuperImplementationForStubDelegation( // Implementation in super-class already has proper signature if (signatureByDescriptor(function) == signatureByDescriptor(implementation.descriptor)) return null - assert(function.modality == Modality.OPEN) { - "Should generate stubs only for non-abstract built-ins, but ${function.name} is ${function.modality}" - } +// TODO: Enable the assertion once KT-34507 is fixed +// assert(function.modality == Modality.OPEN) { +// "Should generate stubs only for non-abstract built-ins, but ${function.name} is ${function.modality}" +// } return implementation.descriptor } diff --git a/compiler/testData/codegen/box/collections/removeClash.kt b/compiler/testData/codegen/box/collections/removeClash.kt new file mode 100644 index 00000000000..da848e744c8 --- /dev/null +++ b/compiler/testData/codegen/box/collections/removeClash.kt @@ -0,0 +1,15 @@ +class Queue(override val size: Int) : Collection { + override fun contains(element: T): Boolean = TODO() + + override fun containsAll(elements: Collection): Boolean = TODO() + + override fun isEmpty(): Boolean = TODO() + + override fun iterator(): Iterator = TODO() + + fun remove(v: T): Any = v as Any +} + +fun box(): String { + return Queue(1).remove("OK") as String +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2c6feb4038c..92704272421 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -4458,6 +4458,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/collections/removeAtInt.kt"); } + @TestMetadata("removeClash.kt") + public void testRemoveClash() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClash.kt"); + } + @TestMetadata("strList.kt") public void testStrList() throws Exception { runTest("compiler/testData/codegen/box/collections/strList.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4a03248adcd..c6f5f72e28d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -4458,6 +4458,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/collections/removeAtInt.kt"); } + @TestMetadata("removeClash.kt") + public void testRemoveClash() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClash.kt"); + } + @TestMetadata("strList.kt") public void testStrList() throws Exception { runTest("compiler/testData/codegen/box/collections/strList.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 1a46a991f81..e013aaa4c13 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -4428,6 +4428,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/collections/removeAtInt.kt"); } + @TestMetadata("removeClash.kt") + public void testRemoveClash() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClash.kt"); + } + @TestMetadata("strList.kt") public void testStrList() throws Exception { runTest("compiler/testData/codegen/box/collections/strList.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 9af806924fd..870d0638cb2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -3677,6 +3677,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testInSetWithSmartCast() throws Exception { runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); } + + @TestMetadata("removeClash.kt") + public void testRemoveClash() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClash.kt"); + } } @TestMetadata("compiler/testData/codegen/box/compatibility") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index cdee47d8585..6081d939baf 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -3687,6 +3687,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testInSetWithSmartCast() throws Exception { runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); } + + @TestMetadata("removeClash.kt") + public void testRemoveClash() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClash.kt"); + } } @TestMetadata("compiler/testData/codegen/box/compatibility")