JVM_IR add test for KT-47300
This commit is contained in:
committed by
teamcityserver
parent
1cd75b1e82
commit
ce107d06d4
+6
@@ -7550,6 +7550,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
|
||||
data class Content<out T>(val value: T)
|
||||
|
||||
fun <T> content(value: T) = Content(value)
|
||||
|
||||
@ExperimentalContracts
|
||||
inline fun <R, T : R> Content<T>.getOrElse(
|
||||
onException: (exception: Exception) -> R,
|
||||
): R = fold({ it }, onException)
|
||||
|
||||
@ExperimentalContracts
|
||||
inline fun <R, T> Content<T>.fold(
|
||||
onContent: (value: T) -> R,
|
||||
onException: (exception: Exception) -> R,
|
||||
): R {
|
||||
contract {
|
||||
callsInPlace(onContent, InvocationKind.AT_MOST_ONCE)
|
||||
callsInPlace(onException, InvocationKind.AT_MOST_ONCE)
|
||||
}
|
||||
return onContent(value)
|
||||
}
|
||||
|
||||
|
||||
@ExperimentalContracts
|
||||
fun box(): String {
|
||||
val t = content(1).getOrElse { 2 }
|
||||
if (t != 1) return "Failed: $t"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -7550,6 +7550,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
|
||||
+6
@@ -7550,6 +7550,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
|
||||
+5
@@ -5749,6 +5749,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -5023,6 +5023,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
|
||||
|
||||
Generated
+5
@@ -4429,6 +4429,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
|
||||
|
||||
Generated
+5
@@ -4429,6 +4429,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47168.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47300.kt")
|
||||
public void testKt47300() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/kt47300.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaParameter.kt")
|
||||
public void testLambdaParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user