Write enclosing method info for transformed objects
This commit is contained in:
+25
-21
@@ -97,21 +97,6 @@ public class AnonymousObjectTransformer {
|
||||
innerClassNodes.add(new InnerClassNode(name, outerName, innerName, access));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, String name, String desc) {
|
||||
InliningContext parent = inliningContext.getParent();
|
||||
assert parent != null : "Context for transformer should have parent one: " + inliningContext;
|
||||
|
||||
//we don't write owner info for lamdbas and SAMs just only for objects
|
||||
if (parent.isRoot() || parent.isInliningLambdaRootContext()) {
|
||||
//TODO: think about writing method info - there is some problem with new constructor desc calculation
|
||||
super.visitOuterClass(inliningContext.getParent().getClassNameToInline(), null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
super.visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(
|
||||
int access, @NotNull String name, @NotNull String desc, String signature, String[] exceptions
|
||||
@@ -202,16 +187,24 @@ public class AnonymousObjectTransformer {
|
||||
|
||||
SourceMapper.Companion.flushToClassBuilder(sourceMapper, classBuilder);
|
||||
|
||||
ClassVisitor visitor = classBuilder.getVisitor();
|
||||
for (InnerClassNode node : innerClassNodes) {
|
||||
classBuilder.getVisitor().visitInnerClass(node.name, node.outerName, node.innerName, node.access);
|
||||
visitor.visitInnerClass(node.name, node.outerName, node.innerName, node.access);
|
||||
}
|
||||
|
||||
writeOuterInfo(visitor);
|
||||
|
||||
classBuilder.done();
|
||||
|
||||
anonymousObjectGen.setNewLambdaType(newLambdaType);
|
||||
return transformationResult;
|
||||
}
|
||||
|
||||
private void writeOuterInfo(@NotNull ClassVisitor visitor) {
|
||||
InlineCallSiteInfo info = inliningContext.getCallSiteInfo();
|
||||
visitor.visitOuterClass(info.getOwnerClassName(), info.getFunctionName(), info.getFunctionDesc());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private InlineResult inlineMethodAndUpdateGlobalResult(
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGen,
|
||||
@@ -244,9 +237,20 @@ public class AnonymousObjectTransformer {
|
||||
parameters, anonymousObjectGen.getCapturedLambdasToInline(),
|
||||
parentRemapper, isConstructor);
|
||||
|
||||
MethodInliner inliner = new MethodInliner(sourceNode, parameters, inliningContext.subInline(inliningContext.nameGenerator.subGenerator("lambda")),
|
||||
remapper, isSameModule, "Transformer for " + anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceMapper);
|
||||
MethodInliner inliner =
|
||||
new MethodInliner(
|
||||
sourceNode,
|
||||
parameters,
|
||||
inliningContext.subInline(inliningContext.nameGenerator.subGenerator("lambda")),
|
||||
remapper,
|
||||
isSameModule,
|
||||
"Transformer for " + anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceMapper,
|
||||
new InlineCallSiteInfo(
|
||||
anonymousObjectGen.getOwnerInternalName(),
|
||||
sourceNode.name,
|
||||
isConstructor ? anonymousObjectGen.getNewConstructorDescriptor() : sourceNode.desc)
|
||||
);
|
||||
|
||||
InlineResult result = inliner.doInline(deferringVisitor, new LocalVarRemapper(parameters, 0), false, LabelOwner.NOT_APPLICABLE);
|
||||
result.getReifiedTypeParametersUsages().mergeAll(typeParametersToReify);
|
||||
@@ -285,6 +289,8 @@ public class AnonymousObjectTransformer {
|
||||
}
|
||||
|
||||
String constructorDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, descTypes.toArray(new Type[descTypes.size()]));
|
||||
//TODO for inline method make public class
|
||||
anonymousObjectGen.setNewConstructorDescriptor(constructorDescriptor);
|
||||
MethodVisitor constructorVisitor = classBuilder.newMethod(NO_ORIGIN,
|
||||
AsmUtil.NO_FLAG_PACKAGE_PRIVATE,
|
||||
"<init>", constructorDescriptor,
|
||||
@@ -325,8 +331,6 @@ public class AnonymousObjectTransformer {
|
||||
inlineMethodAndUpdateGlobalResult(anonymousObjectGen, parentRemapper, capturedFieldInitializer, constructor, constructorInlineBuilder, true);
|
||||
constructorVisitor.visitEnd();
|
||||
AsmUtil.genClosureFields(TransformationUtilsKt.toNameTypePair(TransformationUtilsKt.filterSkipped(newFieldsWithSkipped)), classBuilder);
|
||||
//TODO for inline method make public class
|
||||
anonymousObjectGen.setNewConstructorDescriptor(constructorDescriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
class InlineCallSiteInfo(val ownerClassName: String, val functionName: String?, val functionDesc: String?)
|
||||
@@ -269,12 +269,12 @@ public class InlineCodegen extends CallGenerator {
|
||||
.subGenerator(functionDescriptor.getName().asString()),
|
||||
codegen.getContext(),
|
||||
callElement,
|
||||
codegen.getParentCodegen().getClassName(), reifiedTypeInliner,
|
||||
getInlineCallSiteInfo(), reifiedTypeInliner,
|
||||
typeParameterMappings);
|
||||
|
||||
MethodInliner inliner = new MethodInliner(node, parameters, info, new FieldRemapper(null, null, parameters), isSameModule,
|
||||
"Method inlining " + callElement.getText(),
|
||||
createNestedSourceMapper(nodeAndSmap)); //with captured
|
||||
createNestedSourceMapper(nodeAndSmap), info.getCallSiteInfo()); //with captured
|
||||
|
||||
LocalVarRemapper remapper = new LocalVarRemapper(parameters, initialFrameSize);
|
||||
|
||||
@@ -306,6 +306,13 @@ public class InlineCodegen extends CallGenerator {
|
||||
return result;
|
||||
}
|
||||
|
||||
private InlineCallSiteInfo getInlineCallSiteInfo() {
|
||||
MemberCodegen<?> parentCodegen = codegen.getParentCodegen();
|
||||
MethodContext context = codegen.getContext();
|
||||
JvmMethodSignature signature = typeMapper.mapSignature(context.getFunctionDescriptor(), context.getContextKind());
|
||||
return new InlineCallSiteInfo(parentCodegen.getClassName(), signature.getAsmMethod().getName(), signature.getAsmMethod().getDescriptor());
|
||||
}
|
||||
|
||||
private void generateClosuresBodies() {
|
||||
for (LambdaInfo info : expressionMap.values()) {
|
||||
info.setNode(generateLambdaBody(info));
|
||||
|
||||
@@ -73,17 +73,18 @@ public class InliningContext {
|
||||
return subInline(nameGenerator.subGenerator("lambda"), map, true);
|
||||
}
|
||||
|
||||
public InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings) {
|
||||
private InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings) {
|
||||
return subInline(generator, additionalTypeMappings, isInliningLambda);
|
||||
}
|
||||
|
||||
public InliningContext subInlineWithClassRegeneration(@NotNull NameGenerator generator,
|
||||
@NotNull Map<String, String> newTypeMappings,
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration,
|
||||
@NotNull InlineCallSiteInfo callSiteInfo
|
||||
) {
|
||||
return new RegeneratedClassContext(this, expressionMap, state, generator,
|
||||
TypeRemapper.createFrom(typeRemapper, newTypeMappings),
|
||||
reifedTypeInliner, isInliningLambda, anonymousObjectGeneration);
|
||||
reifedTypeInliner, isInliningLambda, anonymousObjectGeneration, callSiteInfo);
|
||||
}
|
||||
|
||||
public InliningContext subInline(NameGenerator generator, Map<String, String> additionalTypeMappings, boolean isInliningLambda) {
|
||||
@@ -131,8 +132,8 @@ public class InliningContext {
|
||||
return isInliningLambda && !getParent().isInliningLambda;
|
||||
}
|
||||
|
||||
public String getClassNameToInline() {
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
assert parent != null : "At least root context should return proper value";
|
||||
return parent.getClassNameToInline();
|
||||
return parent.getCallSiteInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ public class MethodInliner {
|
||||
|
||||
private final SourceMapper sourceMapper;
|
||||
|
||||
private final InlineCallSiteInfo inlineCallSiteInfo;
|
||||
|
||||
private final JetTypeMapper typeMapper;
|
||||
|
||||
private final List<InvokeCall> invokeCalls = new ArrayList<InvokeCall>();
|
||||
@@ -82,7 +84,8 @@ public class MethodInliner {
|
||||
@NotNull FieldRemapper nodeRemapper,
|
||||
boolean isSameModule,
|
||||
@NotNull String errorPrefix,
|
||||
@NotNull SourceMapper sourceMapper
|
||||
@NotNull SourceMapper sourceMapper,
|
||||
@NotNull InlineCallSiteInfo inlineCallSiteInfo
|
||||
) {
|
||||
this.node = node;
|
||||
this.parameters = parameters;
|
||||
@@ -91,6 +94,7 @@ public class MethodInliner {
|
||||
this.isSameModule = isSameModule;
|
||||
this.errorPrefix = errorPrefix;
|
||||
this.sourceMapper = sourceMapper;
|
||||
this.inlineCallSiteInfo = inlineCallSiteInfo;
|
||||
this.typeMapper = inliningContext.state.getTypeMapper();
|
||||
this.result = InlineResult.create();
|
||||
}
|
||||
@@ -145,7 +149,7 @@ public class MethodInliner {
|
||||
return result;
|
||||
}
|
||||
|
||||
private MethodNode doInline(MethodNode node) {
|
||||
private MethodNode doInline(final MethodNode node) {
|
||||
|
||||
final Deque<InvokeCall> currentInvokes = new LinkedList<InvokeCall>(invokeCalls);
|
||||
|
||||
@@ -179,7 +183,8 @@ public class MethodInliner {
|
||||
.subInlineWithClassRegeneration(
|
||||
inliningContext.nameGenerator,
|
||||
currentTypeMapping,
|
||||
anonymousObjectGen),
|
||||
anonymousObjectGen,
|
||||
inlineCallSiteInfo),
|
||||
isSameModule, Type.getObjectType(newClassName)
|
||||
);
|
||||
|
||||
@@ -243,7 +248,7 @@ public class MethodInliner {
|
||||
inliningContext.subInlineLambda(info),
|
||||
newCapturedRemapper, true /*cause all calls in same module as lambda*/,
|
||||
"Lambda inlining " + info.getLambdaClassType().getInternalName(),
|
||||
mapper);
|
||||
mapper, inlineCallSiteInfo);
|
||||
|
||||
LocalVarRemapper remapper = new LocalVarRemapper(lambdaParameters, valueParamShift);
|
||||
InlineResult lambdaResult = inliner.doInline(this.mv, remapper, true, info, invokeCall.finallyDepthShift);//TODO add skipped this and receiver
|
||||
@@ -639,7 +644,7 @@ public class MethodInliner {
|
||||
}
|
||||
}
|
||||
|
||||
private void transformFinallyDeepIndex(@NotNull MethodNode node, int finallyDeepShift) {
|
||||
private static void transformFinallyDeepIndex(@NotNull MethodNode node, int finallyDeepShift) {
|
||||
if (finallyDeepShift == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-4
@@ -24,6 +24,7 @@ import java.util.Map;
|
||||
|
||||
public class RegeneratedClassContext extends InliningContext {
|
||||
private final AnonymousObjectGeneration anonymousObjectGeneration;
|
||||
private InlineCallSiteInfo callSiteInfo;
|
||||
|
||||
public RegeneratedClassContext(
|
||||
@Nullable InliningContext parent,
|
||||
@@ -33,14 +34,15 @@ public class RegeneratedClassContext extends InliningContext {
|
||||
@NotNull TypeRemapper typeRemapper,
|
||||
@NotNull ReifiedTypeInliner reifiedTypeInliner,
|
||||
boolean isInliningLambda,
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration
|
||||
@NotNull AnonymousObjectGeneration anonymousObjectGeneration,
|
||||
@NotNull InlineCallSiteInfo callSiteInfo
|
||||
) {
|
||||
super(parent, map, state, nameGenerator, typeRemapper, reifiedTypeInliner, isInliningLambda, true);
|
||||
this.anonymousObjectGeneration = anonymousObjectGeneration;
|
||||
this.callSiteInfo = callSiteInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassNameToInline() {
|
||||
return anonymousObjectGeneration.getOwnerInternalName();
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
return callSiteInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
||||
|
||||
public class RootInliningContext extends InliningContext {
|
||||
public final CodegenContext startContext;
|
||||
private final String classNameToInline;
|
||||
private final InlineCallSiteInfo inlineCallSiteInfo;
|
||||
public final TypeParameterMappings typeParameterMappings;
|
||||
public final KtElement callElement;
|
||||
|
||||
@@ -36,20 +36,19 @@ public class RootInliningContext extends InliningContext {
|
||||
@NotNull NameGenerator nameGenerator,
|
||||
@NotNull CodegenContext startContext,
|
||||
@NotNull KtElement callElement,
|
||||
@NotNull String classNameToInline,
|
||||
@NotNull InlineCallSiteInfo classNameToInline,
|
||||
@NotNull ReifiedTypeInliner inliner,
|
||||
@Nullable TypeParameterMappings typeParameterMappings
|
||||
) {
|
||||
super(null, map, state, nameGenerator, TypeRemapper.createRoot(typeParameterMappings), inliner, false, false);
|
||||
this.callElement = callElement;
|
||||
this.startContext = startContext;
|
||||
this.classNameToInline = classNameToInline;
|
||||
this.inlineCallSiteInfo = classNameToInline;
|
||||
this.typeParameterMappings = typeParameterMappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getClassNameToInline() {
|
||||
return classNameToInline;
|
||||
public InlineCallSiteInfo getCallSiteInfo() {
|
||||
return inlineCallSiteInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val res = test {
|
||||
"OK"
|
||||
}
|
||||
|
||||
val enclosingMethod = res.javaClass.enclosingMethod
|
||||
if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}"
|
||||
|
||||
val enclosingClass = res.javaClass.enclosingClass
|
||||
if (enclosingClass?.name != "ObjectInInlineFun_1Kt") return "fail 2: ${enclosingClass?.name}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
interface Z {
|
||||
fun a(): String
|
||||
}
|
||||
|
||||
inline fun test(crossinline z: () -> String) =
|
||||
object : Z {
|
||||
override fun a() = z()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
/*This captured parameter would be added to object constructor*/
|
||||
val captured = "OK";
|
||||
var z: Any = "fail"
|
||||
val res = test {
|
||||
|
||||
z = {
|
||||
captured
|
||||
}
|
||||
(z as Function0<String>)()
|
||||
}
|
||||
|
||||
|
||||
val enclosingConstructor = z.javaClass.enclosingConstructor
|
||||
if (enclosingConstructor?.name != "TransformedConstructor_1Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}"
|
||||
|
||||
val enclosingClass = z.javaClass.enclosingClass
|
||||
if (enclosingClass?.name != "TransformedConstructor_1Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}"
|
||||
|
||||
return res.a()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
interface Z {
|
||||
fun a() : String
|
||||
}
|
||||
|
||||
inline fun test(crossinline z: () -> String) =
|
||||
object : Z {
|
||||
|
||||
val p = z()
|
||||
|
||||
override fun a() = p
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var z = "OK"
|
||||
val res = test {
|
||||
z
|
||||
}
|
||||
|
||||
|
||||
val javaClass1 = res.javaClass
|
||||
val enclosingMethod = javaClass1.enclosingMethod
|
||||
if (enclosingMethod?.name != "box") return "fail 1: ${enclosingMethod?.name}"
|
||||
|
||||
val enclosingClass = javaClass1.enclosingClass
|
||||
if (enclosingClass?.name != "TransformedConstructorWithAdditionalObject_1Kt") return "fail 2: ${enclosingClass?.name}"
|
||||
|
||||
|
||||
val res2 = res.a()
|
||||
val enclosingConstructor = res2.javaClass.enclosingConstructor
|
||||
if (enclosingConstructor?.name != javaClass1.name) return "fail 3: ${enclosingConstructor?.name} != ${javaClass1.name}"
|
||||
|
||||
val enclosingClass2 = res2.javaClass.enclosingClass
|
||||
if (enclosingClass2?.name != javaClass1.name) return "fail 4: ${enclosingClass2?.name} != ${javaClass1.name}"
|
||||
|
||||
|
||||
|
||||
return res2.a()
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
package test
|
||||
|
||||
interface Z<T> {
|
||||
fun a() : T
|
||||
}
|
||||
|
||||
inline fun test(crossinline z: () -> String) =
|
||||
object : Z<Z<String>> {
|
||||
|
||||
val p: Z<String> = object : Z<String> {
|
||||
|
||||
val p2 = z()
|
||||
|
||||
override fun a() = p2
|
||||
}
|
||||
|
||||
override fun a() = p
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
/*This captured parameter would be added to object constructor*/
|
||||
val captured = "OK";
|
||||
var z: Any = "fail"
|
||||
val res = test {
|
||||
|
||||
call {
|
||||
z = {
|
||||
captured
|
||||
}
|
||||
}
|
||||
|
||||
(z as Function0<String>)()
|
||||
}
|
||||
|
||||
|
||||
val enclosingConstructor = z.javaClass.enclosingConstructor
|
||||
if (enclosingConstructor?.name != "TransformedConstructorWithNestedInline_1Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}"
|
||||
|
||||
val enclosingClass = z.javaClass.enclosingClass
|
||||
if (enclosingClass?.name != "TransformedConstructorWithNestedInline_1Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}"
|
||||
|
||||
return res.a()
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
package test
|
||||
|
||||
interface Z {
|
||||
fun a() : String
|
||||
}
|
||||
|
||||
inline fun test(crossinline z: () -> String) =
|
||||
object : Z {
|
||||
|
||||
val p = z()
|
||||
|
||||
override fun a() = p
|
||||
}
|
||||
|
||||
|
||||
inline fun<T> call(crossinline z: () -> T) = z()
|
||||
@@ -0,0 +1,21 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FULL_JDK
|
||||
|
||||
import test.*
|
||||
import java.util.*
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val result = Test().callInline("test")
|
||||
|
||||
val method = result.javaClass.getMethod("invoke")
|
||||
val genericReturnType = method.genericReturnType
|
||||
if (genericReturnType.toString() != "T") return "fail 1: $genericReturnType"
|
||||
|
||||
val method2 = Test::class.java.getMethod("callInline", Any::class.java)
|
||||
val genericParameterType = method2.genericParameterTypes.firstOrNull()
|
||||
|
||||
if (genericParameterType != genericReturnType) return "fail 2: $genericParameterType != $genericReturnType"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package test
|
||||
|
||||
open class Test {
|
||||
|
||||
inline fun <Y> test(z: () -> () -> Y) = z()
|
||||
|
||||
fun <T> callInline(p: T) = test<T> {
|
||||
{
|
||||
p
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,21 +96,21 @@ public class OuterClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testLocalObjectInlined() throws Exception {
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", "callToInline", "()V");
|
||||
doCustomTest("foo/Bar\\$callToInline\\$\\$inlined\\$inlineFoo\\$1", expectedInfo, "inlineObject");
|
||||
}
|
||||
|
||||
public void testLocalObjectInInlineLambda() throws Exception {
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", "objectInInlineLambda", "()V");
|
||||
doCustomTest("foo/Bar\\$objectInInlineLambda\\$\\$inlined\\$simpleFoo\\$lambda\\$1", expectedInfo, "inlineObject");
|
||||
}
|
||||
|
||||
public void testLocalObjectInLambdaInlinedIntoObject() throws Exception {
|
||||
OuterClassInfo intoObjectInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo intoObjectInfo = new OuterClassInfo("foo/Bar", "objectInLambdaInlinedIntoObject", "()V");
|
||||
|
||||
doCustomTest("foo/Bar\\$objectInLambdaInlinedIntoObject\\$\\$inlined\\$inlineFoo\\$1", intoObjectInfo, "inlineObject");
|
||||
|
||||
OuterClassInfo objectInLambda = new OuterClassInfo("foo/Bar$objectInLambdaInlinedIntoObject$$inlined$inlineFoo$1", null, null);
|
||||
OuterClassInfo objectInLambda = new OuterClassInfo("foo/Bar$objectInLambdaInlinedIntoObject$$inlined$inlineFoo$1", "run", "()V");
|
||||
doCustomTest("foo/Bar\\$objectInLambdaInlinedIntoObject\\$\\$inlined\\$inlineFoo\\$lambda\\$lambda\\$1",
|
||||
objectInLambda, "inlineObject");
|
||||
}
|
||||
@@ -121,21 +121,21 @@ public class OuterClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testLambdaInlined() throws Exception {
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", "callToInline", "()V");
|
||||
doCustomTest("foo/Bar\\$callToInline\\$\\$inlined\\$inlineFoo\\$1", expectedInfo, "inlineLambda");
|
||||
}
|
||||
|
||||
public void testLambdaInInlineLambda() throws Exception {
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo expectedInfo = new OuterClassInfo("foo/Bar", "objectInInlineLambda", "()V");
|
||||
doCustomTest("foo/Bar\\$objectInInlineLambda\\$\\$inlined\\$simpleFoo\\$lambda\\$1", expectedInfo, "inlineLambda");
|
||||
}
|
||||
|
||||
public void testLambdaInLambdaInlinedIntoObject() throws Exception {
|
||||
OuterClassInfo intoObjectInfo = new OuterClassInfo("foo/Bar", null, null);
|
||||
OuterClassInfo intoObjectInfo = new OuterClassInfo("foo/Bar", "objectInLambdaInlinedIntoObject", "()V");
|
||||
|
||||
doCustomTest("foo/Bar\\$objectInLambdaInlinedIntoObject\\$\\$inlined\\$inlineFoo\\$1", intoObjectInfo, "inlineLambda");
|
||||
|
||||
OuterClassInfo objectInLambda = new OuterClassInfo("foo/Bar$objectInLambdaInlinedIntoObject$$inlined$inlineFoo$1", null, null);
|
||||
OuterClassInfo objectInLambda = new OuterClassInfo("foo/Bar$objectInLambdaInlinedIntoObject$$inlined$inlineFoo$1", "invoke", "()V");
|
||||
doCustomTest("foo/Bar\\$objectInLambdaInlinedIntoObject\\$\\$inlined\\$inlineFoo\\$lambda\\$lambda\\$1",
|
||||
objectInLambda, "inlineLambda");
|
||||
}
|
||||
|
||||
+39
@@ -587,6 +587,39 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/enclosingInfo")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class EnclosingInfo extends AbstractBlackBoxInlineCodegenTest {
|
||||
public void testAllFilesPresentInEnclosingInfo() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/enclosingInfo"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInInlineFun.1.kt")
|
||||
public void testObjectInInlineFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructor.1.kt")
|
||||
public void testTransformedConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructor.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructorWithAdditionalObject.1.kt")
|
||||
public void testTransformedConstructorWithAdditionalObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructorWithAdditionalObject.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructorWithNestedInline.1.kt")
|
||||
public void testTransformedConstructorWithNestedInline() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/functionExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1402,6 +1435,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterInLambda.1.kt")
|
||||
public void testTypeParameterInLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/signature/typeParameterInLambda.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersSubstitution.1.kt")
|
||||
public void testTypeParametersSubstitution() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.1.kt");
|
||||
|
||||
+39
@@ -587,6 +587,39 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/enclosingInfo")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class EnclosingInfo extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
public void testAllFilesPresentInEnclosingInfo() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/enclosingInfo"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInInlineFun.1.kt")
|
||||
public void testObjectInInlineFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructor.1.kt")
|
||||
public void testTransformedConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructor.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructorWithAdditionalObject.1.kt")
|
||||
public void testTransformedConstructorWithAdditionalObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructorWithAdditionalObject.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("transformedConstructorWithNestedInline.1.kt")
|
||||
public void testTransformedConstructorWithNestedInline() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/functionExpression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1402,6 +1435,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterInLambda.1.kt")
|
||||
public void testTypeParameterInLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/signature/typeParameterInLambda.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersSubstitution.1.kt")
|
||||
public void testTypeParametersSubstitution() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.1.kt");
|
||||
|
||||
Reference in New Issue
Block a user