Do not override collection stub, if the override is suspend
but the stub is not. The other way around should be OK. #KT-52237 Fixed
This commit is contained in:
+12
@@ -10613,6 +10613,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+1
@@ -205,6 +205,7 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl
|
|||||||
if (superFun.name != overridingFun.name) return false
|
if (superFun.name != overridingFun.name) return false
|
||||||
if (superFun.typeParameters.size != overridingFun.typeParameters.size) return false
|
if (superFun.typeParameters.size != overridingFun.typeParameters.size) return false
|
||||||
if (superFun.valueParameters.size != overridingFun.valueParameters.size) return false
|
if (superFun.valueParameters.size != overridingFun.valueParameters.size) return false
|
||||||
|
if (!superFun.isSuspend && overridingFun.isSuspend) return false
|
||||||
|
|
||||||
val typeChecker = createTypeCheckerState(superFun, overridingFun)
|
val typeChecker = createTypeCheckerState(superFun, overridingFun)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
|
abstract class SuspendingMutableMap<K : Any, V : Any>(
|
||||||
|
protected val map: MutableMap<K, V>,
|
||||||
|
) : Map<K, V> {
|
||||||
|
abstract suspend fun clear()
|
||||||
|
|
||||||
|
override val entries: Set<Map.Entry<K, V>>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val keys: Set<K>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val size: Int
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val values: Collection<V>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
|
||||||
|
override fun isEmpty(): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun get(key: K): V? {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun containsValue(value: V): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun containsKey(key: K): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||||
|
it.getOrThrow()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
builder {
|
||||||
|
val m = mutableMapOf(1 to 1)
|
||||||
|
val map = object: SuspendingMutableMap<Int, Int>(m) {
|
||||||
|
override suspend fun clear() {
|
||||||
|
map.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.clear()
|
||||||
|
if (m.isNotEmpty()) error ("FAIL")
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
import kotlin.coroutines.*
|
||||||
|
|
||||||
|
class SuspendingMutableMap<K : Any, V : Any>(
|
||||||
|
private val map: MutableMap<K, V>,
|
||||||
|
) : Map<K, V> {
|
||||||
|
suspend fun clear() {
|
||||||
|
map.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
override val entries: Set<Map.Entry<K, V>>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val keys: Set<K>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val size: Int
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
override val values: Collection<V>
|
||||||
|
get() = TODO("Not yet implemented")
|
||||||
|
|
||||||
|
override fun isEmpty(): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun get(key: K): V? {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun containsValue(value: V): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun containsKey(key: K): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun builder(c: suspend () -> Unit) {
|
||||||
|
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||||
|
it.getOrThrow()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
builder {
|
||||||
|
val m = mutableMapOf(1 to 1)
|
||||||
|
val map = SuspendingMutableMap(m)
|
||||||
|
map.clear()
|
||||||
|
if (m.isNotEmpty()) error ("FAIL")
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -10493,6 +10493,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+12
@@ -10613,6 +10613,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+10
@@ -8275,6 +8275,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/coroutines/controlFlow")
|
@TestMetadata("compiler/testData/codegen/box/coroutines/controlFlow")
|
||||||
|
|||||||
+12
@@ -7549,6 +7549,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+12
@@ -7591,6 +7591,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+10
@@ -6665,6 +6665,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/coroutines/controlFlow")
|
@TestMetadata("compiler/testData/codegen/box/coroutines/controlFlow")
|
||||||
|
|||||||
+12
@@ -8435,6 +8435,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
|||||||
public void testLambdaWithMultipleParameters() throws Exception {
|
public void testLambdaWithMultipleParameters() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
runTest("compiler/testData/codegen/box/coroutines/bridges/lambdaWithMultipleParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendAbstractClear.kt")
|
||||||
|
public void testMapSuspendAbstractClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendAbstractClear.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("mapSuspendClear.kt")
|
||||||
|
public void testMapSuspendClear() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/bridges/mapSuspendClear.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user