Properly find invoke method on default lambda inlining

In general case parameter type could differ from actual default lambda type.
  E.g.: fun inlineFun(s: (Child) -> Base = { a: Base -> a as Child}),
  where type of default lambda is '(Base) -> Child'.
  In such case we should find somehow actual invoke method in bytecode knowing
  only name, number of parameters and that's actual invoke is non-synthetic
  regardless of bridge one.

  #KT-21946 Fixed
This commit is contained in:
Mikhael Bogdanov
2018-12-27 15:03:40 +01:00
parent 3040a2b145
commit 6bf70a5dd2
14 changed files with 332 additions and 18 deletions
@@ -1214,6 +1214,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt");
}
@TestMetadata("differentInvokeSignature.kt")
public void testDifferentInvokeSignature() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/differentInvokeSignature.kt");
}
@TestMetadata("genericLambda.kt")
public void testGenericLambda() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/genericLambda.kt");
@@ -1239,6 +1244,26 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/kt21827.kt");
}
@TestMetadata("kt21946.kt")
public void testKt21946() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/kt21946.kt");
}
@TestMetadata("kt24477.kt")
public void testKt24477() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/kt24477.kt");
}
@TestMetadata("kt25106.kt")
public void testKt25106() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/kt25106.kt");
}
@TestMetadata("kt26636.kt")
public void testKt26636() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/kt26636.kt");
}
@TestMetadata("noInline.kt")
public void testNoInline() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt");
@@ -1356,6 +1381,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/constuctorReference.kt");
}
@TestMetadata("differentInvokeSignature.kt")
public void testDifferentInvokeSignature() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/differentInvokeSignature.kt");
}
@TestMetadata("differentInvokeSignature2.kt")
public void testDifferentInvokeSignature2() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/differentInvokeSignature2.kt");
}
@TestMetadata("functionImportedFromObject.kt")
public void testFunctionImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionImportedFromObject.kt");