diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt new file mode 100644 index 00000000000..9c653287c28 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.fir.kt @@ -0,0 +1,70 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case1() { + C1.V() + + C1.Companion.V() + +} + +class C1(){ + companion object { + class V(){ + } + } +} + + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case2() { + C2.V() // to (2) + C2.Companion.V() // to (1) +} + +open class C2(){ + companion object { + class V //(1) + } + + object V : L() + +} + +open class L { + operator fun invoke() {} //(2) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case3() { + C3.V() // to (2) + C3.Companion.V() // to (1) +} + +open class C3(){ + companion object { + class V //(1) + } + + object V : L3() + +} + +open class L3 { + operator fun invoke(s : String ="") {} //(2) +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.kt new file mode 100644 index 00000000000..a99748282c7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.kt @@ -0,0 +1,78 @@ +// !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-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver, call-with-an-explicit-type-receiver -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case1() { + C1.V() + + C1.Companion.; typeCall: function")!>V() + +} + +class C1(){ + companion object { + class V(){ + } + } +} + + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case2() { + C2.V() // to (2) + C2.Companion.; typeCall: function")!>V() // to (1) +} + +open class C2(){ + companion object { + class V //(1) + } + + object V : L() + +} + +open class L { + operator fun invoke() {} //(2) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39129 + */ +fun case3() { + C3.V() // to (2) + C3.Companion.; typeCall: function")!>V() // to (1) +} + +open class C3(){ + companion object { + class V //(1) + } + + object V : L3() + +} + +open class L3 { + operator fun invoke(s : String ="") {} //(2) +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/testsMap.json new file mode 100644 index 00000000000..0162501e8c8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/testsMap.json @@ -0,0 +1,16 @@ +{ + "3": { + "pos": { + "2": [ + { + "specVersion": "0.1-401", + "casesNumber": 3, + "description": "", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos/2.1.kt", + "unexpectedBehaviour": true, + "linkType": "main" + } + ] + } + } +} \ 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/3.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/3.2.kt new file mode 100644 index 00000000000..bf36a9cec1a --- /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.2.kt @@ -0,0 +1,55 @@ +// FIR_IDENTICAL +// !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 + * MAIN LINK:overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3 + * PRIMARY LINKS: 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, building-the-overload-candidate-set-ocs, call-with-trailing-lambda-expressions -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: sets of explicitly imported callables + */ + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun Case1() { + + val x2 = "".format("") + + val y2 = String.format("") +} + +fun String.invoke(format: String, vararg args: Any?): String = "" //(2) + +val String.format: String + get() = "1" + + +val String.Companion.format: String + get() = "1" + + +// FILE: LibCase1.kt +package libCase1 + + +val String.Companion.format: String + get() = "1" + +fun String.invoke(format: String, vararg args: Any?): String = "" + + +val String.format: String + get() = "1" 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.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/5.2.kt new file mode 100644 index 00000000000..9018979741e --- /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.2.kt @@ -0,0 +1,55 @@ +// FIR_IDENTICAL +// !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 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5 + * PRIMARY LINKS: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 11 -> sentence 1 + * overload-resolution, building-the-overload-candidate-set-ocs, call-with-trailing-lambda-expressions -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: set of star-imported extension callables + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun Case1() { + // + val x0 = "".format.invoke("") + val x1 = "".format.invoke("") + + // + val y0 = String.format.invoke("") + val y1 = String.format.invoke("") + +} + +fun String.invoke(format: String, vararg args: Any?): String = "" //(2) + +val String.format: String + get() = "1" + + +val String.Companion.format: String + get() = "1" + + +// FILE: LibCase1.kt +package libCase1 + + +val String.Companion.format: String + get() = "1" + +fun String.invoke(format: String, vararg args: Any?): String = "" + + +val String.format: String + get() = "1" 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 index 054bc92a8f9..11d3edc4f70 100644 --- 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 @@ -152,6 +152,14 @@ "unexpectedBehaviour": false, "linkType": "main" }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported 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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 3, @@ -234,6 +242,14 @@ "unexpectedBehaviour": false, "linkType": "main" }, + { + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, { "specVersion": "0.1-268", "casesNumber": 1, @@ -242,6 +258,14 @@ "unexpectedBehaviour": false, "linkType": "primary" }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported 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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 3, @@ -398,6 +422,14 @@ "unexpectedBehaviour": false, "linkType": "main" }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported 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.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, { "specVersion": "0.1-268", "casesNumber": 3, @@ -658,6 +690,14 @@ "unexpectedBehaviour": false, "linkType": "primary" }, + { + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 1, @@ -674,6 +714,14 @@ "unexpectedBehaviour": false, "linkType": "primary" }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported 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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 3, diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/testsMap.json index 54e14dabf95..d2b947f6e25 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/testsMap.json @@ -194,6 +194,14 @@ "unexpectedBehaviour": false, "linkType": "primary" }, + { + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 1, @@ -202,6 +210,14 @@ "unexpectedBehaviour": false, "linkType": "primary" }, + { + "specVersion": "0.1-268", + "casesNumber": 1, + "description": "sets of explicitly imported 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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, { "specVersion": "0.1-268", "casesNumber": 1, diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt new file mode 100644 index 00000000000..25f94aaa87c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.fir.kt @@ -0,0 +1,113 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import libCase1.* +import kotlin.text.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1 +fun Regex(pattern: String) {} + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-39073 + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* +import kotlin.text.* + + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase2.b +fun Regex(pattern: String) {} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39157 + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* +import kotlin.text.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase4.b +class Regex(pattern: String) {} + + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase5 +import libCase5.a.* +import libCase5.b.* + +fun case5() { + Regex("") +} + +// FILE: Lib.kt +package libCase5.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase5.b +class Regex(pattern: String) {} + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase6 +import libCase6.a.* +import libCase6.b.* + +fun case6() { + MyRegex("") +} + +// FILE: Lib.kt +package libCase6.a +fun MyRegex(pattern: String) {} + +// FILE: Lib.kt +package libCase6.b +class MyRegex(pattern: String) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt new file mode 100644 index 00000000000..7f002bfaa83 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt @@ -0,0 +1,124 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 1 + * DESCRIPTION: + */ + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import libCase1.* +import kotlin.text.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1 +fun Regex(pattern: String) {} + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-39073 + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* +import kotlin.text.* + + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase2.b +fun Regex(pattern: String) {} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39157 + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* +import kotlin.text.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase4.b +class Regex(pattern: String) {} + + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase5 +import libCase5.a.* +import libCase5.b.* + +fun case5() { + Regex("") +} + +// FILE: Lib.kt +package libCase5.a +fun Regex(pattern: String) {} + +// FILE: Lib.kt +package libCase5.b +class Regex(pattern: String) {} + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase6 +import libCase6.a.* +import libCase6.b.* + +fun case6() { + MyRegex("") +} + +// FILE: Lib.kt +package libCase6.a +fun MyRegex(pattern: String) {} + +// FILE: Lib.kt +package libCase6.b +class MyRegex(pattern: String) {} + + + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.fir.kt new file mode 100644 index 00000000000..19be89e5aab --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.fir.kt @@ -0,0 +1,285 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase1 +import libCase1.a.* +import libCase1.b.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase1.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase2.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase3 +import libCase3.a.* +import libCase3.b.* + +fun case3() { + Regex("") +} + +// FILE: Lib.kt +package libCase3.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase3.b + +class Regex(val s: String) + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase4.b + +class Regex(val s: String) + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + */ +package testPackCase5 +import libCase5.a.* +import libCase5.b.* + +fun case(){ + A() +} + +// FILE: Lib.kt +package libCase5.a +fun A() {} //(1) +//object A{ +// operator fun invoke(){} +//} + +// FILE: Lib.kt +package libCase5.b +class A() + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase6 +import libCase6.a.* +import libCase6.b.* + +fun case(){ + A() + A() +} + +// FILE: Lib.kt +package libCase6.a +fun A() : String = " " //(1) +object A{ + //operator fun invoke(){} +} +// FILE: Lib.kt +package libCase6.b +class A() + +// FILE: TestCase7.kt +/* + * TESTCASE NUMBER: 7 + */ +package testPackCase7 +import libCase7.a.* +import libCase7.b.* + +fun case7(){ + A() +} +object A{ + //operator fun invoke(){} +} +// FILE: Lib.kt +package libCase7.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase7.b +class A() + +// FILE: TestCase8.kt +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase8 +import libCase8.a.* +import libCase8.b.* +import libCase8.c.* + +fun case8(){ + A() + A() +} + +// FILE: Lib.kt +package libCase8.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase8.b +class A() +// FILE: Lib.kt +package libCase8.c +object A{ + //operator fun invoke(){} +} + + +// FILE: TestCase9.kt +/* + * TESTCASE NUMBER: 9 + */ +package testPackCase +import libCase9.a.* +import libCase9.b.* +import libCase9.c.A + +fun case9(){ + A() +} + +// FILE: Lib.kt +package libCase9.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase9.b +class A() +// FILE: Lib.kt +package libCase9.c +object A{ + //operator fun invoke(){} +} + + +// FILE: TestCase10.kt +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase +import libCase10.a.* +import libCase10.b.* +import libCase10.c.* + +fun case10(){ + A() +} + +// FILE: Liba.kt +package libCase10.a +fun A() : String = " " //(1) + +// FILE: Libb.kt +package libCase10.b +class A() +// FILE: Libc.kt +package libCase10.c +interface A diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt new file mode 100644 index 00000000000..1c4c0561d19 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt @@ -0,0 +1,293 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 4 + * DESCRIPTION: + */ + + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase1 +import libCase1.a.* +import libCase1.b.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase1.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase2.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase3 +import libCase3.a.* +import libCase3.b.* + +fun case3() { + Regex("") +} + +// FILE: Lib.kt +package libCase3.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase3.b + +class Regex(val s: String) + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase4.b + +class Regex(val s: String) + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + */ +package testPackCase5 +import libCase5.a.* +import libCase5.b.* + +fun case(){ + A() +} + +// FILE: Lib.kt +package libCase5.a +fun A() {} //(1) +//object A{ +// operator fun invoke(){} +//} + +// FILE: Lib.kt +package libCase5.b +class A() + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase6 +import libCase6.a.* +import libCase6.b.* + +fun case(){ + A() + A() +} + +// FILE: Lib.kt +package libCase6.a +fun A() : String = " " //(1) +object A{ + //operator fun invoke(){} +} +// FILE: Lib.kt +package libCase6.b +class A() + +// FILE: TestCase7.kt +/* + * TESTCASE NUMBER: 7 + */ +package testPackCase7 +import libCase7.a.* +import libCase7.b.* + +fun case7(){ + A() +} +object A{ + //operator fun invoke(){} +} +// FILE: Lib.kt +package libCase7.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase7.b +class A() + +// FILE: TestCase8.kt +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase8 +import libCase8.a.* +import libCase8.b.* +import libCase8.c.* + +fun case8(){ + A() + A() +} + +// FILE: Lib.kt +package libCase8.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase8.b +class A() +// FILE: Lib.kt +package libCase8.c +object A{ + //operator fun invoke(){} +} + + +// FILE: TestCase9.kt +/* + * TESTCASE NUMBER: 9 + */ +package testPackCase +import libCase9.a.* +import libCase9.b.* +import libCase9.c.A + +fun case9(){ + A() +} + +// FILE: Lib.kt +package libCase9.a +fun A() : String = " " //(1) + +// FILE: Lib.kt +package libCase9.b +class A() +// FILE: Lib.kt +package libCase9.c +object A{ + //operator fun invoke(){} +} + + +// FILE: TestCase10.kt +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39162 + */ +package testPackCase +import libCase10.a.* +import libCase10.b.* +import libCase10.c.* + +fun case10(){ + A() +} + +// FILE: Liba.kt +package libCase10.a +fun A() : String = " " //(1) + +// FILE: Libb.kt +package libCase10.b +class A() +// FILE: Libc.kt +package libCase10.c +interface A \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt new file mode 100644 index 00000000000..34128df17c2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.fir.kt @@ -0,0 +1,214 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import libCase1.* +import kotlin.text.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1 +fun Regex(pattern: String) {} + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import kotlin.text.Regex + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase1 +class Regex(pattern: String) {} + + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* +import kotlin.text.* + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase2.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase3 +import libCase3.* +import kotlin.text.* + +fun case3() { + Regex("") +} + +// FILE: Lib.kt +package libCase3 +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* +import kotlin.text.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase4.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase5 + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase5 +fun Regex(pattern: String) {} + + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase6 +import kotlin.text.* + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase6 +fun Regex(pattern: String) {} + + +// FILE: TestCase7.kt +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase7 +import kotlin.text.Regex + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase7 +class Regex(pattern: String) {} + + + +// FILE: TestCase8.kt +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase8 + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase8 +class Regex(pattern: String) {} + + +// FILE: TestCase9.kt +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase9 +import kotlin.text.* + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase9 +class Regex(pattern: String) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt new file mode 100644 index 00000000000..fa1eb0924e6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt @@ -0,0 +1,223 @@ +// !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-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: + */ + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import libCase1.* +import kotlin.text.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1 +fun Regex(pattern: String) {} + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase1 +import kotlin.text.Regex + +fun case() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package testPackCase1 +class Regex(pattern: String) {} + + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase2 +import libCase2.a.* +import libCase2.b.* +import kotlin.text.* + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2.a +fun Regex(pattern: String) {} + +//object Regex { +// operator fun invoke(s: String) {} +//} + +// FILE: Lib1.kt +package libCase2.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase3 +import libCase3.* +import kotlin.text.* + +fun case3() { + Regex("") +} + +// FILE: Lib.kt +package libCase3 +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase4 +import libCase4.a.* +import libCase4.b.* +import kotlin.text.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4.a +fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package libCase4.b + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + +// FILE: TestCase5.kt +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase5 + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase5 +fun Regex(pattern: String) {} + + +// FILE: TestCase6.kt +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase6 +import kotlin.text.* + +fun case() { + Regex("") +} + +// FILE: Lib.kt +package testPackCase6 +fun Regex(pattern: String) {} + + +// FILE: TestCase7.kt +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase7 +import kotlin.text.Regex + +fun case() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package testPackCase7 +class Regex(pattern: String) {} + + + +// FILE: TestCase8.kt +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase8 + +fun case() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package testPackCase8 +class Regex(pattern: String) {} + + +// FILE: TestCase9.kt +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + */ +package testPackCase9 +import kotlin.text.* + +fun case() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package testPackCase9 +class Regex(pattern: String) {} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt new file mode 100644 index 00000000000..33259c2c715 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.fir.kt @@ -0,0 +1,114 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase1 + +import libCase1.* +import kotlin.text.* + +fun case1() { + Regex("") +} + +// FILE: Lib.kt +package libCase1 +class Regex(pattern: String) + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase2 +import libCase2.* +import lib1Case2.* +import kotlin.text.* + +fun case2() { + Regex("") +} + +// FILE: Lib.kt +package libCase2 +//fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package lib1Case2 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase3 +import libCase3.* +import kotlin.text.* + +fun case3() { + Regex("") +} + +// FILE: Lib.kt +package libCase3 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase4 +import libCase4.* +import lib1Case4.* +import kotlin.text.* + +fun case4() { + Regex("") +} + +// FILE: Lib.kt +package libCase4 +class Regex(pattern: String) {} + +// FILE: Lib1.kt +package lib1Case4 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.kt new file mode 100644 index 00000000000..c50725a569b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.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-401 + * MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, call-without-an-explicit-receiver -> paragraph 5 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: + */ + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase1 + +import libCase1.* +import kotlin.text.* + +fun case1() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package libCase1 +class Regex(pattern: String) + + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase2 +import libCase2.* +import lib1Case2.* +import kotlin.text.* + +fun case2() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package libCase2 +//fun Regex(pattern: String) {} + +object Regex { + operator fun invoke(s: String) {} +} + +// FILE: Lib1.kt +package lib1Case2 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase3 +import libCase3.* +import kotlin.text.* + +fun case3() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package libCase3 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} + + +// FILE: TestCase4.kt +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39073 + */ +package testPackCase4 +import libCase4.* +import lib1Case4.* +import kotlin.text.* + +fun case4() { + ; typeCall: function")!>Regex("") +} + +// FILE: Lib.kt +package libCase4 +class Regex(pattern: String) {} + +// FILE: Lib1.kt +package lib1Case4 + +enum class Regex{ + ; + + companion object { + operator fun invoke(s: String) {} + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/testsMap.json index 9066ac0e1ea..629f5931c99 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/testsMap.json @@ -26,6 +26,24 @@ "unexpectedBehaviour": false, "linkType": "main" } + ], + "6": [ + { + "specVersion": "0.1-401", + "casesNumber": 5, + "description": "", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.1.kt", + "unexpectedBehaviour": true, + "linkType": "main" + }, + { + "specVersion": "0.1-401", + "casesNumber": 10, + "description": "", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt", + "unexpectedBehaviour": true, + "linkType": "main" + } ] }, "pos": { @@ -95,6 +113,32 @@ "linkType": "primary" } ], + "6": [ + { + "specVersion": "0.1-401", + "casesNumber": 4, + "description": "", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.kt", + "unexpectedBehaviour": true, + "linkType": "main" + }, + { + "specVersion": "0.1-401", + "casesNumber": 9, + "description": "", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt", + "unexpectedBehaviour": true, + "linkType": "main" + }, + { + "specVersion": "0.1-278", + "casesNumber": 3, + "description": "Top-level non-extension functions: Callables star-imported into the current file;", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ], "4": [ { "specVersion": "0.1-278", @@ -115,16 +159,6 @@ "linkType": "main" } ], - "6": [ - { - "specVersion": "0.1-278", - "casesNumber": 3, - "description": "Top-level non-extension functions: Callables star-imported into the current file;", - "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.1.kt", - "unexpectedBehaviour": false, - "linkType": "main" - } - ], "7": [ { "specVersion": "0.1-278", diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json index 8ff546ca11a..e71983100de 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json @@ -114,6 +114,16 @@ "unexpectedBehaviour": false, "linkType": "primary" } + ], + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + } ] }, "pos": { @@ -177,6 +187,38 @@ "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt", "unexpectedBehaviour": false, "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" } ] } @@ -601,6 +643,38 @@ "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt", "unexpectedBehaviour": false, "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" } ], "3": [ @@ -733,6 +807,60 @@ "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt", "unexpectedBehaviour": false, "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + } + ], + "4": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" } ] } @@ -849,6 +977,50 @@ "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt", "unexpectedBehaviour": false, "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" } ] } diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt new file mode 100644 index 00000000000..7e99f3d5e7d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.fir.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39220 + */ +package testPackCase1 + +import kotlin.reflect.KFunction2 + +interface Foo { + fun resolve(var1: Int): String + fun resolve(var1: String): String +} + +fun bar(f: KFunction2) {} + +fun main() { + bar(Foo::resolve) // OK in OI, Ambiguity in NI + bar(Foo::resolve) // OK + bar(Foo::resolve) // OK +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt new file mode 100644 index 00000000000..2f7975b23fb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt @@ -0,0 +1,38 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: SAM-type against similar functional type + */ + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-39220 + */ +package testPackCase1 + +import kotlin.reflect.KFunction2 + +interface Foo { + fun resolve(var1: Int): String + fun resolve(var1: String): String +} + +fun bar(f: KFunction2) {} + +fun main() { + bar(Foo::resolve) // OK in OI, Ambiguity in NI + bar(Foo::resolve) // OK + bar(Foo::resolve) // OK +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt new file mode 100644 index 00000000000..5c35f534262 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt @@ -0,0 +1,61 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1() { + companion object { + operator fun invoke(x: CharSequence, x1: Int =1): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + + fun case() { + Companion(::x) + } + + val x = "" + fun x() :CharSequence = "" + +} + +// TESTCASE NUMBER: 2 +class Case2() { + companion object { + operator fun invoke(x: A, x1: Int =1): Unit = TODO() // (3) + operator fun invoke(x: B): String = TODO() // (4) + } + + fun case() { + Companion(::x) + } + + val x = C() + fun x() = B() + + interface A + class B : A + class C : A +} +// TESTCASE NUMBER: 3 +interface I { + companion object { + operator fun invoke(x1: ()->CharSequence, x2: Any = ""): Unit = print(1) // (1) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): String { print(2); invoke(x1 = y1, x2 = y2) ;return "" } // (2) + } +} +class Case3() : I { + companion object { + operator fun invoke(x1: ()->CharSequence, x2: Any = ""): Unit = print(3) // (3) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): Any { print(4); return "" } // (4) + } + + val x = "" + fun x() = "" as CharSequence + + fun case() { + I.invoke(::x) + I(::x) + Case3(::x) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt new file mode 100644 index 00000000000..cb1c8e2f864 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt @@ -0,0 +1,76 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ + +// TESTCASE NUMBER: 1 +class Case1() { + companion object { + operator fun invoke(x: CharSequence, x1: Int =1): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + + fun case() { + Companion(::x) + } + + val x = "" + fun x() :CharSequence = "" + +} + +// TESTCASE NUMBER: 2 +class Case2() { + companion object { + operator fun invoke(x: A, x1: Int =1): Unit = TODO() // (3) + operator fun invoke(x: B): String = TODO() // (4) + } + + fun case() { + Companion(::x) + } + + val x = C() + fun x() = B() + + interface A + class B : A + class C : A +} +// TESTCASE NUMBER: 3 +interface I { + companion object { + operator fun invoke(x1: ()->CharSequence, x2: Any = ""): Unit = print(1) // (1) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): String { print(2); invoke(x1 = y1, x2 = y2) ;return "" } // (2) + } +} +class Case3() : I { + companion object { + operator fun invoke(x1: ()->CharSequence, x2: Any = ""): Unit = print(3) // (3) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): Any { print(4); return "" } // (4) + } + + val x = "" + fun x() = "" as CharSequence + + fun case() { + I.invoke(::x) + I(::x) + Case3(::x) + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt new file mode 100644 index 00000000000..a582651ad96 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.fir.kt @@ -0,0 +1,111 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: () -> CharSequence): Unit = TODO() // (3) + fun foo(x: () -> String, z: String = ""): String = TODO() // (4) + + fun boo() = "" + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + } +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: ()->Any?, x: ()->Any?): Unit = TODO() // (1.1) + fun foo(vararg x: ()->Int): String = TODO() // (1.2) + + fun boo() = 1 + + fun case() { + foo(::boo, ::boo) + foo(::boo, ::boo) + + foo({1}, {1}) + foo({1}, {1}) + } +} + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" + + val boo = 1 + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + + +// TESTCASE NUMBER: 4 +class Case4() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = 1 + + val boo = "" + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + +// TESTCASE NUMBER: 5 +class Case5() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" as CharSequence + + val boo = "" + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + +// TESTCASE NUMBER: 6 +class Case6() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" + + val boo = "" as CharSequence + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt new file mode 100644 index 00000000000..c702dd4caea --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt @@ -0,0 +1,126 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: () -> CharSequence): Unit = TODO() // (3) + fun foo(x: () -> String, z: String = ""): String = TODO() // (4) + + fun boo() = "" + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + } +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: ()->Any?, x: ()->Any?): Unit = TODO() // (1.1) + fun foo(vararg x: ()->Int): String = TODO() // (1.2) + + fun boo() = 1 + + fun case() { + foo(::boo, ::boo) + foo(::boo, ::boo) + + foo({1}, {1}) + foo({1}, {1}) + } +} + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" + + val boo = 1 + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + + +// TESTCASE NUMBER: 4 +class Case4() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = 1 + + val boo = "" + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + +// TESTCASE NUMBER: 5 +class Case5() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" as CharSequence + + val boo = "" + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + + foo({ "" }) + foo({ "" }) + } +} + +// TESTCASE NUMBER: 6 +class Case6() { + fun foo(x: ()->CharSequence, x1: String = ""): Unit = TODO() // (3) + fun foo(x: ()->String, z: Any = ""): String = TODO() // (4) + + fun boo() = "" + + val boo = "" as CharSequence + + fun case() { + foo(::boo) + foo(::boo) + foo(::boo) + foo(")!>::boo) + } +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt new file mode 100644 index 00000000000..ced04473103 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.fir.kt @@ -0,0 +1,34 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 { + fun boo(y: () -> Int, x: () -> Number): Unit = TODO() + fun boo(vararg x: () -> Int): String = TODO() + + val x = 1.0 + fun x() = 1 + + fun case() { + this.boo(::x, ::x) + this.boo(::x, ::x) + this.boo(::x, ::x) + } +} + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(y: () -> Int, x: () -> Number): Unit = TODO() + fun boo(vararg x: () -> Int): String = TODO() + + val x = 1 + fun x() = 1.0 + + fun case() { + this.boo(::x, ::x) + this.boo(::x, ::x) + this.boo(::x, ::x) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt new file mode 100644 index 00000000000..e1da2c044a1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt @@ -0,0 +1,48 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ + +// TESTCASE NUMBER: 1 +class Case1 { + fun boo(y: () -> Int, x: () -> Number): Unit = TODO() + fun boo(vararg x: () -> Int): String = TODO() + + val x = 1.0 + fun x() = 1 + + fun case() { + this.boo(::x, ::x) + this.boo(::x, ::x) + this.boo(::x, ::x) + } +} + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(y: () -> Int, x: () -> Number): Unit = TODO() + fun boo(vararg x: () -> Int): String = TODO() + + val x = 1 + fun x() = 1.0 + + fun case() { + this.boo(::x, ::x) + this.boo(::x, ::x) + this.boo(::x, ::x) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt new file mode 100644 index 00000000000..85099b7becb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.fir.kt @@ -0,0 +1,116 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: () -> Int): String = TODO() // (1.1) + fun foo(x: () -> Any): Unit = TODO() // (1.2) + + fun case1() { + foo(::x) + foo(::x) + foo(::x) + } +} + +val x = 1 +fun x() = 1.0 + +fun case1(case: Case1) { + case.foo(::x) + case.foo(::x) + case.foo(::x) +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(vararg x: ()->Short): String = TODO() // (1.1) + fun foo(vararg x: ()->Byte): Unit = TODO() // (1.2) + + val x : Short = 1 + fun x() = 1 + + val y = 1 + fun y(): Short = 1 + + fun case2(case: Case2) { + case.foo(::x, ::x) + case.foo(::x, ::x) + case.foo(::x, ::x) + + this.foo(::x, ::x) + this.foo(::x, ::x) + this.foo(::x, ::x) + + //for y + case.foo(::y, ::y) + case.foo(::y, ::y) + case.foo(::y, ::y) + + this.foo(::x, ::y) + this.foo(::x, ::y) + this.foo(::x, ::y) + } + +} + + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(vararg x: ()->Short): String = TODO() // (1.1) + fun foo(x: ()->Byte): Unit = TODO() // (1.2) + + val x : Short = 1 + fun x() = 1 + + val y = 1 + fun y(): Short = 1 + + fun case3(case: Case3) { + case.foo(::x) + case.foo(::x) + case.foo(::x) + + this.foo(::x) + this.foo(::x) + this.foo(::x) + + //for y + case.foo(::y) + case.foo(::y) + case.foo(::y) + + this.foo(::x, ::y) + this.foo(::x, ::y) + this.foo(::x, ::y) + } +} + + + +// TESTCASE NUMBER: 4 +class Case4() { + infix fun foo(x: ()->Int): String = TODO() // (1.1) + infix fun foo(x: ()->Any): Unit = TODO() // (1.2) + + val x = 1 + fun x() = 1.0 + + fun case() { + this foo ::x + this foo ::x + foo(::x) + foo(::x) + this.foo(::x) + this.foo(::x) + } +} + +fun case4(case: Case4) { + case foo ::x + case foo ::x + case.foo(::x) + case.foo(::x) +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt new file mode 100644 index 00000000000..75e5ac1af45 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt @@ -0,0 +1,130 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: () -> Int): String = TODO() // (1.1) + fun foo(x: () -> Any): Unit = TODO() // (1.2) + + fun case1() { + foo(::x) + foo(::x) + foo(::x) + } +} + +val x = 1 +fun x() = 1.0 + +fun case1(case: Case1) { + case.foo(::x) + case.foo(::x) + case.foo(::x) +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(vararg x: ()->Short): String = TODO() // (1.1) + fun foo(vararg x: ()->Byte): Unit = TODO() // (1.2) + + val x : Short = 1 + fun x() = 1 + + val y = 1 + fun y(): Short = 1 + + fun case2(case: Case2) { + case.foo(::x, ::x) + case.foo(::x, ::x) + case.foo(::x, ::x) + + this.foo(::x, ::x) + this.foo(::x, ::x) + this.foo(::x, ::x) + + //for y + case.foo(::y, ::y) + case.foo(::y, ::y) + case.foo(::y, ::y) + + this.foo(::x, ::y) + this.foo(::x, ::y) + this.foo(::x, ::y) + } + +} + + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(vararg x: ()->Short): String = TODO() // (1.1) + fun foo(x: ()->Byte): Unit = TODO() // (1.2) + + val x : Short = 1 + fun x() = 1 + + val y = 1 + fun y(): Short = 1 + + fun case3(case: Case3) { + case.foo(::x) + case.foo(::x) + case.foo(::x) + + this.foo(::x) + this.foo(::x) + this.foo(::x) + + //for y + case.foo(::y) + case.foo(::y) + case.foo(::y) + + this.foo(::x, ::y) + this.foo(::x, ::y) + this.foo(::x, ::y) + } +} + + + +// TESTCASE NUMBER: 4 +class Case4() { + infix fun foo(x: ()->Int): String = TODO() // (1.1) + infix fun foo(x: ()->Any): Unit = TODO() // (1.2) + + val x = 1 + fun x() = 1.0 + + fun case() { + this foo ::x + this foo ::x + foo(::x) + foo(::x) + this.foo(::x) + this.foo(::x) + } +} + +fun case4(case: Case4) { + case foo ::x + case foo ::x + case.foo(::x) + case.foo(::x) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt new file mode 100644 index 00000000000..4f9e6675147 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.fir.kt @@ -0,0 +1,102 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1() { + companion object { + operator fun invoke(x: CharSequence): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + fun case() { + foo(::invoke) + foo(::invoke) + foo(::invoke) + foo(::invoke) + } + + fun foo(x: (CharSequence)->Any): String = TODO() // (1.1) + fun foo(x: (String)->Any): Unit = TODO() // (1.2) +} + +// TESTCASE NUMBER: 2 +class Case2() { + companion object { + operator fun invoke(y: Any?, x: Any?): Unit = TODO() // (1.1) + operator fun invoke(vararg x: Int): String = TODO() // (1.2) + } + + fun case() { + foo(::invoke, ::invoke) + foo(::invoke, ::invoke) + foo(::invoke, ::invoke) + foo(::invoke, ::invoke) + } + + fun foo(vararg x: (Int)->Any): String = TODO() // (1.1) + fun foo(vararg x: (Any)->Any): Unit = TODO() // (1.2) +} + + +// TESTCASE NUMBER: 3 +interface I { + companion object { + operator fun invoke(x1: ()->String, x2: Any = ""): Unit = print(1) // (1) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): String { print(2) ;return "" } // (2) + } +} +class Case3() : I { + companion object { + operator fun invoke(x: ()->CharSequence): Unit = print(3) // (3) + operator fun invoke(x: ()->String, z: String = ""): Any { print(4); return "" } // (4) + } + + val x = "" + fun x() = "" as CharSequence + val y : CharSequence= "" + fun y() = "" + + fun case() { + I.invoke(")!>::x) + I.invoke(::x) + I.invoke(::x) + + I.invoke(")!>::y) + I.invoke(::y) + I.invoke(::y) + + I(::x) + I(::x) + I(::x) + + I(::y) + I(::y) + I(::y) + + Case3(")!>::x) + Case3(::x) + Case3(::x) + + Case3(")!>::y) + Case3(::y) + Case3(::y) + } +} + +// TESTCASE NUMBER: 4 +class Case4() { + companion object { + operator fun invoke(x: CharSequence): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + fun case(case: Case4) { + case(::invoke) + case(")!>::invoke) + case(::invoke) + case(::invoke) + } + + operator fun invoke(x: (CharSequence)->Any): String = TODO() // (1.1) + operator fun invoke(x: (String)->Any): Unit = TODO() // (1.2) +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt new file mode 100644 index 00000000000..e21d5fcdd68 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt @@ -0,0 +1,116 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 2 + * overload-resolution, resolving-callable-references, bidirectional-resolution-for-callable-calls -> paragraph 3 -> sentence 3 + * SECONDARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 8 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: a callable reference is itself an argument to an overloaded function call + */ + +// TESTCASE NUMBER: 1 +class Case1() { + companion object { + operator fun invoke(x: CharSequence): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + fun case() { + foo(::invoke) + foo(::invoke) + foo(::invoke) + foo(::invoke) + } + + fun foo(x: (CharSequence)->Any): String = TODO() // (1.1) + fun foo(x: (String)->Any): Unit = TODO() // (1.2) +} + +// TESTCASE NUMBER: 2 +class Case2() { + companion object { + operator fun invoke(y: Any?, x: Any?): Unit = TODO() // (1.1) + operator fun invoke(vararg x: Int): String = TODO() // (1.2) + } + + fun case() { + foo(")!>::invoke, ")!>::invoke) + foo(::invoke, ::invoke) + foo(::invoke, ::invoke) + foo(::invoke, ::invoke) + } + + fun foo(vararg x: (Int)->Any): String = TODO() // (1.1) + fun foo(vararg x: (Any)->Any): Unit = TODO() // (1.2) +} + + +// TESTCASE NUMBER: 3 +interface I { + companion object { + operator fun invoke(x1: ()->String, x2: Any = ""): Unit = print(1) // (1) + operator fun invoke(y1: ()->CharSequence, y2: String = ""): String { print(2) ;return "" } // (2) + } +} +class Case3() : I { + companion object { + operator fun invoke(x: ()->CharSequence): Unit = print(3) // (3) + operator fun invoke(x: ()->String, z: String = ""): Any { print(4); return "" } // (4) + } + + val x = "" + fun x() = "" as CharSequence + val y : CharSequence= "" + fun y() = "" + + fun case() { + I.invoke(")!>::x) + I.invoke(::x) + I.invoke(::x) + + I.invoke(")!>::y) + I.invoke(::y) + I.invoke(::y) + + I(")!>::x) + I(::x) + I(::x) + + I(")!>::y) + I(::y) + I(::y) + + Case3(")!>::x) + Case3(::x) + Case3(::x) + + Case3(")!>::y) + Case3(::y) + Case3(::y) + } +} + +// TESTCASE NUMBER: 4 +class Case4() { + companion object { + operator fun invoke(x: CharSequence): Unit = TODO() // (3) + operator fun invoke(x: String): String = TODO() // (4) + } + fun case(case: Case4) { + case(::invoke) + case(")!>::invoke) + case(::invoke) + case(::invoke) + } + + operator fun invoke(x: (CharSequence)->Any): String = TODO() // (1.1) + operator fun invoke(x: (String)->Any): Unit = TODO() // (1.2) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/testsMap.json new file mode 100644 index 00000000000..f8a2de8358c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/testsMap.json @@ -0,0 +1,178 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 1, + "description": "SAM-type against similar functional type", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt", + "unexpectedBehaviour": true, + "linkType": "main" + } + ] + } + }, + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 1, + "description": "SAM-type against similar functional type", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ], + "2": [ + { + "specVersion": "0.1-413", + "casesNumber": 1, + "description": "SAM-type against similar functional type", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-413", + "casesNumber": 1, + "description": "SAM-type against similar functional type", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 4, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-413", + "casesNumber": 6, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ], + "2": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt new file mode 100644 index 00000000000..8a7021205cb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.fir.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +class Case1() { + fun foo(x: A): A = x//(1) +} + +fun Case1.foo(i: B): B = i //(2) + +class A : C +class B : C +interface C + +fun process(call: (T) -> T, x: T): T = call.invoke(x) + +fun case1() { + val case = Case1() + + process(case::foo, A()) + process(")!>case::foo, A()) + process(case:: foo, A()) + + process(case::foo, B()) + process(")!>case::foo, B()) + process(case:: foo, B()) + +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt new file mode 100644 index 00000000000..b65f9697698 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt @@ -0,0 +1,42 @@ +// !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-401 + * MAIN LINK: overload-resolution, resolving-callable-references -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +class Case1() { + fun foo(x: A): A = x//(1) +} + +fun Case1.foo(i: B): B = i //(2) + +class A : C +class B : C +interface C + +fun process(call: (T) -> T, x: T): T = call.invoke(x) + +fun case1() { + val case = Case1() + + process(case::foo, A()) + process(")!>case::foo, A()) + process(case:: foo, A()) + + process(case::foo, B()) + process(")!>case::foo, B()) + process(case:: foo, B()) + +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt new file mode 100644 index 00000000000..9cf4dad56ea --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.fir.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import testsCase1.Case1.Companion.foo + +class Case1() { + companion object { + fun foo() : Case1 = TODO() + fun foo(y: String, x: Any = "") : Case1 = TODO() + fun foo( x: String, y: String) : Case1 = TODO() + } + +} +fun case1() { + val y0: (String)-> Case1 = ::foo + val y1: (String)-> Case1 = Case1.Companion::foo + val y2: (String)-> Case1 = (Case1)::foo +} + +fun case1_0() : (String)-> Case1 = ::foo +fun case1_1() : (String)-> Case1 = (Case1)::foo +fun case1_2(): (String)-> Case1 = Case1.Companion::foo diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt new file mode 100644 index 00000000000..a681138e428 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt @@ -0,0 +1,36 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-413 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import testsCase1.Case1.Companion.foo + +class Case1() { + companion object { + fun foo() : Case1 = TODO() + fun foo(y: String, x: Any = "") : Case1 = TODO() + fun foo( x: String, y: String) : Case1 = TODO() + } + +} +fun case1() { + val y0: (String)-> Case1 = ::foo + val y1: (String)-> Case1 = Case1.Companion::foo + val y2: (String)-> Case1 = (Case1)::foo +} + +fun case1_0() : (String)-> Case1 = ::foo +fun case1_1() : (String)-> Case1 = (Case1)::foo +fun case1_2(): (String)-> Case1 = Case1.Companion::foo + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt new file mode 100644 index 00000000000..1e4813643df --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.fir.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun case1() { + val y1 =(String)::format +} + +// FILE: LibCase1.kt +package libCase1 + +val String.Companion.format: String + get() = "1" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* +import kotlin.text.* + +fun case2() { + val y1 =(String)::format +} + +// FILE: LibCase2.kt +package libCase2 + +val String.Companion.format: String + get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt new file mode 100644 index 00000000000..fc5c1b7459d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 5 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun case1() { + val y1 =(String)::format +} + +// FILE: LibCase1.kt +package libCase1 + +val String.Companion.format: String + get() = "1" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* +import kotlin.text.* + +fun case2() { + val y1 =(String)::format +} + +// FILE: LibCase2.kt +package libCase2 + +val String.Companion.format: String + get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt new file mode 100644 index 00000000000..53e7f88f613 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.fir.kt @@ -0,0 +1,45 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* + +fun case1() { + val y1 =(A)::boo +} + +// FILE: LibCase1.kt +package libCase1 + +class A{ + companion object{} +} +val A.Companion.boo: String + get() = "1" +fun A.Companion.boo(): String ="" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 1 +package testsCase2 +import libCase2.A +import libCase2.boo + +fun case2() { + val y1 =(A)::boo +} + +// FILE: LibCase2.kt +package libCase2 + +class A{ + companion object{} +} +val A.Companion.boo: String + get() = "1" +fun A.Companion.boo(): String ="" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt new file mode 100644 index 00000000000..52c2cd91678 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt @@ -0,0 +1,59 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 5 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* + +fun case1() { + val y1 =(A)::boo +} + +// FILE: LibCase1.kt +package libCase1 + +class A{ + companion object{} +} +val A.Companion.boo: String + get() = "1" +fun A.Companion.boo(): String ="" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 1 +package testsCase2 +import libCase2.A +import libCase2.boo + +fun case2() { + val y1 =(A)::boo +} + +// FILE: LibCase2.kt +package libCase2 + +class A{ + companion object{} +} +val A.Companion.boo: String + get() = "1" +fun A.Companion.boo(): String ="" + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt new file mode 100644 index 00000000000..a5b7960181c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.fir.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.boo + +fun case1() { + val y1 =1::boo +} + +// FILE: LibCase1.kt +package libCase1 + +val Int.boo: String + get() = "1" +fun Int.boo(): String ="" + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* + +fun case2() { + val y1 =1::boo +} + +// FILE: LibCase2.kt +package libCase2 + +val Int.boo: String + get() = "1" +fun Int.boo(): String ="" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt new file mode 100644 index 00000000000..75b387b33c1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 5 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.boo + +fun case1() { + val y1 =1::boo +} + +// FILE: LibCase1.kt +package libCase1 + +val Int.boo: String + get() = "1" +fun Int.boo(): String ="" + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* + +fun case2() { + val y1 =1::boo +} + +// FILE: LibCase2.kt +package libCase2 + +val Int.boo: String + get() = "1" +fun Int.boo(): String ="" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt new file mode 100644 index 00000000000..ffb7b14862a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.fir.kt @@ -0,0 +1,60 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.boo + +fun case1() { + val y1 =::boo +} + +// FILE: LibCase1.kt +package libCase1 + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* + +fun case2() { + val y1 =::boo +} + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: LibCase2.kt +package libCase2 + +fun boo(): String ="" + + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 2 +package testsCase3 +import libCase3.* + +fun case3() { + val y1 =::boo +} + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: LibCase3.kt +package libCase3 + +val boo: String + get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt new file mode 100644 index 00000000000..52130d1310b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt @@ -0,0 +1,73 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 5 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.boo + +fun case1() { + val y1 =::boo +} + +// FILE: LibCase1.kt +package libCase1 + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* + +fun case2() { + val y1 =::boo +} + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: LibCase2.kt +package libCase2 + +fun boo(): String ="" + + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 2 +package testsCase3 +import libCase3.* + +fun case3() { + val y1 =::boo +} + +val boo: String + get() = "1" +fun boo(): String ="" + +// FILE: LibCase3.kt +package libCase3 + +val boo: String + get() = "1" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt new file mode 100644 index 00000000000..5626e07feac --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.fir.kt @@ -0,0 +1,35 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +fun foo(i: Int): Int = 2 // (1) +fun foo(d: Double): Double = 2.0 // (2) + +fun case1() { + val x1: (Int) -> Int = ::foo + val x2: (Int) -> Int = ")!>::foo + + val y1: (Double) -> Double = ::foo + val y2: (Double) -> Double = ")!>::foo +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 + +val foo = 4 +val boo = 4.0 +fun case2() { + val y2 : () ->Int =::foo + val y1 : () ->Int =")!>::foo + + val x1 : () ->Any =::boo + val x2 : () ->Any =")!>::boo +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt new file mode 100644 index 00000000000..d4ec4776dbd --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt @@ -0,0 +1,45 @@ +// !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-413 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 5 -> sentence 1 + * SECONDARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +fun foo(i: Int): Int = 2 // (1) +fun foo(d: Double): Double = 2.0 // (2) + +fun case1() { + val x1: (Int) -> Int = ::foo + val x2: (Int) -> Int = ")!>::foo + + val y1: (Double) -> Double = ::foo + val y2: (Double) -> Double = ")!>::foo +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 + +val foo = 4 +val boo = 4.0 +fun case2() { + val y2 : () ->Int =::foo + val y1 : () ->Int =")!>::foo + + val x1 : () ->Any =::boo + val x2 : () ->Any =")!>::boo +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt new file mode 100644 index 00000000000..4b17a42c762 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.fir.kt @@ -0,0 +1,83 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun case1() { + val y2 : () ->String =(String)::format +} + +// FILE: LibCase1.kt +package libCase1 + +val String.Companion.format: String + get() = "1" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* +import kotlin.text.format + +fun case2() { + // + val x = "".format::invoke + // + val y = String.format::invoke +} + +fun String.invoke(format: String, vararg args: Any?): String = "" //(2) + +val String.format: String + get() = "1" + + +val String.Companion.format: String + get() = "1" + + +// FILE: LibCase2.kt +package libCase2 + + +val String.Companion.format: String + get() = "1" + +fun String.invoke(format: String, vararg args: Any?): String = "" + + +val String.format: String + get() = "1" + + + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testsCase3 +import libCase3.format +import kotlin.text.* + +fun case3() { + val y1 =(String)::format + ")!>y1 + + val y2 =""::format + ")!>y2 +} + +// FILE: LibCase3.kt +package libCase3 + +val String.Companion.format: Unit + get() = TODO() + +val String.format: Int + get() = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt new file mode 100644 index 00000000000..91088cb34e4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt @@ -0,0 +1,96 @@ +// !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-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 6 + * NUMBER: 2 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 +import libCase1.* +import kotlin.text.format + +fun case1() { + val y2 : () ->String =(String)::format +} + +// FILE: LibCase1.kt +package libCase1 + +val String.Companion.format: String + get() = "1" + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testsCase2 +import libCase2.* +import kotlin.text.format + +fun case2() { + // + val x = "".format::invoke + // + val y = String.format::invoke +} + +fun String.invoke(format: String, vararg args: Any?): String = "" //(2) + +val String.format: String + get() = "1" + + +val String.Companion.format: String + get() = "1" + + +// FILE: LibCase2.kt +package libCase2 + + +val String.Companion.format: String + get() = "1" + +fun String.invoke(format: String, vararg args: Any?): String = "" + + +val String.format: String + get() = "1" + + + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testsCase3 +import libCase3.format +import kotlin.text.* + +fun case3() { + val y1 =(String)::format + ")!>y1 + + val y2 =""::format + ")!>y2 +} + +// FILE: LibCase3.kt +package libCase3 + +val String.Companion.format: Unit + get() = TODO() + +val String.format: Int + get() = TODO() + diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt new file mode 100644 index 00000000000..24ff5740dcb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.fir.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +class Case() { + fun case(v: V) { + val va: () -> String = (V)::a + + val vb: () -> String = (V)::b + + val va1: () -> String = v::a + val vb1: () -> String = (V)::b + + } + + val V.Companion.b: String // (3) + get() = "1" + +} + +val V.a: String + get() = "1" + +val V.Companion.a: String + get() = "1" + + +class V { + companion object { + const val b: String = "1" + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt new file mode 100644 index 00000000000..0c96b921c44 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt @@ -0,0 +1,50 @@ +// !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-409 + * MAIN LINK: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 1 -> sentence 1 + * PRIMARY LINKS: overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 2 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 3 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 4 + * overload-resolution, resolving-callable-references, resolving-callable-references-not-used-as-arguments-to-a-call -> paragraph 2 -> sentence 6 + * NUMBER: 3 + * DESCRIPTION: the case of a call with a callable reference as a not parameter + */ + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testsCase1 + +class Case() { + fun case(v: V) { + val va: () -> String = (V)::a + + val vb: () -> String = (V)::b + + val va1: () -> String = v::a + val vb1: () -> String = (V)::b + + } + + val V.Companion.b: String // (3) + get() = "1" + +} + +val V.a: String + get() = "1" + +val V.Companion.a: String + get() = "1" + + +class V { + companion object { + const val b: String = "1" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/testsMap.json new file mode 100644 index 00000000000..5e4a1b161f8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/testsMap.json @@ -0,0 +1,362 @@ +{ + "5": { + "neg": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 3, + "description": "a callable reference is itself an argument to an overloaded function call", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + } + }, + "1": { + "neg": { + "1": [ + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-409", + "casesNumber": 3, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "2": { + "neg": { + "2": [ + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "4": [ + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "5": [ + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "pos": { + "2": [ + { + "specVersion": "0.1-409", + "casesNumber": 3, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-409", + "casesNumber": 3, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "4": [ + { + "specVersion": "0.1-409", + "casesNumber": 3, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "6": [ + { + "specVersion": "0.1-409", + "casesNumber": 3, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-409", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + } + }, + "6": { + "pos": { + "1": [ + { + "specVersion": "0.1-413", + "casesNumber": 2, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "secondary" + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/testsMap.json new file mode 100644 index 00000000000..9b2635b1361 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/testsMap.json @@ -0,0 +1,16 @@ +{ + "2": { + "pos": { + "2": [ + { + "specVersion": "0.1-401", + "casesNumber": 1, + "description": "the case of a call with a callable reference as a not parameter", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + } +} \ 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 98227f4b6ea..49a2ce357ac 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 @@ -3420,6 +3420,50 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { 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$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Call_with_an_explicit_type_receiver extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCall_with_an_explicit_type_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/call-with-an-explicit-type-receiver"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() 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/call-with-an-explicit-type-receiver/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/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("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/call-with-an-explicit-type-receiver/p-3/pos/2.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/call-with-an-explicit-type-receiver/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), 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) @@ -3490,6 +3534,11 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { 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("3.2.kt") + public void test3_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/3.2.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"); @@ -3505,6 +3554,11 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { 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("5.2.kt") + public void test5_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/5.2.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"); @@ -3871,6 +3925,16 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.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-without-an-explicit-receiver/p-5/neg/6.1.kt"); + } + + @TestMetadata("6.4.kt") + public void test6_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt"); + } + public void testAllFilesPresentInNeg() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -3924,6 +3988,16 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.1.kt"); } + @TestMetadata("6.2.kt") + public void test6_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt"); + } + + @TestMetadata("6.3.kt") + public void test6_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.kt"); + } + @TestMetadata("7.1.kt") public void test7_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/7.1.kt"); @@ -4684,6 +4758,250 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Resolving_callable_references extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInResolving_callable_references() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Bidirectional_resolution_for_callable_calls extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBidirectional_resolution_for_callable_calls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg 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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/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("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Resolving_callable_references_not_used_as_arguments_to_a_call extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInResolving_callable_references_not_used_as_arguments_to_a_call() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg 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/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/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/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + } } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements") diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/FirDiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/FirDiagnosticsTestSpecGenerated.java index 68e46698c94..baf266aeefb 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/FirDiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/FirDiagnosticsTestSpecGenerated.java @@ -3420,6 +3420,50 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS 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$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Call_with_an_explicit_type_receiver extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCall_with_an_explicit_type_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/call-with-an-explicit-type-receiver"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() 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/call-with-an-explicit-type-receiver/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/call-with-an-explicit-type-receiver/p-3/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @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/call-with-an-explicit-type-receiver/p-3/pos/2.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/call-with-an-explicit-type-receiver/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), 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) @@ -3490,6 +3534,11 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS 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("3.2.kt") + public void test3_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/3.2.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"); @@ -3505,6 +3554,11 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS 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("5.2.kt") + public void test5_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/5.2.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"); @@ -3871,6 +3925,16 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/2.5.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-without-an-explicit-receiver/p-5/neg/6.1.kt"); + } + + @TestMetadata("6.4.kt") + public void test6_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg/6.4.kt"); + } + public void testAllFilesPresentInNeg() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } @@ -3924,6 +3988,16 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.1.kt"); } + @TestMetadata("6.2.kt") + public void test6_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.2.kt"); + } + + @TestMetadata("6.3.kt") + public void test6_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/6.3.kt"); + } + @TestMetadata("7.1.kt") public void test7_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-without-an-explicit-receiver/p-5/pos/7.1.kt"); @@ -4684,6 +4758,250 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS } } } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Resolving_callable_references extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInResolving_callable_references() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Bidirectional_resolution_for_callable_calls extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBidirectional_resolution_for_callable_calls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractFirDiagnosticsTestSpec { + 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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractFirDiagnosticsTestSpec { + 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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractFirDiagnosticsTestSpec { + 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/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos/1.4.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos/2.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Resolving_callable_references_not_used_as_arguments_to_a_call extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInResolving_callable_references_not_used_as_arguments_to_a_call() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractFirDiagnosticsTestSpec { + 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/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg/1.5.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractFirDiagnosticsTestSpec { + 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/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos/1.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/resolving-callable-references-not-used-as-arguments-to-a-call/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + } } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements")