From b875ae774e778c9042cffd89b1be1c265948b147 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 1 Mar 2024 14:06:27 +0200 Subject: [PATCH] [FIR] Unwrap captured types in target type of SAM conversion ^KT-66256 Fixed --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 6 ++++ ...rsedBlackBoxCodegenBasedTestGenerated.java | 6 ++++ .../backend/generators/AdapterGenerator.kt | 2 +- ...LightTreeBlackBoxCodegenTestGenerated.java | 6 ++++ ...2IrFakeOverrideGeneratorTestGenerated.java | 6 ++++ .../FirPsiBlackBoxCodegenTestGenerated.java | 6 ++++ .../kotlin/fir/resolve/SamResolution.kt | 30 ++++++++++++++----- .../calls/AbstractConeCallConflictResolver.kt | 2 +- .../kotlin/fir/resolve/calls/Arguments.kt | 7 +++-- .../kotlin/fir/resolve/calls/Candidate.kt | 3 +- ...rCallCompletionResultsWriterTransformer.kt | 24 +++++++-------- .../codegen/box/sam/inProjectedSam.kt | 18 +++++++++++ .../JvmAbiConsistencyTestBoxGenerated.java | 6 ++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++++ .../IrBlackBoxCodegenTestGenerated.java | 6 ++++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 ++++ ...xCodegenTestWithInlineScopesGenerated.java | 6 ++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../fir/FirJsCodegenBoxTestGenerated.java | 6 ++++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 6 ++++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 ++++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 6 ++++ .../FirNativeCodegenBoxTestGenerated.java | 6 ++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 6 ++++ .../NativeCodegenBoxTestGenerated.java | 6 ++++ .../NativeCodegenBoxTestNoPLGenerated.java | 6 ++++ .../FirWasmJsCodegenBoxTestGenerated.java | 6 ++++ .../test/K1WasmCodegenBoxTestGenerated.java | 6 ++++ 28 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 compiler/testData/codegen/box/sam/inProjectedSam.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index cbea4e5d53b..ab64f4e387f 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -53936,6 +53936,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index eb8d8496c16..4e0cfa4cb7f 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -53936,6 +53936,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt index cc0a8ab61bb..5d502f759d2 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt @@ -549,7 +549,7 @@ internal class AdapterGenerator( } internal fun getFunctionTypeForPossibleSamType(parameterType: ConeKotlinType): ConeKotlinType? { - return samResolver.getFunctionTypeForPossibleSamType(parameterType) + return samResolver.getSamInfoForPossibleSamType(parameterType)?.functionalType } /** diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 2ce107a67df..6044aeae8bd 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -53661,6 +53661,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java index 69d05ce8310..24ea4144891 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGenerated.java @@ -53661,6 +53661,12 @@ public class FirLightTreeBlackBoxCodegenWithFir2IrFakeOverrideGeneratorTestGener runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 6843ef8df7f..5bed344950d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -53661,6 +53661,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt index cece23d5e52..cd5d549db28 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt @@ -45,7 +45,6 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment -import org.jetbrains.kotlin.utils.addToStdlib.runIf import org.jetbrains.kotlin.utils.addToStdlib.unreachableBranch private val SAM_PARAMETER_NAME = Name.identifier("function") @@ -71,27 +70,42 @@ class FirSamResolver( else -> false } - fun getFunctionTypeForPossibleSamType(type: ConeKotlinType): ConeKotlinType? { + /** + * fun interface Foo { + * fun bar(x: Int): String + * } + * + * [functionalType] is `(Int) -> String` + * [samType] is `Foo` + */ + data class SamConversionInfo(val functionalType: ConeKotlinType, val samType: ConeKotlinType) + + fun getSamInfoForPossibleSamType(type: ConeKotlinType): SamConversionInfo? { return when (type) { - is ConeClassLikeType -> getFunctionTypeForPossibleSamType(type.fullyExpandedType(session)) + is ConeClassLikeType -> SamConversionInfo( + functionalType = getFunctionTypeForPossibleSamType(type.fullyExpandedType(session)) ?: return null, + samType = type + ) is ConeFlexibleType -> { - val lowerType = getFunctionTypeForPossibleSamType(type.lowerBound) ?: return null - val upperType = getFunctionTypeForPossibleSamType(type.upperBound) ?: return null - ConeFlexibleType(lowerType.lowerBoundIfFlexible(), upperType.upperBoundIfFlexible()) + val lowerType = getSamInfoForPossibleSamType(type.lowerBound)?.functionalType ?: return null + val upperType = getSamInfoForPossibleSamType(type.upperBound)?.functionalType ?: return null + SamConversionInfo( + functionalType = ConeFlexibleType(lowerType.lowerBoundIfFlexible(), upperType.upperBoundIfFlexible()), + samType = type + ) } is ConeStubType, is ConeTypeParameterType, is ConeTypeVariableType, is ConeDefinitelyNotNullType, is ConeIntersectionType, is ConeIntegerLiteralType, -> null - is ConeCapturedType -> type.lowerType?.let { getFunctionTypeForPossibleSamType(it) } + is ConeCapturedType -> type.lowerType?.let { getSamInfoForPossibleSamType(it) } is ConeLookupTagBasedType -> unreachableBranch(type) } } private fun getFunctionTypeForPossibleSamType(type: ConeClassLikeType): ConeLookupTagBasedType? { - @OptIn(LookupTagInternals::class) val firRegularClass = type.lookupTag.toFirRegularClass(session) ?: return null val (_, unsubstitutedFunctionType) = resolveFunctionTypeIfSamInterface(firRegularClass) ?: return null diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt index 9809227d412..c0ba368d68d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt @@ -222,7 +222,7 @@ abstract class AbstractConeCallConflictResolver( private fun FirValueParameter.toFunctionTypeForSamOrNull(call: Candidate): ConeKotlinType? { val functionTypesOfSamConversions = call.functionTypesOfSamConversions ?: return null return call.argumentMapping?.entries?.firstNotNullOfOrNull { - runIf(it.value == this) { functionTypesOfSamConversions[it.key.unwrapArgument()] } + runIf(it.value == this) { functionTypesOfSamConversions[it.key.unwrapArgument()]?.functionalType } } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index ecd03f93905..013e31c5517 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -505,8 +505,9 @@ private fun Candidate.getExpectedTypeWithSAMConversion( ): ConeKotlinType? { if (candidateExpectedType.isSomeFunctionType(session)) return null - val expectedFunctionType = context.bodyResolveComponents.samResolver.getFunctionTypeForPossibleSamType(candidateExpectedType) + val samConversionInfo = context.bodyResolveComponents.samResolver.getSamInfoForPossibleSamType(candidateExpectedType) ?: return null + val expectedFunctionType = samConversionInfo.functionalType if (!argument.shouldUseSamConversion( session, @@ -520,9 +521,9 @@ private fun Candidate.getExpectedTypeWithSAMConversion( } val samConversions = functionTypesOfSamConversions - ?: hashMapOf().also { functionTypesOfSamConversions = it } + ?: hashMapOf().also { functionTypesOfSamConversions = it } - samConversions[argument.unwrapArgument()] = expectedFunctionType + samConversions[argument.unwrapArgument()] = samConversionInfo return expectedFunctionType } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Candidate.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Candidate.kt index ca8cd8df7c2..2fcf46b5c56 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Candidate.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Candidate.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.buildThisReceiverExpressionCopy import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionStub +import org.jetbrains.kotlin.fir.resolve.FirSamResolver import org.jetbrains.kotlin.fir.resolve.inference.FirInferenceSession import org.jetbrains.kotlin.fir.resolve.inference.InferenceComponents import org.jetbrains.kotlin.fir.resolve.inference.PostponedResolvedAtom @@ -112,7 +113,7 @@ class Candidate( var argumentMapping: LinkedHashMap? = null var numDefaults: Int = 0 - var functionTypesOfSamConversions: HashMap? = null + var functionTypesOfSamConversions: HashMap? = null lateinit var typeArgumentMapping: TypeArgumentMapping val postponedAtoms = mutableListOf() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt index 1743fa3dd9c..7e1561b0836 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt @@ -414,10 +414,9 @@ class FirCallCompletionResultsWriterTransformer( // Finally, the result can be wrapped in a SAM conversion if necessary. if (transformed is FirExpression) { val key = (element as? FirAnonymousFunctionExpression)?.anonymousFunction ?: element - if (expectedArgumentsTypeMapping?.samFunctionTypes?.get(key) != null) { - val expectedArgumentType = expectedArgumentsTypeMapping.getExpectedType(key) + expectedArgumentsTypeMapping?.samConversions?.get(key)?.let { samInfo -> @Suppress("UNCHECKED_CAST") - expectedArgumentType?.let { return transformed.wrapInSamExpression(it) as E } + return transformed.wrapInSamExpression(samInfo.samType) as E } } @@ -436,7 +435,6 @@ class FirCallCompletionResultsWriterTransformer( source = this@wrapInSamExpression.source?.fakeElement(KtFakeSourceElementKind.SamConversion) } } - private val FirBasedSymbol<*>.isArrayConstructorWithLambda: Boolean get() { val constructor = (this as? FirConstructorSymbol)?.fir ?: return false @@ -639,7 +637,7 @@ class FirCallCompletionResultsWriterTransformer( val isIntegerOperator = symbol.isWrappedIntegerOperator() - var samConversions: MutableMap? = null + var samConversions: MutableMap? = null val arguments = argumentMapping?.flatMap { (argument, valueParameter) -> val expectedType = when { isIntegerOperator -> ConeIntegerConstantOperatorTypeImpl( @@ -652,10 +650,12 @@ class FirCallCompletionResultsWriterTransformer( argument.unwrapAndFlattenArgument(flattenArrays = false).map { val element: FirElement = (it as? FirAnonymousFunctionExpression)?.anonymousFunction ?: it - val samFunctionType = functionTypesOfSamConversions?.get(it) - if (samFunctionType != null) { + functionTypesOfSamConversions?.get(it)?.let { samInfo -> if (samConversions == null) samConversions = mutableMapOf() - samConversions!![element] = samFunctionType.substitute(this) + samConversions!![element] = FirSamResolver.SamConversionInfo( + functionalType = samInfo.functionalType.substituteType(this), + samType = samInfo.samType.substituteType(this) + ) } element to expectedType } @@ -771,9 +771,9 @@ class FirCallCompletionResultsWriterTransformer( expectedArgumentType.isSomeFunctionType(session) -> expectedArgumentType // fun interface (a.k.a. SAM), then unwrap it and build a functional type from that interface function else -> { - val samFunctionType = (data as? ExpectedArgumentType.ArgumentsMap)?.samFunctionTypes?.get(anonymousFunction) - ?: samResolver.getFunctionTypeForPossibleSamType(expectedArgumentType) - samFunctionType?.lowerBoundIfFlexible() + val samInfo = (data as? ExpectedArgumentType.ArgumentsMap)?.samConversions?.get(anonymousFunction) + ?: samResolver.getSamInfoForPossibleSamType(expectedArgumentType) + samInfo?.functionalType?.lowerBoundIfFlexible() } } } @@ -1062,7 +1062,7 @@ sealed class ExpectedArgumentType { class ArgumentsMap( val map: Map, val lambdasReturnTypes: Map, - val samFunctionTypes: Map, + val samConversions: Map, ) : ExpectedArgumentType() class ExpectedType(val type: ConeKotlinType) : ExpectedArgumentType() diff --git a/compiler/testData/codegen/box/sam/inProjectedSam.kt b/compiler/testData/codegen/box/sam/inProjectedSam.kt new file mode 100644 index 00000000000..45fcd8fca5b --- /dev/null +++ b/compiler/testData/codegen/box/sam/inProjectedSam.kt @@ -0,0 +1,18 @@ +// ISSUE: KT-66256 + +fun interface Element { + fun invoke() +} + +class Container { + fun add(arg: T) {} +} + +fun test(c: Container) { + c.add({}) +} + +fun box(): String { + test(Container()) + return "OK" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index f074a60ceeb..4e22e646aa6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -52959,6 +52959,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 13693c5fe2b..75d1c5706ad 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -49821,6 +49821,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d0cf273e024..2d224aa09a9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -52959,6 +52959,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 32337b47f01..891a64d4dba 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -52959,6 +52959,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java index d87a990b625..0db9e9c5134 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java @@ -52959,6 +52959,12 @@ public class FirBlackBoxCodegenTestWithInlineScopesGenerated extends AbstractFir runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index dc0e3641ffd..0dc9571b64a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -42746,6 +42746,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/sam/fieldInJavaSamInterface.kt"); } + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @TestMetadata("inlinedSamWrapper.kt") public void testInlinedSamWrapper() { runTest("compiler/testData/codegen/box/sam/inlinedSamWrapper.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 0b1528270d8..c79cf0b8b09 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -38319,6 +38319,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index 52b17b29a79..9d25637cd46 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -38319,6 +38319,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 597b58f5868..f3e47e2714a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -37743,6 +37743,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 1fe96834749..07e232af3e6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -37743,6 +37743,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index 89d2f561077..83aa375c1ff 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -41786,6 +41786,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index c22529eb649..7d9c6ca0305 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -42826,6 +42826,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index c664d84fdfa..2093c7344e0 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -40158,6 +40158,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 60821da4510..7cbdddecaf3 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -41187,6 +41187,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java index fe15e48126f..aeadbd83545 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java @@ -38193,6 +38193,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 051acd2621f..ab42d7ed61d 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -37617,6 +37617,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @Test + @TestMetadata("inProjectedSam.kt") + public void testInProjectedSam() { + runTest("compiler/testData/codegen/box/sam/inProjectedSam.kt"); + } + @Test @TestMetadata("kt51821.kt") public void testKt51821() {