Added some tests on local classes in inline bodies
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <T> myRun(block: () -> T) = block()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
class A(val x: String, f: () -> IFoo = {
|
||||
val y = "K"
|
||||
myRun {
|
||||
val o = object: IFoo {
|
||||
override fun foo() = x + y
|
||||
}
|
||||
o
|
||||
}
|
||||
}) {
|
||||
val foo: IFoo = f()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A("O").foo.foo()
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <T> myRun(block: () -> T) = block()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val y = "O"
|
||||
val x = myRun {
|
||||
fun foo() = y + "K"
|
||||
|
||||
val o = object {
|
||||
fun bar() = foo()
|
||||
}
|
||||
o
|
||||
}
|
||||
return x.bar()
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <T> myRun(block: () -> T) = block()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val x = myRun {
|
||||
fun foo() = "OK"
|
||||
|
||||
val o = object {
|
||||
val f = ::foo
|
||||
fun bar() = f()
|
||||
}
|
||||
o
|
||||
}
|
||||
return x.bar()
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun call(crossinline init: () -> Unit) {
|
||||
return init()
|
||||
}
|
||||
|
||||
inline fun test(): String {
|
||||
var res = "Fail"
|
||||
|
||||
call {
|
||||
object {
|
||||
fun run () {
|
||||
res = "OK"
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return test()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
public inline fun <reified T : Any> foo(block: () -> T) = T::class
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
foo { object {} }
|
||||
return "OK"
|
||||
}
|
||||
+25
@@ -41,6 +41,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -271,11 +286,21 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
Generated
+25
@@ -41,6 +41,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -271,11 +286,21 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
+25
@@ -41,6 +41,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -271,11 +286,21 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
Generated
+25
@@ -41,6 +41,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -271,11 +286,21 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
Generated
+25
@@ -41,6 +41,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -246,11 +261,21 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
+25
@@ -41,6 +41,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInDefault.kt")
|
||||
public void testAnonymousObjectInDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectOnCallSite.kt")
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnCallSite.kt");
|
||||
@@ -81,6 +86,16 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFun.kt")
|
||||
public void testCapturedLocalFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLocalFunRef.kt")
|
||||
public void testCapturedLocalFunRef() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/capturedLocalFunRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changingReturnType.kt")
|
||||
public void testChangingReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/changingReturnType.kt");
|
||||
@@ -246,11 +261,21 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sharedFromCrossinline.kt")
|
||||
public void testSharedFromCrossinline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/sharedFromCrossinline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("superConstructorWithObjectParameter.kt")
|
||||
public void testSuperConstructorWithObjectParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/superConstructorWithObjectParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeInfo.kt")
|
||||
public void testTypeInfo() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/typeInfo.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withInlineMethod.kt")
|
||||
public void testWithInlineMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
|
||||
|
||||
Reference in New Issue
Block a user