diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt new file mode 100644 index 00000000000..a27703b45d7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-39046 + +fun foo(b: B) {} + +fun test_1(b: B) { + foo(b.myMap { + it.k.length // implicits + } as B) +} + +fun test_2(s: String) { + val func = { s.length } as B +} + +class B(val k: K, val v: V) + +fun B.myMap(transform: (B) -> R): B = TODO() \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.txt b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.txt new file mode 100644 index 00000000000..c0604b85fca --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.txt @@ -0,0 +1,30 @@ +FILE: lambdaInLhsOfTypeOperatorCall.kt + public final fun foo(b: R|B|): R|kotlin/Unit| { + } + public final fun test_1(b: R|B|): R|kotlin/Unit| { + R|/foo|((R|/b|.R|/myMap|( = myMap@fun (it: R|B|): R|kotlin/Int| { + ^ R|/it|.R|FakeOverride|.R|kotlin/String.length| + } + ) as R|B|)) + } + public final fun test_2(s: R|kotlin/String|): R|kotlin/Unit| { + lval func: R|B| = (fun (): R|kotlin/Int| { + ^ R|/s|.R|kotlin/String.length| + } + as R|B|) + } + public final class B : R|kotlin/Any| { + public constructor(k: R|K|, v: R|V|): R|B| { + super() + } + + public final val k: R|K| = R|/k| + public get(): R|K| + + public final val v: R|V| = R|/v| + public get(): R|V| + + } + public final fun R|B|.myMap(transform: R|(B) -> R|): R|B| { + ^myMap R|kotlin/TODO|() + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 68d111fd96f..63af1a4a7a7 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -243,6 +243,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt"); } + @TestMetadata("lambdaInLhsOfTypeOperatorCall.kt") + public void testLambdaInLhsOfTypeOperatorCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt"); + } + @TestMetadata("lambdaPropertyTypeInference.kt") public void testLambdaPropertyTypeInference() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index 56c706fc607..3faaf559f10 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -243,6 +243,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt"); } + @TestMetadata("lambdaInLhsOfTypeOperatorCall.kt") + public void testLambdaInLhsOfTypeOperatorCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/lambdaInLhsOfTypeOperatorCall.kt"); + } + @TestMetadata("lambdaPropertyTypeInference.kt") public void testLambdaPropertyTypeInference() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 98f367bb309..270451ca6c5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -385,7 +385,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform typeOperatorCall: FirTypeOperatorCall, data: ResolutionMode, ): CompositeTransformResult { - val resolved = transformExpression(typeOperatorCall, data).single as FirTypeOperatorCall + val resolved = transformExpression(typeOperatorCall, ResolutionMode.ContextIndependent).single as FirTypeOperatorCall resolved.argumentList.transformArguments(integerLiteralTypeApproximator, null) val conversionTypeRef = resolved.conversionTypeRef.withTypeArgumentsForBareType(resolved.argument) resolved.transformChildren(object : FirDefaultTransformer() { diff --git a/compiler/testData/codegen/box/arrays/multiArrayConstructors.kt b/compiler/testData/codegen/box/arrays/multiArrayConstructors.kt index 90c24137a06..77663265456 100644 --- a/compiler/testData/codegen/box/arrays/multiArrayConstructors.kt +++ b/compiler/testData/codegen/box/arrays/multiArrayConstructors.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt index a5f2c6f1583..3b61307f7b0 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +FunctionTypesWithBigArity -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: Test.java diff --git a/compiler/testData/codegen/box/reflection/mapping/inlineReifiedFun.kt b/compiler/testData/codegen/box/reflection/mapping/inlineReifiedFun.kt index f3705c0b993..b7d13f8a57a 100644 --- a/compiler/testData/codegen/box/reflection/mapping/inlineReifiedFun.kt +++ b/compiler/testData/codegen/box/reflection/mapping/inlineReifiedFun.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt index d1482e4878b..bbd34af42b9 100644 --- a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt +++ b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/propertyInstanceof.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.reflect.* diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/withAs.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/withAs.fir.kt index 649671b5eb9..b0708a92797 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/withAs.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/withAs.fir.kt @@ -7,4 +7,4 @@ fun bar(f: () -> Unit) = 1 fun bar(f: (String) -> Unit) = 2 val x1 = ::foo as () -> Unit -val x2 = bar(::foo as (String) -> Unit) \ No newline at end of file +val x2 = bar(::foo as (String) -> Unit) \ No newline at end of file