diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt index e1df43736e5..9f432b83e24 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt @@ -178,6 +178,8 @@ internal class FirInvokeResolveTowerExtension( invokeReceiverCandidate, info, invokeBuiltinExtensionMode, extensionReceiverExpression ) ?: continue + if (invokeReceiverExpression.resolvedType is ConeErrorType) continue + val invokeFunctionInfo = info.copy( explicitReceiver = invokeReceiverExpression, diff --git a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt index 245ba420481..3ae944dca2a 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt @@ -1,13 +1,13 @@ // WITH_STDLIB // FILE: test.kt -val bar2 by bar2() +val bar2 by bar2() // FILE: lt/neworld/compiler/Foo.kt package lt.neworld.compiler class Foo { - val bar by bar() + val bar by bar() } // FILE: lt/neworld/compiler/bar/Bar.kt diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index 11ae531a292..857028e6548 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -35,7 +35,7 @@ fun poll11(flag: Boolean) { fun poll12(flag: Boolean) { val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + inv() } fun poll13(flag: Boolean) { @@ -45,12 +45,12 @@ fun poll13(flag: Boolean) { fun poll14(flag: Boolean) { val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + inv() } fun poll15(flag: Boolean) { val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + inv() } fun poll16(flag: Boolean) { @@ -65,7 +65,7 @@ fun poll17(flag: Boolean) { fun poll2(flag: Boolean) { val inv = when (flag) { true -> ::bar else -> ::foo } - inv() + inv() } fun poll21(flag: Boolean) { @@ -75,12 +75,12 @@ fun poll21(flag: Boolean) { fun poll22(flag: Boolean) { val inv = when (flag) { true -> ::bar3 else -> ::foo3 } - inv() + inv() } fun poll23(flag: Boolean) { val inv = when (flag) { true -> ::bar4 else -> ::foo4 } - inv() + inv() } fun poll24(flag: Boolean) { @@ -100,7 +100,7 @@ fun poll26(flag: Boolean) { fun poll3(flag: Boolean) { val inv = when (flag) { true -> ::bar false -> ::foo } - inv() + inv() } fun poll31(flag: Boolean) { @@ -110,12 +110,12 @@ fun poll31(flag: Boolean) { fun poll32(flag: Boolean) { val inv = when (flag) { true -> ::bar3 false -> ::foo3 } - inv() + inv() } fun poll33(flag: Boolean) { val inv = when (flag) { true -> ::bar4 false -> ::foo4 } - inv() + inv() } fun poll34(flag: Boolean) { @@ -135,7 +135,7 @@ fun poll36(flag: Boolean) { fun poll4() { val inv = try { ::bar } finally { ::foo } - inv() + inv() } fun poll41() { @@ -145,17 +145,17 @@ fun poll41() { fun poll42() { val inv = try { ::bar3 } finally { ::foo3 } - inv() + inv() } fun poll43() { val inv = try { ::bar4 } finally { ::foo4 } - inv() + inv() } fun poll44() { val inv = try { ::bar5 } finally { ::foo5 } - inv() + inv() } fun poll45() { @@ -170,7 +170,7 @@ fun poll46() { fun poll5() { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } fun poll51() { @@ -180,17 +180,17 @@ fun poll51() { fun poll52() { val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + inv() } fun poll53() { val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + inv() } fun poll54() { val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + inv() } fun poll55() { @@ -240,7 +240,7 @@ fun poll66() { fun poll7() { val inv = ::bar!! - inv() + inv() } fun poll71() { @@ -250,7 +250,7 @@ fun poll71() { fun poll72() { val inv = ::bar3!! - inv() + inv() } fun poll73() { diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.fir.kt index e3555c48c1e..8c7e016fee1 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.fir.kt @@ -5,7 +5,7 @@ fun foo(): Int = 0 object Implicit { operator fun Any.invoke(): String = "Fail" - val foo = foo() + val foo = foo() } object Explicit { @@ -27,16 +27,16 @@ object ImplicitIndirect { val foo get() = bar() val bar get() = baz() - val baz get() = foo() + val baz get() = foo() } fun takeInt(x: Int) {} fun test() { - takeInt(Implicit.foo) // should be an error + takeInt(Implicit.foo) takeInt(Explicit.foo) // should be an error takeInt(ImplicitWrapped.foo) // should be an error takeInt(ImplicitIndirect.foo) // should be an error takeInt(ImplicitIndirect.bar) // should be an error - takeInt(ImplicitIndirect.baz) // should be an error + takeInt(ImplicitIndirect.baz) } diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.kt index 43444bc5a31..36faf767b2c 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer.kt @@ -33,10 +33,10 @@ object ImplicitIndirect { fun takeInt(x: Int) {} fun test() { - takeInt(Implicit.foo) // should be an error + takeInt(Implicit.foo) takeInt(Explicit.foo) // should be an error takeInt(ImplicitWrapped.foo) // should be an error takeInt(ImplicitIndirect.foo) // should be an error takeInt(ImplicitIndirect.bar) // should be an error - takeInt(ImplicitIndirect.baz) // should be an error + takeInt(ImplicitIndirect.baz) } diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.fir.kt deleted file mode 100644 index a1a879194dc..00000000000 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !LANGUAGE: +ContextReceivers -// WITH_STDLIB - -interface C - -fun C.foo(body: () -> Unit) {} - -context(C) -class A { - val foo = foo {} -} - -fun C.test() { - object { - val foo = foo {} - } -} diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.kt index 69e6d3e8c17..296332193a0 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/implicitInvokeOnPropertyInItsInitializer2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers // WITH_STDLIB diff --git a/plugins/scripting/scripting-tests/testData/diagnostics/testScripts/invokeResolve.test.kts b/plugins/scripting/scripting-tests/testData/diagnostics/testScripts/invokeResolve.test.kts index 0a9eba66db7..fb2270e1cb5 100644 --- a/plugins/scripting/scripting-tests/testData/diagnostics/testScripts/invokeResolve.test.kts +++ b/plugins/scripting/scripting-tests/testData/diagnostics/testScripts/invokeResolve.test.kts @@ -1,3 +1,3 @@ // GRADLE_LIKE_SCRIPT -val projectApi = projectApi { it } +val projectApi = projectApi { it }