diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 8fb8fbf5f7e..85c0647ed4b 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -856,7 +856,7 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder isNullable, unwrappedElement.receiverTypeReference.convertSafe(), // TODO: probably implicit type should not be here - unwrappedElement.returnTypeReference.toFirOrImplicitType() + unwrappedElement.returnTypeReference.toFirOrErrorType() ) for (valueParameter in unwrappedElement.parameters) { functionType.valueParameters += valueParameter.convert() diff --git a/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.kt b/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.kt new file mode 100644 index 00000000000..cc93ef073fe --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.kt @@ -0,0 +1,7 @@ +fun foo(func: (Int).Int -> Int) {} + +fun test() { + foo { + this + it + } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.txt b/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.txt new file mode 100644 index 00000000000..91c07b808b9 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.txt @@ -0,0 +1,10 @@ +FILE: incorrectFunctionalType.kt + public final fun foo(func: R|kotlin/Int.() -> class error: Incomplete code|, Int: ): R|kotlin/Unit| + fun (): R|kotlin/Unit| { + } + public final fun test(): R|kotlin/Unit| { + #( = foo@fun .(): R|kotlin/String| { + this#.R|kotlin/plus|(#) + } + ) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 07830f33a38..908a4b3835f 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -240,6 +240,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt"); } + @TestMetadata("incorrectFunctionalType.kt") + public void testIncorrectFunctionalType() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.kt"); + } + @TestMetadata("invoke.kt") public void testInvoke() throws Exception { runTest("compiler/fir/resolve/testData/resolve/arguments/invoke.kt");