[FIR] Insert SAM conversion expressions during completion

#KT-62847 Fixed
This commit is contained in:
Kirill Rakhman
2023-11-15 12:24:31 +01:00
committed by Space Team
parent 0b28e770b2
commit dd1d36816b
68 changed files with 611 additions and 268 deletions
@@ -4,10 +4,10 @@ FIR source kind: KtRealSourceElementKind
FIR element rendered:
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
))
}
FIR FILE:
@@ -38,8 +38,8 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterfaceWithAnnotation.kt
public final [ResolvedTo(CONTRACTS)] fun testMe([ResolvedTo(CONTRACTS)] f: R|@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo|): R|kotlin/Unit| {
}
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
}
))
}
@@ -193,10 +193,10 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt
public final [ResolvedTo(CONTRACTS)] fun testMe([ResolvedTo(CONTRACTS)] f: R|foo/Foo|): R|kotlin/Unit| {
}
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
))
}
FILE RAW TO BODY:
@@ -214,8 +214,8 @@ FILE: [ResolvedTo(BODY_RESOLVE)] lambdaAsSAMInterface.kt
public final [ResolvedTo(BODY_RESOLVE)] fun testMe([ResolvedTo(BODY_RESOLVE)] f: R|foo/Foo|): R|kotlin/Unit| {
}
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
))
}
@@ -288,10 +288,10 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterfaceScript.kts
}
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
))
}
@@ -317,8 +317,9 @@ FILE: [ResolvedTo(BODY_RESOLVE)] lambdaAsSAMInterfaceScript.kts
}
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
R|foo/testMe|(<L> = SAM([ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|foo/Arg|): R|foo/Arg| <inline=NoInline> {
^ R|<local>/b|
}
)
))
}
@@ -50352,6 +50352,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("noConversionFromSamToSam.kt")
public void testNoConversionFromSamToSam() throws Exception {
runTest("compiler/testData/codegen/box/sam/noConversionFromSamToSam.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -50352,6 +50352,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("noConversionFromSamToSam.kt")
public void testNoConversionFromSamToSam() throws Exception {
runTest("compiler/testData/codegen/box/sam/noConversionFromSamToSam.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {