diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantExplicitTypeChecker.fir.txt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantExplicitTypeChecker.fir.txt index 0bd8870bac8..9d524e9f7c5 100644 --- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantExplicitTypeChecker.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantExplicitTypeChecker.fir.txt @@ -75,7 +75,7 @@ FILE: RedundantExplicitTypeChecker.kt public final fun test(boolean: R|kotlin/Boolean|): R|kotlin/Unit| { lval expectedLong: R|kotlin/Long| = when () { R|/boolean| -> { - Int(42) + Long(42) } else -> { ^test Unit diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.fir.txt new file mode 100644 index 00000000000..fb5571c8710 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.fir.txt @@ -0,0 +1,17 @@ +FILE: SpecialCallsWithLambdas.kt + public final fun foo(): R|kotlin/Unit| { + lval inv: R|() -> kotlin/Function0| = fun (): R|() -> kotlin/Unit| { + ^ fun (): R|kotlin/Unit| { + ^ Unit + } + + } + !! + lval bar: R|() -> kotlin/Function0| = fun (): R|() -> kotlin/Unit| { + ^ fun (): R|kotlin/Unit| { + ^ Unit + } + + } + + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt new file mode 100644 index 00000000000..17c9047281f --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt @@ -0,0 +1,4 @@ +fun foo() { + val inv = {{}}!! + val bar = {{}} +} diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java index 25e4476062f..3d370424d45 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java @@ -4889,6 +4889,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt"); } + @Test + @TestMetadata("SpecialCallsWithLambdas.kt") + public void testSpecialCallsWithLambdas() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt"); + } + @Test @TestMetadata("TypesEligibleForSimpleVisit.kt") public void testTypesEligibleForSimpleVisit() throws Exception { 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 c0e1d2c4d8c..63e080d5868 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 @@ -534,13 +534,16 @@ class FirCallCompletionResultsWriterTransformer( syntheticCall: D, data: ExpectedArgumentType?, ): CompositeTransformResult where D : FirResolvable, D : FirExpression { - syntheticCall.transformChildren(this, data?.getExpectedType(syntheticCall)?.toExpectedType()) val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose() val declaration = calleeReference.candidate.symbol.fir as? FirSimpleFunction ?: return syntheticCall.compose() val typeRef = typeCalculator.tryCalculateReturnType(declaration) syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef) + syntheticCall.transformChildren( + this, + data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType() + ) return (syntheticCall.transformCalleeReference( StoreCalleeReference, diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt index 5b4ac730f0a..87e10fd6c44 100644 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt +++ b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithLambdas.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR // DONT_TARGET_EXACT_BACKEND: WASM import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt index 5e8254c4013..4657de5aa65 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt @@ -5,7 +5,7 @@ fun materialize(): M = TODO() fun test(b: Boolean) { id(if (b) { - id(unresolved) + id(unresolved) } else { id( materialize()