From 3b35374186bf30c00cb9c99d8532e84e4d785511 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Thu, 19 Mar 2020 16:28:17 +0300 Subject: [PATCH] [Spec tests] Add diagnostics tests for building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver --- .../{p-6 => p-5}/pos/1.1.kt | 4 +- .../{p-6 => p-5}/pos/1.10.kt | 12 +- .../{p-6 => p-5}/pos/1.2.kt | 4 +- .../{p-6 => p-5}/pos/1.4.kt | 6 +- .../{p-6 => p-5}/pos/1.5.kt | 4 +- .../{p-6 => p-5}/pos/1.6.kt | 6 +- .../{p-6 => p-5}/pos/1.7.kt | 4 +- .../{p-6 => p-5}/pos/1.8.kt | 4 +- .../{p-6 => p-5}/pos/1.9.kt | 6 +- .../p-6/pos/1.3.kt | 30 --- .../testsMap.json | 69 +++---- .../p-6/pos/1.1.kt | 91 +++++++++ .../p-6/pos/1.2.kt | 53 ++++++ .../p-6/pos/1.3.kt | 53 ++++++ .../p-6/pos/1.4.kt | 66 +++++++ .../p-6/pos/1.5.kt | 82 ++++++++ .../p-6/pos/2.1.kt | 103 ++++++++++ .../p-6/pos/2.2.kt | 71 +++++++ .../p-6/pos/2.3.kt | 30 +++ .../p-6/pos/2.4.kt | 71 +++++++ .../p-6/pos/3.1.kt | 35 ++++ .../p-6/pos/4.1.kt | 122 ++++++++++++ .../p-6/pos/4.2.kt | 33 ++++ .../p-6/pos/5.1.kt | 28 +++ .../p-6/pos/6.1.kt | 27 +++ .../testsMap.json | 177 ++++++++++++++++++ .../c-level-partition/testsMap.json | 43 +++++ .../DiagnosticsTestSpecGenerated.java | 139 +++++++++++++- .../BlackBoxCodegenTestSpecGenerated.java | 35 ++-- 29 files changed, 1291 insertions(+), 117 deletions(-) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.1.kt (94%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.10.kt (83%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.2.kt (93%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.4.kt (88%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.5.kt (93%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.6.kt (90%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.7.kt (94%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.8.kt (94%) rename compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/{p-6 => p-5}/pos/1.9.kt (90%) delete mode 100644 compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/testsMap.json create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/c-level-partition/testsMap.json diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.1.kt similarity index 94% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.1.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.1.kt index 630a5287d58..37fcc681fc6 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.1.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 6 * NUMBER: 1 diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.10.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.10.kt similarity index 83% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.10.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.10.kt index 55b33f6066c..f9fa936d728 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.10.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.10.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 4 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 9 * NUMBER: 10 @@ -13,6 +13,7 @@ // FILE: KotlinLib.kt package test.lib + class MyClass { //property-like (II prio) companion object foo { @@ -28,11 +29,12 @@ package overloadResolution import test.lib.MyClass.foo as boo //function-like (I prio) -class boo(){} +open class A() +class boo() : A() {} fun box(): String { - val x = boo() - if (x is boo && !test.lib.MyClass.fooCompanionObj) + val x: Any = boo() + if (x !is A && test.lib.MyClass.fooCompanionObj) return "OK" return "NOK" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.2.kt similarity index 93% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.2.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.2.kt index 555db993290..9ee12e8bafd 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.2.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.2.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 6 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 3 * NUMBER: 2 diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.4.kt similarity index 88% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.4.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.4.kt index cd865b3a0b7..ebb1770a31a 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.4.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.4.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10 * NUMBER: 4 @@ -28,7 +28,7 @@ fun box(): String { boo(1) - if (!test.lib.isFooCalled && isBooCalled) + if (test.lib.isFooCalled && !isBooCalled) return "OK" return "NOK" diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.5.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.5.kt similarity index 93% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.5.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.5.kt index 8167f85b8ee..271f3509c3d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.5.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.5.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 7 * NUMBER: 5 diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.6.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.6.kt similarity index 90% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.6.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.6.kt index b645f510010..34c923ce3ab 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.6.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.6.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 7 * NUMBER: 6 @@ -32,7 +32,7 @@ fun foo() { fooFun = true } fun box(): String { foo() - if (!test.lib.isMarker && fooFun) + if (test.lib.isMarker && !fooFun) return "OK" return "NOK" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.7.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.7.kt similarity index 94% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.7.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.7.kt index 30eb5a2212a..08418010b43 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.7.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.7.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 7 * NUMBER: 7 diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.8.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.8.kt similarity index 94% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.8.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.8.kt index 73c951cfeee..b3a3d1909d4 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.8.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.8.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 8 * NUMBER: 8 diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.9.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.9.kt similarity index 90% rename from compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.9.kt rename to compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.9.kt index 204e735212c..9b6f62d80c8 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.9.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.9.kt @@ -3,8 +3,8 @@ /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 5 -> sentence 1 * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 2 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 8 * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10 @@ -34,7 +34,7 @@ fun boo() { booFun = true } fun box(): String { boo() - if (booFun && !test.lib.MyClass.fooCompanionObj) + if (!booFun && test.lib.MyClass.fooCompanionObj) return "OK" return "NOK" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt deleted file mode 100644 index 080187f9d20..00000000000 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt +++ /dev/null @@ -1,30 +0,0 @@ -// WITH_RUNTIME - -/* - * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-253 - * PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 - * RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 4 - * overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 6 - * NUMBER: 3 - * DESCRIPTION: function-like prio is higher than property-like callables - */ - - -class foo(val a: Int) - -var fooLambda: Boolean = false - -val foo: (Int) -> Unit = { a: Int -> fooLambda = true } - - -fun box(): String { - - val x = foo(1) - - if (x is foo && !fooLambda) - return "OK" - - return "NOK" -} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/testsMap.json index 4cf157a97e9..ffb6f67d410 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/testsMap.json @@ -1,63 +1,57 @@ { - "6": { + "5": { "pos": { "1": [ { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", - "casesNumber": 0, - "description": "function-like prio is higher than property-like callables", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", "unexpectedBehaviour": false @@ -69,77 +63,70 @@ "pos": { "2": [ { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.6.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.6.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.7.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.7.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.8.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.8.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.9.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.9.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.4.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.4.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.5.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.5.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.1.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.1.kt", "unexpectedBehaviour": false } ], "6": [ { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.2.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.2.kt", "unexpectedBehaviour": false } ], "4": [ { - "specVersion": "0.1-253", + "specVersion": "0.1-268", "casesNumber": 0, "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-253", - "casesNumber": 0, - "description": "function-like prio is higher than property-like callables", - "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.10.kt", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.10.kt", "unexpectedBehaviour": false } ] diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt new file mode 100644 index 00000000000..61ed44734da --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt @@ -0,0 +1,91 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * overload-resolution, receivers -> paragraph 7 -> sentence 2 + * overload-resolution, receivers -> paragraph 7 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: sets of non-extension member callables only + */ + +package tests.test2 + +// TESTCASE NUMBER: 1 +open class Case1() { + companion object foo { + operator fun invoke() {} + } + + val propVal: Int = 1 + val propVar: Int = 1 + fun function() {} + val markerObj = object : Marker {} + + fun innerFun() { + foo() + Case1.foo() + propVal() + this.propVal() + propVar() + this.propVar() + function() + this.function() + markerObj() + this.markerObj() + } + + operator fun Int.invoke() {} + + inner class InnerClass { + + fun innerClassFun() { + foo() + Case1.foo() + + propVal() + this@Case1.propVal() + + propVar() + this@Case1.propVar() + + function() + this@Case1.function() + + markerObj() + this@Case1.markerObj() + } + } +} + +interface Marker { + operator fun invoke() {} +} + +class ExtendCase1() : Case1() { + + fun extFun() { + foo() + Case1.foo() + propVal() + this.propVal() + propVar() + this.propVar() + function() + this.function() + markerObj() + this.markerObj() + } +} + +fun case6() { + Case1.invoke() + Case1.foo() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt new file mode 100644 index 00000000000..aea05e3a3aa --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * overload-resolution, receivers -> paragraph 7 -> sentence 2 + * overload-resolution, receivers -> paragraph 7 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION: set of non-extension member callables only + */ + +// TESTCASE NUMBER: 1 +interface Marker { + operator fun invoke() {} +} + +class Case1() { + fun foo() : Int =1 + + val foo = object : Marker {} + + fun innerFun() { + foo() + this.foo() + } + + inner class InnerClass0 { + val foo = object : Marker {} + + fun innerClassFun() { + foo() + this.foo() + this@Case1.foo() + } + } + inner class InnerClass1 { + fun foo() : Int =1 + + fun innerClassFun() { + foo() + this.foo() + this@Case1.foo() + } + } +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt new file mode 100644 index 00000000000..930ec714f9e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: The sets of non-extension member callables named f of type T; + */ + +class Marker { + fun foo() = println("non-extension member toplevel Marker.foo()") + val foo: String = "non-extension member toplevel Marker.foo" +} + +// TESTCASE NUMBER: 1 +class Case1() { + + fun Marker.foo() = println("local extension marker.foo") + + fun test() { + Marker().foo() + } +} + +fun case1() { + Marker().foo() +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun test() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() + } +} + +fun Marker.foo() = println("top level extension marker.foo") + +fun case2() { + Marker().foo() +} + +// TESTCASE NUMBER: 3 +fun case3() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt new file mode 100644 index 00000000000..4d20c8d4d5c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt @@ -0,0 +1,66 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables + */ + +// TESTCASE NUMBER: 1, 2, 3 + +// FILE: Marker.kt +package libPackage + +class Marker { + fun foo() = println("non-extension member Marker.foo()") + val foo: String = "non-extension member Marker.foo" +} + +// FILE: Tests.kt +package tests +import libPackage.Marker + +// TESTCASE NUMBER: 1 +class Case1() { + + fun Marker.foo() = println("local extension marker.foo") + + fun test() { + Marker().foo() + } +} + +fun case1() { + Marker().foo() +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun test() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() + } +} + +fun Marker.foo() = println("top level extension marker.foo") + +fun case2() { + Marker().foo() +} + +// TESTCASE NUMBER: 3 +fun case3() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt new file mode 100644 index 00000000000..1d4e99c461b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt @@ -0,0 +1,82 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * overload-resolution, callables-and-invoke-convention -> paragraph 6 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables + */ + +// TESTCASE NUMBER: 1, 2, 3, 4, 5 + +// FILE: Marker.kt +package libPackage + +class Marker { + fun foo() = println("non-extension member Marker.foo()") + val foo: Marker = this + operator fun invoke() = println("non-extension member Marker.invoke()") +} + +// FILE: Tests.kt +package tests +import libPackage.Marker + +// TESTCASE NUMBER: 1 + +class Case1() { + + fun Marker.foo() = println("local extension marker.foo") + + fun test() { + Marker().foo() + } +} + +fun case1() { + Marker().foo() +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun test() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() + } +} + +fun Marker.foo() = println("top level extension marker.foo") + +fun case2() { + Marker().foo() +} + +// TESTCASE NUMBER: 3 +fun case3() { + fun Marker.foo() = println("local extension marker.foo") + Marker().foo() +} + +// TESTCASE NUMBER: 4 +fun case4(marker : Marker?) { + marker?.foo() +} + +// TESTCASE NUMBER: 5 +fun case5(marker : Marker?) { + fun bar(){ + fun Marker.foo() = println("local extension marker.foo") + marker?.foo() + } + marker?.foo() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt new file mode 100644 index 00000000000..9dd0b767f13 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt @@ -0,0 +1,103 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * RELEVANT PLACES: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * overload-resolution, callables-and-invoke-convention -> paragraph 7 -> sentence 1 + * overload-resolution, callables-and-invoke-convention -> paragraph 7 -> sentence 2 + * overload-resolution, receivers -> paragraph 7 -> sentence 2 + * overload-resolution, receivers -> paragraph 7 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: The sets of local extension callables + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo() : Int =1 + + val foo = object : MarkerCase1 {} + + fun innerFun() { + this.foo() + } + + + inner class InnerClass0 { + val foo = object : MarkerCase1 {} + operator fun MarkerCase1.invoke() {} + + fun innerClassFun() { + this.foo() + } + } + + operator fun MarkerCase1.invoke() {} + + inner class InnerClass1(){ + val foo = object : MarkerCase1 {} + + fun nestedClassFun(){ + this.foo() + } + } +} + +interface MarkerCase1 {} + +fun case1(){ + operator fun MarkerCase1.invoke() {} + Case1().InnerClass0().foo() + Case1().InnerClass1().foo() +} + +// TESTCASE NUMBER: 2 +open class Case2() { + open fun fooCase2(): MarkerCase2 = object : MarkerCase2 {} + + open val fooCase2 = object : MarkerCase2 {} + + interface MarkerCase2 {} + open operator fun MarkerCase2.invoke() {} + + fun innerFun() { + fooCase2() + this.fooCase2() + } + + inner class InnerClass0 : Case2() { + override fun fooCase2(): MarkerCase2 { + return object : MarkerCase2 {} + } + + override operator fun MarkerCase2.invoke() {} + + fun innerClassFun() { + this@Case2.fooCase2() + this.fooCase2() + } + } + + + inner class InnerClass1() { + val fooCase2 = object : MarkerCase2 {} + + fun nestedClassFun() { + this.fooCase2() + } + } +} + + +fun case2() { + operator fun Case2.MarkerCase2.invoke() {} + Case2().InnerClass0().fooCase2() + Case2().InnerClass1().fooCase2() +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt new file mode 100644 index 00000000000..1931d027d75 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt @@ -0,0 +1,71 @@ +// !LANGUAGE: +NewInference +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * RELEVANT PLACES: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 2 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: extension calls with explicit and implicit receiver + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-36475 + */ + +// TESTCASE NUMBER: 1 +class Case1 { + fun bar() { + val foo: String.() -> Unit = {} // (1) + fun String.foo(): Unit {} // (2) + "1".foo() // resolves to (2) + with("2") { + foo() //resolves to (1) !!! + this.foo() //resolves to (2) + } + "".run { + foo() //resolves to (1) !!! + this.foo() //resolves to (2) + } + "".apply { + foo() //resolves to (1) !!! + this.foo() //resolves to (2) + } + "".also { + it.foo() //resolves to (2) + } + "".let { + it.foo() //resolves to (2) + } + } +} + +class B { + val foo: String.() -> Unit = {} // (1) + fun String.foo(): Unit {} // (2) + fun bar() { + "1".foo() // resolves to (2) + val str = "1" + with("2") { + foo() //resolves to (2) + this.foo() //resolves to (2) + } + "".run { + foo() //resolves to (2) + this.foo() //resolves to (2) + } + "".apply { + foo() //resolves to (2) + this.foo() //resolves to (2) + } + "".also { + it.foo() //resolves to (2) + } + "".let { + it.foo() //resolves to (2) + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt new file mode 100644 index 00000000000..c8d736bbb07 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt @@ -0,0 +1,30 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * RELEVANT PLACES: overload-resolution, c-level-partition -> paragraph 1 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: set of non-extension member callables only + */ +// TESTCASE NUMBER: 1 +class Case1 { + operator fun String.invoke() :String{ return this} //fqName: Case1.invoke; typeCall: function + fun String.foo() : String = this //fqName: Case1.foo; typeCall: function; + fun bar() { + "".foo() + "".invoke() + ""() + ""()()()() () + ""().invoke()()() + ""().foo()().invoke()() + "1".foo()() + "1"()().invoke()().foo() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt new file mode 100644 index 00000000000..3c29ec3b3f2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt @@ -0,0 +1,71 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * overload-resolution, receivers -> paragraph 5 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: sets of local, explicitly imported, declared in the package scope and star-imported extension callables + */ + +// FILE: Extensions.kt +package libPackage + +public fun String?.orEmpty(): String = "my Extension for $this" + +// FILE: TestCase1.kt + +package sentence3 + +import libPackage.* +import libPackage.orEmpty + +private fun String?.orEmpty(): String = "my top-level (pack scope) Extension for $this" + +// TESTCASE NUMBER: 1 +class Case1() { + fun String?.orEmpty(): String = "my local extension for $this" + fun case1(s: String?) { + s.orEmpty() + } +} + +// FILE: TestCase2.kt +package sentence3 +import libPackage.* +//import libPackage.orEmpty + +private fun String?.orEmpty(): String = "my top-level (pack scope) Extension for $this" + +// TESTCASE NUMBER: 2 +class Case2() { + fun String?.orEmpty(): String = "my local extension for $this" + fun case2(s: String?) { + s.orEmpty() + } +} + +// TESTCASE NUMBER: 3 +class Case3() { + fun String?.orEmpty(): String = "my local extension for $this" + fun case3(s: String?) { + s.orEmpty() + fun innerFirst(s: String?){ + fun String?.orEmpty(): String = "my local inner extension for $this" + s?.orEmpty() + } + fun innerSecond(){ + fun String?.orEmpty(): String = "my local inner extension for $this" + s.orEmpty() + } + s.orEmpty() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt new file mode 100644 index 00000000000..bbed7ef2ec9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt @@ -0,0 +1,35 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE:overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: sets of explicitly imported, declared in the package scope and star-imported extension callables + */ + +// FILE: Extensions.kt +package libPackage + +public fun String?.orEmpty(): String = "my Extension for $this" + +// FILE: TestCase1.kt +package sentence3 + +import libPackage.* +import libPackage.orEmpty + + +private fun String?.orEmpty(): String = "my top level extension for $this" + +// TESTCASE NUMBER: 1 +fun case1(s: String?) { + s.orEmpty() +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt new file mode 100644 index 00000000000..2ee32c9ebde --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt @@ -0,0 +1,122 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 9 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: sets of extension callables declared in the package scope + */ + +package tests.diag + +// TESTCASE NUMBER: 1, 2 +operator fun Int.invoke() {} + +// TESTCASE NUMBER: 3, 4 +interface Marker { + operator fun invoke() {} +} + +// TESTCASE NUMBER: 1 +class Case1 { + val foo: Int = 1 +} + +fun case1() { + Case1().foo() + val a = Case1() + a.foo() + var b = Case1() + b.foo() +} + +// TESTCASE NUMBER: 2 +class Case2 { + val foo: Int = 1 + fun foo(): Int = 1 +} + +fun case2() { + Case2().foo() + val a = Case2() + a.foo() + var b = Case2() + b.foo() +} + +// TESTCASE NUMBER: 3 +class Case3() { + val foo = object : Marker {} + fun foo(): Int = 1 + + fun f() { + this.foo() + } +} + +fun case3() { + Case3().foo() + val a = Case3() + a.foo() + var b = Case3() + b.foo() +} + +// TESTCASE NUMBER: 4 +class Case4() { + val foo = object : Marker {} + + fun f() { + this.foo() + } +} + +fun case4() { + Case4().foo() + val a = Case4() + a.foo() + var b = Case4() + b.foo() +} + + +// TESTCASE NUMBER: 5 +class Case5() { + companion object foo { + operator fun invoke() {} + } + + fun innerFun() = this.foo() + + fun foo(): Int = 1 + +} + +fun case5() { + Case5().foo() + val a = Case5() + a.foo() + + var b = Case5() + b.foo() +} + + +// TESTCASE NUMBER: 6 +class Case6() { + companion object foo { + operator fun invoke() {} + } + + fun innerFun() = foo() +} + +fun case6() { + Case6.foo() +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt new file mode 100644 index 00000000000..44ce8fefd46 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: sets of declared in the package scope and star-imported extension callables + */ + +// FILE: Extensions.kt +package libPackage + +public fun String?.orEmpty(): String = "my Extension for $this" + +// FILE: TestCase2.kt +package sentence3 + +import libPackage.* +//import libPackage.orEmpty + +private fun String?.orEmpty(): String = "my top level extension for $this" + +// TESTCASE NUMBER: 1 +fun case2(s: String?) { + s.orEmpty() +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt new file mode 100644 index 00000000000..d59d5470076 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt @@ -0,0 +1,28 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: set of star-imported extension callables + */ + +// FILE: Extensions.kt +package libPackage + +public fun String?.orEmpty(): String = "my Extension for $this" + +// FILE: TestCase2.kt +package sentence3 + +import libPackage.* + +// TESTCASE NUMBER: 1 +fun case2(s: String?) { + s.orEmpty() +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt new file mode 100644 index 00000000000..f5b98bc22e5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-268 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 6 + * RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: set of implicitly-imported extension callables + */ + +// FILE: Extensions.kt +package libPackage + +private fun String?.orEmpty(): String = "my private Extension for $this" + +// FILE: TestCase2.kt +package sentence3 +import libPackage.* //nothing to import, extension is private + +// TESTCASE NUMBER: 1 +fun case2(s: String) { + s.orEmpty() +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/testsMap.json new file mode 100644 index 00000000000..4a657d4e777 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/testsMap.json @@ -0,0 +1,177 @@ +{ + "6": { + "pos": { + "2": [ + { + "specVersion": "0.1-268", + "casesNumber": 2, + "description": "The sets of local extension callables", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "sets of local, explicitly imported, declared in the package scope and star-imported extension callables", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "The sets of non-extension member callables named f of type T;", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of non-extension member callables only", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 5, + "description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "extension calls with explicit and implicit receiver", + "unexpectedBehaviour": true + } + ], + "1": [ + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of non-extension member callables only", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "The sets of non-extension member callables named f of type T;", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 5, + "description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of non-extension member callables only", + "unexpectedBehaviour": false + } + ], + "3": [ + { + "specVersion": "0.1-268", + "casesNumber": 3, + "description": "sets of local, explicitly imported, declared in the package scope and star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported, declared in the package scope and star-imported extension callables", + "unexpectedBehaviour": false + } + ], + "4": [ + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported, declared in the package scope and star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 6, + "description": "sets of extension callables declared in the package scope", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of declared in the package scope and star-imported extension callables", + "unexpectedBehaviour": false + } + ], + "5": [ + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of star-imported extension callables", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of declared in the package scope and star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt", + "unexpectedBehaviour": false + } + ], + "6": [ + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of implicitly-imported extension callables", + "unexpectedBehaviour": false + } + ] + } + }, + "9": { + "pos": { + "1": [ + { + "specVersion": "0.1-268", + "casesNumber": 6, + "description": "sets of extension callables declared in the package scope", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "11": { + "pos": { + "1": [ + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of star-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of implicitly-imported extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/c-level-partition/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/c-level-partition/testsMap.json new file mode 100644 index 00000000000..efebd3fc00c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/c-level-partition/testsMap.json @@ -0,0 +1,43 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-268", + "casesNumber": 2, + "description": "The sets of local extension callables", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of non-extension member callables only", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "set of non-extension member callables only", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "extension calls with explicit and implicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt", + "unexpectedBehaviour": true + }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of non-extension member callables only", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java index f0dc77c1da0..df5a8668343 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java @@ -25,7 +25,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInDiagnostics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "linked/type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/annotations", "linked/statements/assignments/simple-assignments", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overloadable-operators", "linked/overload-resolution", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "linked/type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/annotations", "linked/statements/assignments/simple-assignments", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overloadable-operators", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @@ -37,7 +37,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "annotations", "statements/assignments/simple-assignments", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overloadable-operators", "overload-resolution", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "annotations", "statements/assignments/simple-assignments", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overloadable-operators", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis") @@ -3371,6 +3371,141 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Overload_resolution extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOverload_resolution() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution"), Pattern.compile("^(.+)\\.kt$"), null, true, "c-level-partition", "determining-function-applicability-for-a-specific-call"); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Building_the_overload_candidate_set_ocs extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBuilding_the_overload_candidate_set_ocs() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Call_with_an_explicit_receiver extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCall_with_an_explicit_receiver() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_6 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_6() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/1.5.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.3.kt"); + } + + @TestMetadata("2.4.kt") + public void test2_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/2.4.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/5.1.kt"); + } + + @TestMetadata("6.1.kt") + public void test6_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/6.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java index 491c045db0b..7120ae5b0d6 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -3317,19 +3317,19 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6") + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class P_6 extends AbstractBlackBoxCodegenTestSpec { + public static class P_5 extends AbstractBlackBoxCodegenTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - public void testAllFilesPresentInP_6() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6"), Pattern.compile("^(.+)\\.kt$"), null, true); + public void testAllFilesPresentInP_5() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos") + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Pos extends AbstractBlackBoxCodegenTestSpec { @@ -3339,56 +3339,51 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes @TestMetadata("1.1.kt") public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.1.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.1.kt"); } @TestMetadata("1.10.kt") public void test1_10() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.10.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.10.kt"); } @TestMetadata("1.2.kt") public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.2.kt"); - } - - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.3.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.2.kt"); } @TestMetadata("1.4.kt") public void test1_4() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.4.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.4.kt"); } @TestMetadata("1.5.kt") public void test1_5() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.5.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.5.kt"); } @TestMetadata("1.6.kt") public void test1_6() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.6.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.6.kt"); } @TestMetadata("1.7.kt") public void test1_7() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.7.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.7.kt"); } @TestMetadata("1.8.kt") public void test1_8() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.8.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.8.kt"); } @TestMetadata("1.9.kt") public void test1_9() throws Exception { - runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos/1.9.kt"); + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos/1.9.kt"); } public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); } } }