From 7b46c59d5706c97fd946a6df67eab4701d56bac3 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 24 Apr 2023 12:27:47 +0200 Subject: [PATCH] K2: Complete property-candidate before starting invoke resolution Before this commit, for property candidates in K2 their types wasn't inferred/susbtituted properly. So, when candidate for fooBar.liveLoaded.invoke() was created, the type of `fooBar.liveLoaded` was just X type parameter for which there is no any `bar()` functions in its member scope. While proposed semantics is a bit different from K1, where both property and invoke candidates are united into common system, it doesn't contradict to the specification (https://kotlinlang.org/spec/overload-resolution.html#callables-and-invoke-convention) which says explicitly that invoke-convention should be desugared as `r.foo.invoke()`, thus `r.foo` should be completed independently. Also, this strategy supports some reasonable use-cases like KT-58259 while it's still a breaking change but for more artificial-looking situations (see KT-58260) and should be passed through the language committee. The changes in stubTypeReceiverRestriction* tests looks consistent because of how `genericLambda` now works (with full completion of property call). NB: The code is going to be red once KT-54667 is fixed and also there's already similar diagnostic in K1 (INFERRED_INTO_DECLARED_UPPER_BOUNDS) ^KT-58142 Fixed ^KT-58259 Fixed ^KT-58260 Related --- ...CompilerTestFE10TestdataTestGenerated.java | 18 +++++++++ ...sticCompilerFE10TestDataTestGenerated.java | 18 +++++++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 18 +++++++++ ...siOldFrontendDiagnosticsTestGenerated.java | 18 +++++++++ .../tower/FirInvokeResolveTowerExtension.kt | 2 + .../varAsFunctionCall.kt | 4 +- .../stubTypeReceiverRestriction.fir.kt | 2 +- ...stubTypeReceiverRestrictionDisabled.fir.kt | 2 +- .../invoke/completePropertyBeforeInvoke.kt | 21 ++++++++++ .../resolve/invoke/invokeCommonSystem.fir.kt | 20 ++++++++++ .../resolve/invoke/invokeCommonSystem.kt | 20 ++++++++++ .../resolve/invoke/invokeCommonSystem2.fir.kt | 17 ++++++++ .../resolve/invoke/invokeCommonSystem2.kt | 17 ++++++++ ...iableAsFunctionCallWithGenerics.fir.ir.txt | 40 ------------------- ...iableAsFunctionCallWithGenerics.fir.kt.txt | 23 ----------- .../variableAsFunctionCallWithGenerics.kt | 1 + .../test/runners/DiagnosticTestGenerated.java | 18 +++++++++ 17 files changed, 191 insertions(+), 68 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.fir.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.fir.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt delete mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 81bdcd621bb..2871b6dfd4a 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -26869,6 +26869,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); } + @Test + @TestMetadata("completePropertyBeforeInvoke.kt") + public void testCompletePropertyBeforeInvoke() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt"); + } + @Test @TestMetadata("extensionValueAsNonExtension.kt") public void testExtensionValueAsNonExtension() throws Exception { @@ -26929,6 +26935,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt"); } + @Test + @TestMetadata("invokeCommonSystem.kt") + public void testInvokeCommonSystem() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt"); + } + + @Test + @TestMetadata("invokeCommonSystem2.kt") + public void testInvokeCommonSystem2() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt"); + } + @Test @TestMetadata("invokeNonExtensionLambdaInContext.kt") public void testInvokeNonExtensionLambdaInContext() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 7489a17ea96..33db75dfba5 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -26869,6 +26869,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); } + @Test + @TestMetadata("completePropertyBeforeInvoke.kt") + public void testCompletePropertyBeforeInvoke() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt"); + } + @Test @TestMetadata("extensionValueAsNonExtension.kt") public void testExtensionValueAsNonExtension() throws Exception { @@ -26929,6 +26935,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt"); } + @Test + @TestMetadata("invokeCommonSystem.kt") + public void testInvokeCommonSystem() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt"); + } + + @Test + @TestMetadata("invokeCommonSystem2.kt") + public void testInvokeCommonSystem2() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt"); + } + @Test @TestMetadata("invokeNonExtensionLambdaInContext.kt") public void testInvokeNonExtensionLambdaInContext() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index d9fb77d5319..2fba92f8c5a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -26869,6 +26869,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); } + @Test + @TestMetadata("completePropertyBeforeInvoke.kt") + public void testCompletePropertyBeforeInvoke() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt"); + } + @Test @TestMetadata("extensionValueAsNonExtension.kt") public void testExtensionValueAsNonExtension() throws Exception { @@ -26929,6 +26935,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt"); } + @Test + @TestMetadata("invokeCommonSystem.kt") + public void testInvokeCommonSystem() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt"); + } + + @Test + @TestMetadata("invokeCommonSystem2.kt") + public void testInvokeCommonSystem2() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt"); + } + @Test @TestMetadata("invokeNonExtensionLambdaInContext.kt") public void testInvokeNonExtensionLambdaInContext() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 0707a8c2ee3..8ae7f6408e0 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -26881,6 +26881,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform"); } + @Test + @TestMetadata("completePropertyBeforeInvoke.kt") + public void testCompletePropertyBeforeInvoke() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt"); + } + @Test @TestMetadata("extensionValueAsNonExtension.kt") public void testExtensionValueAsNonExtension() throws Exception { @@ -26941,6 +26947,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt"); } + @Test + @TestMetadata("invokeCommonSystem.kt") + public void testInvokeCommonSystem() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt"); + } + + @Test + @TestMetadata("invokeCommonSystem2.kt") + public void testInvokeCommonSystem2() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt"); + } + @Test @TestMetadata("invokeNonExtensionLambdaInContext.kt") public void testInvokeNonExtensionLambdaInContext() throws Exception { 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 23a5e609c7c..1e9084fc27c 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 @@ -329,6 +329,8 @@ private fun BodyResolveComponents.createExplicitReceiverForInvokeByCallable( } source = info.fakeSourceForImplicitInvokeCallReceiver }.build().let { + callCompleter.completeCall(it, ResolutionMode.ReceiverResolution).result + }.let { transformQualifiedAccessUsingSmartcastInfo(it) } } diff --git a/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt b/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt index c2c41f34a2c..e7a5384bc77 100644 --- a/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt +++ b/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_K2: JVM_IR, JS_IR, NATIVE -// FIR status: ARGUMENT_TYPE_MISMATCH at ok.z(fail), actual String, expected T // MODULE: lib // FILE: l1.kt @@ -13,4 +11,4 @@ fun test(ok: String, fail: String) = ok.z(fail) // MODULE: main(lib) // FILE: main.kt -fun box() = test("OK", "FAIL") \ No newline at end of file +fun box() = test("OK", "FAIL") diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt index a6c6e70d8aa..25f2a336b00 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt @@ -63,7 +63,7 @@ fun test5() { val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { - b { + b { extension() genericLambda { } genericLambda { it.extension() } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt index c6325c478c9..4bd4c5e5a68 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt @@ -64,7 +64,7 @@ fun test5() { val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { - b { + b { extension() genericLambda { } genericLambda { it.extension() } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt b/compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt new file mode 100644 index 00000000000..4de5cc546bc --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt @@ -0,0 +1,21 @@ +// FIR_IDENTICAL +// ISSUE: KT-58142 +interface XTrackableLoading { + val Property>.liveLoaded: X + get(): X = TODO() +} + +interface LoadingValue + +interface Property + +interface AsyncModule { + fun bar() {} +} +operator fun T.invoke(handler: T.() -> R): R = TODO() + +fun XTrackableLoading.foo(fooBar: Property>) { + fooBar.liveLoaded { + bar() + } +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.fir.kt new file mode 100644 index 00000000000..c79bba0b88a --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.fir.kt @@ -0,0 +1,20 @@ +// ISSUE: KT-58259 + +interface Box { + val value: T +} + +interface Res { + operator fun invoke() {} +} + +val Box.foo: X get() = TODO() + +fun foo(p: Box) { + p.value.invoke() // OK + p.value() // OK + + p.foo.invoke() // OK + // Error in K1, OK in K2 + p.foo() +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt new file mode 100644 index 00000000000..ef7da78d18d --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt @@ -0,0 +1,20 @@ +// ISSUE: KT-58259 + +interface Box { + val value: T +} + +interface Res { + operator fun invoke() {} +} + +val Box.foo: X get() = TODO() + +fun foo(p: Box) { + p.value.invoke() // OK + p.value() // OK + + p.foo.invoke() // OK + // Error in K1, OK in K2 + p.foo() +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.fir.kt new file mode 100644 index 00000000000..4f7f2269e29 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.fir.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-58260 + +interface Box + +interface Res + +operator fun Res.invoke(f: F): F = TODO() + +val Box.foo: Res get() = TODO() + +fun foo(p: Box) { + p.foo("").length + p.foo.invoke("").length + + p.foo("") + p.foo.invoke("") +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt new file mode 100644 index 00000000000..0394e110e84 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-58260 + +interface Box + +interface Res + +operator fun Res.invoke(f: F): F = TODO() + +val Box.foo: Res get() = TODO() + +fun foo(p: Box) { + p.foo("").length + p.foo.invoke("").length + + p.foo("") + p.foo.invoke("") +} diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.ir.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.ir.txt deleted file mode 100644 index 19b083d3be4..00000000000 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.ir.txt +++ /dev/null @@ -1,40 +0,0 @@ -FILE fqName: fileName:/variableAsFunctionCallWithGenerics.kt - PROPERTY name:gk visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL ($receiver:T of .) returnType:kotlin.Function0.> - correspondingProperty: PROPERTY name:gk visibility:public modality:FINAL [val] - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence] reified:false - $receiver: VALUE_PARAMETER name: type:T of . - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function0.> declared in ' - FUN_EXPR type=kotlin.Function0.> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of . - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of . declared in .' - GET_VAR ': T of . declared in .' type=T of . origin=null - FUN name:testGeneric1 visibility:public modality:FINAL <> (x:kotlin.String) returnType:T of . - VALUE_PARAMETER name:x index:0 type:kotlin.String - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testGeneric1 (x: kotlin.String): T of . declared in ' - CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of . origin=INVOKE - $this: CALL 'public final fun (): kotlin.Function0.> declared in ' type=kotlin.Function0 origin=GET_PROPERTY - : kotlin.String - $receiver: GET_VAR 'x: kotlin.String declared in .testGeneric1' type=kotlin.String origin=null - PROPERTY name:kt26531Val visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL ($receiver:T of .) returnType:kotlin.Function0.> - correspondingProperty: PROPERTY name:kt26531Val visibility:public modality:FINAL [val] - TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false - $receiver: VALUE_PARAMETER name: type:T of . - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function0.> declared in ' - FUN_EXPR type=kotlin.Function0.> origin=ANONYMOUS_FUNCTION - FUN LOCAL_FUNCTION name: visibility:local modality:FINAL <> () returnType:T of . - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of . declared in .' - GET_VAR ': T of . declared in .' type=T of . origin=null - FUN name:kt26531 visibility:public modality:FINAL <> () returnType:T of . - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun kt26531 (): T of . declared in ' - CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of . origin=INVOKE - $this: CALL 'public final fun (): kotlin.Function0.> declared in ' type=kotlin.Function0 origin=GET_PROPERTY - : kotlin.Int - $receiver: CONST Int type=kotlin.Int value=7 diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt deleted file mode 100644 index 7e5a7758482..00000000000 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.fir.kt.txt +++ /dev/null @@ -1,23 +0,0 @@ -val T.gk: Function0 - get(): Function0 { - return local fun (): T { - return - } - - } - -fun testGeneric1(x: String): T { - return x.().invoke() -} - -val T.kt26531Val: Function0 - get(): Function0 { - return local fun (): T { - return - } - - } - -fun kt26531(): T { - return 7.().invoke() -} diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt index 77bb9ae2412..e22c38363b2 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCallWithGenerics.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL val T.gk: () -> T get() = { -> this } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index c6448f0446e..7be93b3b44f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -27653,6 +27653,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/invoke"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); } + @Test + @TestMetadata("completePropertyBeforeInvoke.kt") + public void testCompletePropertyBeforeInvoke() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/completePropertyBeforeInvoke.kt"); + } + @Test @TestMetadata("extensionValueAsNonExtension.kt") public void testExtensionValueAsNonExtension() throws Exception { @@ -27713,6 +27719,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt"); } + @Test + @TestMetadata("invokeCommonSystem.kt") + public void testInvokeCommonSystem() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem.kt"); + } + + @Test + @TestMetadata("invokeCommonSystem2.kt") + public void testInvokeCommonSystem2() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/invoke/invokeCommonSystem2.kt"); + } + @Test @TestMetadata("invokeNonExtensionLambdaInContext.kt") public void testInvokeNonExtensionLambdaInContext() throws Exception {