Keep inline transformation invariant: all captured parameters stored in topmost lambda/object
Fix for KT-8668: java.lang.ClassFormatError: Duplicate field name&signature (based on property access) #KT-8668 Fixed
This commit is contained in:
+37
-13
@@ -179,7 +179,7 @@ public class AnonymousObjectTransformer {
|
||||
ParametersBuilder constructorParamBuilder = ParametersBuilder.newBuilder();
|
||||
List<CapturedParamInfo> additionalFakeParams =
|
||||
extractParametersMappingAndPatchConstructor(constructor, allCapturedParamBuilder, constructorParamBuilder,
|
||||
anonymousObjectGen);
|
||||
anonymousObjectGen, parentRemapper);
|
||||
List<MethodVisitor> deferringMethods = new ArrayList();
|
||||
|
||||
for (MethodNode next : methodsToTransform) {
|
||||
@@ -378,7 +378,8 @@ public class AnonymousObjectTransformer {
|
||||
@NotNull MethodNode constructor,
|
||||
@NotNull ParametersBuilder capturedParamBuilder,
|
||||
@NotNull ParametersBuilder constructorParamBuilder,
|
||||
@NotNull final AnonymousObjectGeneration anonymousObjectGen
|
||||
@NotNull final AnonymousObjectGeneration anonymousObjectGen,
|
||||
@NotNull FieldRemapper parentFieldRemapper
|
||||
) {
|
||||
|
||||
CapturedParamOwner owner = new CapturedParamOwner() {
|
||||
@@ -454,22 +455,45 @@ public class AnonymousObjectTransformer {
|
||||
//TODO: some of such parameters could be skipped - we should perform additional analysis
|
||||
Map<String, LambdaInfo> capturedLambdasToInline = new HashMap<String, LambdaInfo>(); //captured var of inlined parameter
|
||||
List<CapturedParamDesc> allRecapturedParameters = new ArrayList<CapturedParamDesc>();
|
||||
boolean addCapturedNotAddOuter = parentFieldRemapper.isRoot() || (parentFieldRemapper instanceof InlinedLambdaRemapper && parentFieldRemapper.getParent().isRoot());
|
||||
for (LambdaInfo info : capturedLambdas) {
|
||||
for (CapturedParamDesc desc : info.getCapturedVars()) {
|
||||
CapturedParamInfo recapturedParamInfo = capturedParamBuilder.addCapturedParam(desc, getNewFieldName(desc.getFieldName()));
|
||||
StackValue composed = StackValue.field(desc.getType(),
|
||||
oldObjectType, /*TODO owner type*/
|
||||
recapturedParamInfo.getNewFieldName(),
|
||||
false,
|
||||
StackValue.LOCAL_0);
|
||||
recapturedParamInfo.setRemapValue(composed);
|
||||
allRecapturedParameters.add(desc);
|
||||
if (addCapturedNotAddOuter) {
|
||||
for (CapturedParamDesc desc : info.getCapturedVars()) {
|
||||
CapturedParamInfo recapturedParamInfo = capturedParamBuilder.addCapturedParam(desc, getNewFieldName(desc.getFieldName()));
|
||||
StackValue composed = StackValue.field(desc.getType(),
|
||||
oldObjectType, /*TODO owner type*/
|
||||
recapturedParamInfo.getNewFieldName(),
|
||||
false,
|
||||
StackValue.LOCAL_0);
|
||||
recapturedParamInfo.setRemapValue(composed);
|
||||
allRecapturedParameters.add(desc);
|
||||
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.getNewFieldName()).setRemapValue(composed);
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.getNewFieldName()).setRemapValue(composed);
|
||||
}
|
||||
}
|
||||
capturedLambdasToInline.put(info.getLambdaClassType().getInternalName(), info);
|
||||
}
|
||||
|
||||
if (parentFieldRemapper instanceof InlinedLambdaRemapper && !capturedLambdas.isEmpty() && !addCapturedNotAddOuter) {
|
||||
//lambda with non InlinedLambdaRemapper already have outer
|
||||
FieldRemapper parent = parentFieldRemapper.getParent();
|
||||
assert parent instanceof RegeneratedLambdaFieldRemapper;
|
||||
final Type ownerType = Type.getObjectType(parent.getLambdaInternalName());
|
||||
|
||||
CapturedParamDesc desc = new CapturedParamDesc(new CapturedParamOwner() {
|
||||
@Override
|
||||
public Type getType() {
|
||||
return ownerType;
|
||||
}
|
||||
}, InlineCodegenUtil.THIS, ownerType);
|
||||
CapturedParamInfo recapturedParamInfo = capturedParamBuilder.addCapturedParam(desc, InlineCodegenUtil.THIS$0);
|
||||
StackValue composed = StackValue.LOCAL_0;
|
||||
recapturedParamInfo.setRemapValue(composed);
|
||||
allRecapturedParameters.add(desc);
|
||||
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.getNewFieldName()).setRemapValue(composed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
anonymousObjectGen.setAllRecapturedParameters(allRecapturedParameters);
|
||||
@@ -484,7 +508,7 @@ public class AnonymousObjectTransformer {
|
||||
//"this$0" couldn't clash and we should keep this name invariant for further transformations
|
||||
return oldName;
|
||||
}
|
||||
return addUniqueField(oldName + "$inlined");
|
||||
return addUniqueField(oldName + InlineCodegenUtil.INLINE_TRANSFORMATION_SUFFIX);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.StackValue;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
|
||||
@@ -120,6 +121,10 @@ public class FieldRemapper {
|
||||
return lambdaInternalName;
|
||||
}
|
||||
|
||||
public String getNewLambdaInternalName() {
|
||||
return lambdaInternalName;
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
return parent == null;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class InlineCodegenUtil {
|
||||
|
||||
public static final String CAPTURED_FIELD_PREFIX = "$";
|
||||
public static final String THIS$0 = "this$0";
|
||||
public static final String THIS = "this";
|
||||
public static final String RECEIVER$0 = "receiver$0";
|
||||
public static final String NON_LOCAL_RETURN = "$$$$$NON_LOCAL_RETURN$$$$$";
|
||||
public static final String FIRST_FUN_LABEL = "$$$$$ROOT$$$$$";
|
||||
@@ -71,6 +72,7 @@ public class InlineCodegenUtil {
|
||||
public static final String INLINE_MARKER_AFTER_METHOD_NAME = "afterInlineCall";
|
||||
public static final String INLINE_MARKER_FINALLY_START = "finallyStart";
|
||||
public static final String INLINE_MARKER_FINALLY_END = "finallyEnd";
|
||||
public static final String INLINE_TRANSFORMATION_SUFFIX = "$inlined";
|
||||
|
||||
@Nullable
|
||||
public static SMAPAndMethodNode getMethodNode(
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen.inline;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.StackValue;
|
||||
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -50,4 +51,15 @@ public class InlinedLambdaRemapper extends FieldRemapper {
|
||||
public boolean isInsideInliningLambda() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StackValue getFieldForInline(@NotNull FieldInsnNode node, @Nullable StackValue prefix) {
|
||||
if (parent.isRoot()) {
|
||||
return super.getFieldForInline(node, prefix);
|
||||
} else {
|
||||
return parent.getFieldForInline(node, prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-5
@@ -51,11 +51,11 @@ public class RegeneratedLambdaFieldRemapper extends FieldRemapper {
|
||||
|
||||
@Override
|
||||
public boolean canProcess(@NotNull String fieldOwner, String fieldName, boolean isFolding) {
|
||||
return super.canProcess(fieldOwner, fieldName, isFolding) || isRecapturedLambdaType(fieldOwner);
|
||||
return super.canProcess(fieldOwner, fieldName, isFolding) || isRecapturedLambdaType(fieldOwner, isFolding);
|
||||
}
|
||||
|
||||
private boolean isRecapturedLambdaType(String owner) {
|
||||
return recapturedLambdas.containsKey(owner);
|
||||
private boolean isRecapturedLambdaType(String owner, boolean isFolding) {
|
||||
return recapturedLambdas.containsKey(owner) && (isFolding || false == parent instanceof InlinedLambdaRemapper);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -79,10 +79,20 @@ public class RegeneratedLambdaFieldRemapper extends FieldRemapper {
|
||||
return super.findField(fieldInsnNode, parameters.getCaptured());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNewLambdaInternalName() {
|
||||
return newOwnerType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StackValue getFieldForInline(@NotNull FieldInsnNode node, @Nullable StackValue prefix) {
|
||||
assert node.name.startsWith("$$$") : "Captured field template should start with $$$ prefix";
|
||||
if (node.name.equals("$$$" + InlineCodegenUtil.THIS)) {
|
||||
assert oldOwnerType.equals(node.owner) : "Can't unfold '$$$THIS' parameter";
|
||||
return StackValue.LOCAL_0;
|
||||
}
|
||||
|
||||
FieldInsnNode fin = new FieldInsnNode(node.getOpcode(), node.owner, node.name.substring(3), node.desc);
|
||||
CapturedParamInfo field = findFieldInMyCaptured(fin);
|
||||
|
||||
@@ -95,8 +105,9 @@ public class RegeneratedLambdaFieldRemapper extends FieldRemapper {
|
||||
}
|
||||
}
|
||||
|
||||
StackValue result = StackValue.field(field.getType(),
|
||||
Type.getObjectType(newOwnerType), /*TODO owner type*/
|
||||
StackValue result = StackValue.field(field.isSkipped ?
|
||||
Type.getObjectType(parent.parent.getNewLambdaInternalName()) : field.getType(),
|
||||
Type.getObjectType(getNewLambdaInternalName()), /*TODO owner type*/
|
||||
field.getNewFieldName(), false,
|
||||
prefix == null ? StackValue.LOCAL_0 : prefix);
|
||||
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
test { it -> result = it }
|
||||
return result
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f("OK")
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
testNested { it -> { f(it) }()}
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
inline fun <T> inlineFun(arg: T, f: (T) -> Unit) {
|
||||
f(arg)
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + a
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
return if (result == "start2") "OK" else "fail: $result"
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
test { it -> result = it }
|
||||
return result
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f("OK")
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
fun test(f: (String) -> Unit) {
|
||||
testNested { it -> { f(it) }()}
|
||||
}
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
B("O", "K").test { it -> result = it }
|
||||
return result
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f(o)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
testNested { it -> { f(it + k) }() }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) {
|
||||
{
|
||||
f(arg + addParam)
|
||||
}()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
{
|
||||
inlineFun("1") { c ->
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, f: (String) -> Unit) {
|
||||
f(arg + addParam)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) {
|
||||
{
|
||||
f(arg + addParam)
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + a
|
||||
}()
|
||||
}
|
||||
return if (result == "start2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) {
|
||||
{
|
||||
f(arg + addParam)
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + a
|
||||
}()
|
||||
}
|
||||
}()
|
||||
return if (result == "start2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) {
|
||||
{
|
||||
f(arg + addParam)
|
||||
}()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().box()
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
val param = "start"
|
||||
var result = "fail"
|
||||
var addParam = "_additional_"
|
||||
|
||||
inline fun inlineFun(arg: String, crossinline f: (String) -> Unit) {
|
||||
{
|
||||
f(arg + addParam)
|
||||
}()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
inlineFun("1") { c ->
|
||||
{
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return if (result == "start1_additional_2_additional_") "OK" else "fail: $result"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
B("O", "fail").test { it -> result = it }
|
||||
return result
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f(o)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
testNested { it -> { f(it + "K") }() }
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
B("O", "K").test { it -> result = it }
|
||||
return result
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f(o)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
fun test(f: (String) -> Unit) {
|
||||
testNested { it -> { f(it + k) }() }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
B("O", "K").test { it -> result += it }
|
||||
return if (result == "OOKK") "OK" else "fail: $result"
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f2: (String) -> Unit, crossinline f3: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f2(o)
|
||||
f3(k)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
testNested ({ it -> f(it + o) }) { it -> f(it + k) }
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
B("O", "K").test { it -> result += it }
|
||||
return if (result == "OOKK") "OK" else "fail: $result"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit, crossinline f2: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f(o)
|
||||
f2(k)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
call {
|
||||
{
|
||||
testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() }
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun call(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
B("O", "K").test { it -> result += it }
|
||||
return if (result == "startOOKK") "OK" else "fail: $result"
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
class B(val o: String, val k: String) {
|
||||
|
||||
inline fun testNested(crossinline f: (String) -> Unit, crossinline f2: (String) -> Unit) {
|
||||
object : A {
|
||||
override fun run() {
|
||||
f(o)
|
||||
f2(k)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
call {
|
||||
f("start");
|
||||
{
|
||||
testNested ({ it -> { f(it + o) }() }) { it -> { f(it + k) }() }
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun call(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return A().testCall()
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
|
||||
fun callK(): String {
|
||||
return "K"
|
||||
}
|
||||
|
||||
fun callO(): String {
|
||||
return "O"
|
||||
}
|
||||
|
||||
fun testCall(): String = test { callO() }
|
||||
|
||||
inline fun test(crossinline l: () -> String): String {
|
||||
return {
|
||||
l() + callK()
|
||||
}()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return Person("OK").sayName()
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package test
|
||||
|
||||
class Person(val name: String) {
|
||||
|
||||
fun sayName() = doSayName { name }
|
||||
|
||||
inline fun doSayName(crossinline call: () -> String): String {
|
||||
return nestedSayName1 { nestedSayName2 { call() } }
|
||||
}
|
||||
|
||||
fun nestedSayName1(call: () -> String) = call()
|
||||
|
||||
inline fun nestedSayName2(call: () -> String) = call()
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val res = Person("OK").sayName()
|
||||
if (res != "OKsubOK") return "fail: $res"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
class Person(val name: String) {
|
||||
|
||||
fun sayName() = doSayName { name }
|
||||
|
||||
inline fun doSayName(crossinline call: () -> String): String {
|
||||
return nestedSayName1 { name + Person("sub").nestedSayName2 { call() } }
|
||||
}
|
||||
|
||||
fun nestedSayName1(call: () -> String) = call()
|
||||
|
||||
inline fun nestedSayName2(call: () -> String) = name + call()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return Company("OK").sayName()
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package test
|
||||
|
||||
class Company(val name: String) {
|
||||
fun sayName() = Person("test").doSayName { name }
|
||||
}
|
||||
|
||||
class Person(val name: String) {
|
||||
|
||||
inline fun doSayName(crossinline call: () -> String): String {
|
||||
return companyName { parsonName { call() } }
|
||||
}
|
||||
|
||||
inline fun parsonName(call: () -> String) = call()
|
||||
|
||||
fun companyName(call: () -> String) = call()
|
||||
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return Person("OK").sayName()
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
fun Person.sayName() = doSayName { name }
|
||||
|
||||
class Person(val name: String)
|
||||
|
||||
inline fun Person.doSayName(crossinline call: () -> String): String {
|
||||
return companyName { parsonName { call() } }
|
||||
}
|
||||
|
||||
inline fun Person.parsonName(call: () -> String) = call()
|
||||
|
||||
fun Person.companyName(call: () -> String) = call()
|
||||
|
||||
+165
@@ -150,6 +150,171 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ProperRecapturing extends AbstractBlackBoxInlineCodegenTest {
|
||||
public void testAllFilesPresentInProperRecapturing() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineChain.1.kt")
|
||||
public void testInlineChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain.1.kt")
|
||||
public void testLambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple.1.kt")
|
||||
public void testLambdaChainSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_2.1.kt")
|
||||
public void testLambdaChain_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_3.1.kt")
|
||||
public void testLambdaChain_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLambda.1.kt")
|
||||
public void testNoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ProperRecapturingInClass extends AbstractBlackBoxInlineCodegenTest {
|
||||
public void testAllFilesPresentInProperRecapturingInClass() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineChain.1.kt")
|
||||
public void testInlineChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlinelambdaChain.1.kt")
|
||||
public void testInlinelambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain.1.kt")
|
||||
public void testLambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple.1.kt")
|
||||
public void testLambdaChainSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple_2.1.kt")
|
||||
public void testLambdaChainSimple_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_2.1.kt")
|
||||
public void testLambdaChain_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_3.1.kt")
|
||||
public void testLambdaChain_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noCapturedThisOnCallSite.1.kt")
|
||||
public void testNoCapturedThisOnCallSite() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLambda.1.kt")
|
||||
public void testNoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambda.1.kt")
|
||||
public void testTwoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambda.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambdaComplex.1.kt")
|
||||
public void testTwoInlineLambdaComplex() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambdaComplex_2.1.kt")
|
||||
public void testTwoInlineLambdaComplex_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TwoCapturedReceivers extends AbstractBlackBoxInlineCodegenTest {
|
||||
public void testAllFilesPresentInTwoCapturedReceivers() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668.1.kt")
|
||||
public void testKt8668() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668_2.1.kt")
|
||||
public void testKt8668_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668_3.1.kt")
|
||||
public void testKt8668_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_3.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoDifferentDispatchReceivers.1.kt")
|
||||
public void testTwoDifferentDispatchReceivers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoDifferentDispatchReceivers.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoExtensionReceivers.1.kt")
|
||||
public void testTwoExtensionReceivers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoExtensionReceivers.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/argumentOrder")
|
||||
|
||||
+165
@@ -150,6 +150,171 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt9877_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ProperRecapturing extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
public void testAllFilesPresentInProperRecapturing() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineChain.1.kt")
|
||||
public void testInlineChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/inlineChain.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain.1.kt")
|
||||
public void testLambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple.1.kt")
|
||||
public void testLambdaChainSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChainSimple.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_2.1.kt")
|
||||
public void testLambdaChain_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_3.1.kt")
|
||||
public void testLambdaChain_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/lambdaChain_3.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLambda.1.kt")
|
||||
public void testNoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturing/noInlineLambda.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ProperRecapturingInClass extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
public void testAllFilesPresentInProperRecapturingInClass() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineChain.1.kt")
|
||||
public void testInlineChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlineChain.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlinelambdaChain.1.kt")
|
||||
public void testInlinelambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/inlinelambdaChain.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain.1.kt")
|
||||
public void testLambdaChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple.1.kt")
|
||||
public void testLambdaChainSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChainSimple_2.1.kt")
|
||||
public void testLambdaChainSimple_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChainSimple_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_2.1.kt")
|
||||
public void testLambdaChain_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaChain_3.1.kt")
|
||||
public void testLambdaChain_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/lambdaChain_3.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noCapturedThisOnCallSite.1.kt")
|
||||
public void testNoCapturedThisOnCallSite() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noCapturedThisOnCallSite.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineLambda.1.kt")
|
||||
public void testNoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/noInlineLambda.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambda.1.kt")
|
||||
public void testTwoInlineLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambda.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambdaComplex.1.kt")
|
||||
public void testTwoInlineLambdaComplex() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoInlineLambdaComplex_2.1.kt")
|
||||
public void testTwoInlineLambdaComplex_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/properRecapturingInClass/twoInlineLambdaComplex_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TwoCapturedReceivers extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
public void testAllFilesPresentInTwoCapturedReceivers() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668.1.kt")
|
||||
public void testKt8668() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668_2.1.kt")
|
||||
public void testKt8668_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt8668_3.1.kt")
|
||||
public void testKt8668_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668_3.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoDifferentDispatchReceivers.1.kt")
|
||||
public void testTwoDifferentDispatchReceivers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoDifferentDispatchReceivers.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoExtensionReceivers.1.kt")
|
||||
public void testTwoExtensionReceivers() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/twoExtensionReceivers.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/argumentOrder")
|
||||
|
||||
Reference in New Issue
Block a user