Add test for Obsolete issues
#KT-15956 Obsolete #KT-15751 Obsolete #KT-16417 Obsolete #KT-21787 Obsolete
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// WITH_RUNTIME
|
||||
class Container {
|
||||
var id: Int? = null
|
||||
}
|
||||
|
||||
class TestClass {
|
||||
|
||||
private fun createContainer(id: Int): Container { val q = Container(); q.id = id; return q }
|
||||
fun createContainers1(from: Int = 0, to: Int = 100) = (from .. to).map(::createContainer)
|
||||
fun createContainers2(from: Int = 0, to: Int = 100): List<Container> { return (from .. to).map(::createContainer) }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = TestClass()
|
||||
val containers1 = testClass.createContainers1().size
|
||||
if (containers1 != 101) return "fail 1: $containers1"
|
||||
|
||||
val containers2 = testClass.createContainers2().size
|
||||
if (containers2 != 101) return "fail 2: $containers2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// FILE: 1.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
class A {
|
||||
val foo = fun(call: () -> Unit) =
|
||||
ext {
|
||||
fun send() {
|
||||
call()
|
||||
}
|
||||
|
||||
bar {
|
||||
send()
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(body: () -> Unit) {
|
||||
body()
|
||||
}
|
||||
|
||||
inline fun A.ext(init: X.() -> Unit) {
|
||||
return X().init()
|
||||
}
|
||||
|
||||
class X
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
A().foo { result = "OK" }
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// FILE: 1.kt
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
public inline fun <T> T.myalso(block: (T) -> Unit): T {
|
||||
block(this)
|
||||
return this
|
||||
}
|
||||
|
||||
public inline fun <T, R : Any> Iterable<T>.mymapNotNull(transform: (T) -> R?): List<R> {
|
||||
return mapNotNullTo(ArrayList<R>(), transform)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
var result = -1;
|
||||
|
||||
fun box(): String {
|
||||
fff()
|
||||
return if (result == 1) "OK" else "fail $result"
|
||||
}
|
||||
|
||||
fun fff(): Int {
|
||||
val y = 0
|
||||
return 0.myalso {
|
||||
fun increase(x: Int): Int = x + y
|
||||
|
||||
val values = listOf(1).mymapNotNull { something(::increase, it) }
|
||||
result = values[0]!!
|
||||
}
|
||||
}
|
||||
|
||||
fun something(increase: (Int) -> Int, x: Int): Int? {
|
||||
return increase(x)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: 1.kt
|
||||
class A {
|
||||
var field = 0
|
||||
|
||||
inline fun a(f: () -> Any): Any {
|
||||
try {
|
||||
val value = f()
|
||||
return value
|
||||
} finally {
|
||||
field--
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun b(rule: () -> Unit) {
|
||||
try {
|
||||
rule()
|
||||
} catch (fail: Throwable) {}
|
||||
}
|
||||
|
||||
fun c(vararg functions: () -> Any): Any = a {
|
||||
for (function in functions) {
|
||||
b { return function() }
|
||||
}
|
||||
throw RuntimeException()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
a.c ({ "OK" })
|
||||
if (a.field != -1) return "fail 1: ${a.field}"
|
||||
|
||||
try {
|
||||
a.c({ null!! })
|
||||
} catch (e: RuntimeException) {
|
||||
// OK
|
||||
} catch (e: Throwable) {
|
||||
return "fail 2: $e"
|
||||
}
|
||||
|
||||
return a.c ({ "OK" }) as String
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// FILE: 1.kt
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package foo
|
||||
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
inline fun <reified T : Any> f(): String {
|
||||
var result = ""
|
||||
for (p in T::class.primaryConstructor!!.parameters.sortedBy { it.index }) {
|
||||
result += p.name
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import foo.*
|
||||
|
||||
class A(val O: Int, val K: Int)
|
||||
|
||||
fun box(): String {
|
||||
return f<A>()
|
||||
}
|
||||
+5
@@ -2085,6 +2085,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt21787.kt")
|
||||
public void testKt21787() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/kt21787.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedConstructorFromClass.kt")
|
||||
public void testNestedConstructorFromClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||
|
||||
+20
@@ -136,6 +136,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751.kt")
|
||||
public void testKt15751() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt15751.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16193.kt")
|
||||
public void testKt16193() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt");
|
||||
@@ -714,6 +719,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751_2.kt")
|
||||
public void testKt15751_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16411.kt")
|
||||
public void testKt16411() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||
@@ -2015,6 +2025,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt16417.kt")
|
||||
public void testKt16417() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt16417.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt20433.kt")
|
||||
public void testKt20433() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt20433.kt");
|
||||
@@ -2548,6 +2563,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt11677.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15956.kt")
|
||||
public void testKt15956() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15956.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15997.kt")
|
||||
public void testKt15997() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15997.kt");
|
||||
|
||||
Generated
+20
@@ -136,6 +136,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751.kt")
|
||||
public void testKt15751() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt15751.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16193.kt")
|
||||
public void testKt16193() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt");
|
||||
@@ -714,6 +719,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751_2.kt")
|
||||
public void testKt15751_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16411.kt")
|
||||
public void testKt16411() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||
@@ -2015,6 +2025,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt16417.kt")
|
||||
public void testKt16417() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt16417.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt20433.kt")
|
||||
public void testKt20433() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt20433.kt");
|
||||
@@ -2548,6 +2563,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt11677.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15956.kt")
|
||||
public void testKt15956() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15956.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15997.kt")
|
||||
public void testKt15997() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15997.kt");
|
||||
|
||||
+5
@@ -2085,6 +2085,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt21787.kt")
|
||||
public void testKt21787() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/kt21787.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedConstructorFromClass.kt")
|
||||
public void testNestedConstructorFromClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||
|
||||
+5
@@ -2085,6 +2085,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/javaCollectionsStaticMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt21787.kt")
|
||||
public void testKt21787() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/kt21787.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedConstructorFromClass.kt")
|
||||
public void testNestedConstructorFromClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||
|
||||
+20
@@ -136,6 +136,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt14011_3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751.kt")
|
||||
public void testKt15751() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt15751.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16193.kt")
|
||||
public void testKt16193() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt");
|
||||
@@ -714,6 +719,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751_2.kt")
|
||||
public void testKt15751_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16411.kt")
|
||||
public void testKt16411() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||
@@ -2015,6 +2025,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt16417.kt")
|
||||
public void testKt16417() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt16417.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt20433.kt")
|
||||
public void testKt20433() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt20433.kt");
|
||||
@@ -2548,6 +2563,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt11677.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15956.kt")
|
||||
public void testKt15956() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15956.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15997.kt")
|
||||
public void testKt15997() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt15997.kt");
|
||||
|
||||
Generated
+5
@@ -54,6 +54,11 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751_2.kt")
|
||||
public void testKt15751_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16411.kt")
|
||||
public void testKt16411() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||
|
||||
js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrCallableReferenceInlineTestsGenerated.java
Generated
+5
@@ -54,6 +54,11 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15449.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt15751_2.kt")
|
||||
public void testKt15751_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt16411.kt")
|
||||
public void testKt16411() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||
|
||||
+5
@@ -1610,6 +1610,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt21787.kt")
|
||||
public void testKt21787() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/kt21787.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedConstructorFromClass.kt")
|
||||
public void testNestedConstructorFromClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||
|
||||
Generated
+5
@@ -129,6 +129,11 @@ public class IrNonLocalReturnsTestGenerated extends AbstractIrNonLocalReturnsTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt16417.kt")
|
||||
public void testKt16417() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt16417.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt20433.kt")
|
||||
public void testKt20433() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt20433.kt");
|
||||
|
||||
+5
@@ -1610,6 +1610,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt21787.kt")
|
||||
public void testKt21787() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/kt21787.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedConstructorFromClass.kt")
|
||||
public void testNestedConstructorFromClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||
|
||||
+5
@@ -129,6 +129,11 @@ public class NonLocalReturnsTestGenerated extends AbstractNonLocalReturnsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt16417.kt")
|
||||
public void testKt16417() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt16417.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt20433.kt")
|
||||
public void testKt20433() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/kt20433.kt");
|
||||
|
||||
Reference in New Issue
Block a user