Minor. Add regression test
#KT-45685 Fixed
This commit is contained in:
+6
@@ -18708,6 +18708,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
interface Flow<out T> {
|
||||
suspend fun collect(collector: FlowCollector<T>)
|
||||
}
|
||||
|
||||
interface FlowCollector<in T> {
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
|
||||
suspend inline fun <T> Flow<T>.collect(crossinline action: suspend (value: T) -> Unit): Unit =
|
||||
collect(object : FlowCollector<T> {
|
||||
override suspend fun emit(value: T) = action(value)
|
||||
})
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
it.getOrThrow()
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val flow: Flow<Result<String>> = object : Flow<Result<String>> {
|
||||
override suspend fun collect(collector: FlowCollector<Result<String>>) {
|
||||
collector.emit(Result.success("OK"))
|
||||
}
|
||||
}
|
||||
|
||||
var res = "FAIL"
|
||||
builder {
|
||||
flow.collect { result ->
|
||||
result.onSuccess { text ->
|
||||
res = text
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
+6
@@ -18684,6 +18684,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
|
||||
+6
@@ -18708,6 +18708,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
|
||||
+5
@@ -15480,6 +15480,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxValueFromPlatformType.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -13579,6 +13579,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxValueFromPlatformType.kt");
|
||||
|
||||
Generated
+5
@@ -12985,6 +12985,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxValueFromPlatformType.kt");
|
||||
|
||||
Generated
+5
@@ -13050,6 +13050,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxValueFromPlatformType.kt")
|
||||
public void testUnboxValueFromPlatformType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxValueFromPlatformType.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -7165,6 +7165,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxResultParameterWhenCapturingToCrossinlineLambda.kt")
|
||||
public void testUnboxResultParameterWhenCapturingToCrossinlineLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxResultParameterWhenCapturingToCrossinlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useInlineClassesInsideElvisOperator.kt")
|
||||
public void testUseInlineClassesInsideElvisOperator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useInlineClassesInsideElvisOperator.kt");
|
||||
|
||||
Reference in New Issue
Block a user