From cfbfec77a58c62227031db7f9a4dd180522054e7 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Tue, 28 Jul 2020 11:13:45 +0300 Subject: [PATCH] [Spec tests] Add tests for Algorithm of MSC selection --- .../algorithm-of-msc-selection/p-3/pos/1.1.kt | 27 + .../algorithm-of-msc-selection/p-3/pos/1.2.kt | 25 + .../algorithm-of-msc-selection/testsMap.json | 24 + .../integer-type-widening/testsMap.json | 122 +++ .../p-11/pos/1.1.fir.kt | 31 + .../p-11/pos/1.1.kt | 40 + .../p-11/pos/1.2.fir.kt | 43 + .../p-11/pos/1.2.kt | 52 ++ .../p-11/pos/4.1.fir.kt | 99 ++ .../p-11/pos/4.1.kt | 111 +++ .../p-11/pos/4.2.fir.kt | 121 +++ .../p-11/pos/4.2.kt | 133 +++ .../p-11/pos/4.3.fir.kt | 101 +++ .../p-11/pos/4.3.kt | 113 +++ .../p-11/pos/4.4.fir.kt | 87 ++ .../p-11/pos/4.4.kt | 99 ++ .../p-11/pos/4.5.fir.kt | 16 + .../p-11/pos/4.5.kt | 29 + .../p-11/pos/5.1.fir.kt | 25 + .../p-11/pos/5.1.kt | 36 + .../p-12/pos/2.1.fir.kt | 164 ++++ .../p-12/pos/2.1.kt | 175 ++++ .../p-12/pos/2.2.fir.kt | 109 +++ .../p-12/pos/2.2.kt | 120 +++ .../p-12/pos/2.3.fir.kt | 87 ++ .../p-12/pos/2.3.kt | 98 ++ .../p-12/pos/2.4.fir.kt | 75 ++ .../p-12/pos/2.4.kt | 86 ++ .../p-12/pos/2.5.fir.kt | 35 + .../p-12/pos/2.5.kt | 47 + .../p-12/pos/2.6.fir.kt | 43 + .../p-12/pos/2.6.kt | 55 ++ .../p-12/pos/2.7.fir.kt | 50 + .../p-12/pos/2.7.kt | 64 ++ .../p-14/neg/1.1.fir.kt | 65 ++ .../p-14/neg/1.1.kt | 73 ++ .../p-14/neg/1.2.fir.kt | 15 + .../p-14/neg/1.2.kt | 23 + .../p-14/neg/1.3.fir.kt | 56 ++ .../p-14/neg/1.3.kt | 65 ++ .../p-14/neg/1.4.fir.kt | 44 + .../p-14/neg/1.4.kt | 55 ++ .../p-14/neg/1.5.fir.kt | 48 + .../p-14/neg/1.5.kt | 60 ++ .../p-14/neg/1.6.fir.kt | 44 + .../p-14/neg/1.6.kt | 57 ++ .../p-14/neg/1.7.fir.kt | 44 + .../p-14/neg/1.7.kt | 56 ++ .../p-17/neg/2.1.fir.kt | 60 ++ .../p-17/neg/2.1.kt | 68 ++ .../p-17/neg/2.2.fir.kt | 60 ++ .../p-17/neg/2.2.kt | 68 ++ .../p-3/pos/1.1.fir.kt | 37 + .../algorithm-of-msc-selection/p-3/pos/1.1.kt | 49 + .../p-3/pos/1.2.fir.kt | 14 + .../algorithm-of-msc-selection/p-3/pos/1.2.kt | 26 + .../p-3/pos/1.3.fir.kt | 71 ++ .../algorithm-of-msc-selection/p-3/pos/1.3.kt | 80 ++ .../p-3/pos/1.4.fir.kt | 68 ++ .../algorithm-of-msc-selection/p-3/pos/1.4.kt | 81 ++ .../p-9/neg/2.1.fir.kt | 13 + .../algorithm-of-msc-selection/p-9/neg/2.1.kt | 22 + .../p-9/pos/1.1.fir.kt | 25 + .../algorithm-of-msc-selection/p-9/pos/1.1.kt | 34 + .../algorithm-of-msc-selection/testsMap.json | 856 ++++++++++++++++++ .../rationale-1/p-2/pos/1.1.fir.kt | 85 ++ .../rationale-1/p-2/pos/1.1.kt | 93 ++ .../rationale-1/p-3/neg/1.1.fir.kt | 15 + .../rationale-1/p-3/neg/1.1.kt | 23 + .../rationale-1/testsMap.json | 30 + .../DiagnosticsTestSpecGenerated.java | 424 ++++++++- .../FirDiagnosticsTestSpecGenerated.java | 424 ++++++++- .../BlackBoxCodegenTestSpecGenerated.java | 62 ++ 73 files changed, 6031 insertions(+), 4 deletions(-) create mode 100644 compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json create mode 100644 compiler/tests-spec/testData/diagnostics/linked/built-in-types-and-their-semantics/built-in-integer-types-1/integer-type-widening/testsMap.json create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt create mode 100644 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.fir.kt create mode 100644 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 create mode 100644 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.2.fir.kt create mode 100644 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.2.kt create mode 100644 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.3.fir.kt create mode 100644 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.3.kt create mode 100644 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.4.fir.kt create mode 100644 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.4.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/testsMap.json diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt new file mode 100644 index 00000000000..7e0997f9f34 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-366 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built + */ + +var flag = false +fun box(): String { + Case(1, 1) + if (flag) { + return "OK" + }else + return "NOK" +} +class Case { + constructor(y: Int, x: Number){ + flag = false + } + constructor(vararg x: Int){ + flag = true + } +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt new file mode 100644 index 00000000000..eb4627cee4d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-366 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built + */ + +var flag = false +fun box(): String { + Case(1, 1) + if (flag) { + return "OK" + }else + return "NOK" +} +class Case (val y: Int, val x: Number) { + + constructor(vararg x: Int) : this(1, 1 as Number){ + flag = true + } +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json new file mode 100644 index 00000000000..12c91607f50 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/testsMap.json @@ -0,0 +1,24 @@ +{ + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-366", + "casesNumber": 0, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-366", + "casesNumber": 0, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "path": "compiler/tests-spec/testData/codegen/box/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" + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/built-in-types-and-their-semantics/built-in-integer-types-1/integer-type-widening/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/built-in-types-and-their-semantics/built-in-integer-types-1/integer-type-widening/testsMap.json new file mode 100644 index 00000000000..409c4744f44 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/built-in-types-and-their-semantics/built-in-integer-types-1/integer-type-widening/testsMap.json @@ -0,0 +1,122 @@ +{ + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 11, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "The candidate having any variable-argument parameters is less specific", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "prefer kotlin.Short to kotlin.Byte.", + "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.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + } + } +} \ No newline at end of file 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/p-11/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt new file mode 100644 index 00000000000..a1b53bc3ede --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.fir.kt @@ -0,0 +1,31 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} 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/p-11/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt new file mode 100644 index 00000000000..c72b65d8d71 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt @@ -0,0 +1,40 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: Both candidates are more applicable and one of them is non-parameterized + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} 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/p-11/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt new file mode 100644 index 00000000000..d6b0c9b82cc --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.fir.kt @@ -0,0 +1,43 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1, I3 { + + fun test() { + foo(1) // resolved to (2) + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Any): Unit = print(4) // (4) + } +} 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/p-11/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt new file mode 100644 index 00000000000..11669682ed1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt @@ -0,0 +1,52 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION: Both candidates are more applicable and few of them are non-parameterized + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1, I3 { + + fun test() { + foo(1) // resolved to (2) + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Any): Unit = print(4) // (4) + } +} 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/p-11/pos/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt new file mode 100644 index 00000000000..fa0207b7734 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.fir.kt @@ -0,0 +1,99 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) + //to (1.1) + case.boo(x=1) + //(1.1) return type is String + case.boo(x=1) + +} + +fun Case1.boo(x: Int, y: Any= ""): String = TODO() //(1.1) +fun Case1.boo(x: Int, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Short, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Short, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Byte, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Byte, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) + +// TESTCASE NUMBER: 2 +class Case2{ + fun boo(x: Int, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Short, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Short, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Byte, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Byte, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) +} + +fun case2(case: Case2) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x=1, y=2) + //(1.1) return type is String + case.boo(x=1, y=2) +} + +// TESTCASE NUMBER: 3 +class Case3{ + fun boo(x: Int, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + +} + +fun case3(case: Case3) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x=1, y=2) + //(1.1) return type is String + case.boo(x=1, y=2) +} + +// TESTCASE NUMBER: 4 +class Case4{ + operator fun get(x: Int, a: Any= ""): String = TODO() //(1.1) + operator fun get(x: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + operator fun get(x: Long, a: Any= ""): Unit = TODO() //(1.2) + operator fun get(x: Long, a: Any= "", b: Any = 1): Unit = TODO() //(1.2) + operator fun get(x: Short, a: Any= "", b: Any = 1): Unit = TODO() //(1.3) + operator fun get(x: Short, a: Any= ""): Unit = TODO() //(1.3) + operator fun get(x: Byte, a: Any= "", b: Any = 1): Unit = TODO() //(1.4) + operator fun get(x: Byte, a: Any= ""): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + //to (1.1) + case.get(1) + //(1.1) return type is String + case.get(1) + //to (1.1) + case.get(x=1) + //(1.1) return type is String + case.get(x=1) + //as operator call case + 1 + //to (1.1) + case[1] + //(1.1) return type is String + case[1] +} 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/p-11/pos/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt new file mode 100644 index 00000000000..8cb2a7325b5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt @@ -0,0 +1,111 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY 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 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call with explicit receiver: different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) + //to (1.1) + case.boo(x=1) + //(1.1) return type is String + case.boo(x=1) + +} + +fun Case1.boo(x: Int, y: Any= ""): String = TODO() //(1.1) +fun Case1.boo(x: Int, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Short, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Short, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Byte, y: Any= ""): Unit = TODO() //(1.1) +fun Case1.boo(x: Byte, y: Any= "", z: Any = 1): Unit = TODO() //(1.1) + +// TESTCASE NUMBER: 2 +class Case2{ + fun boo(x: Int, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Short, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Short, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Byte, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Byte, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) +} + +fun case2(case: Case2) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x=1, y=2) + //(1.1) return type is String + case.boo(x=1, y=2) +} + +// TESTCASE NUMBER: 3 +class Case3{ + fun boo(x: Int, y: Int, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any= ""): String = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + +} + +fun case3(case: Case3) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x=1, y=2) + //(1.1) return type is String + case.boo(x=1, y=2) +} + +// TESTCASE NUMBER: 4 +class Case4{ + operator fun get(x: Int, a: Any= ""): String = TODO() //(1.1) + operator fun get(x: Int, a: Any= "", b: Any = 1): Unit = TODO() //(1.1) + operator fun get(x: Long, a: Any= ""): Unit = TODO() //(1.2) + operator fun get(x: Long, a: Any= "", b: Any = 1): Unit = TODO() //(1.2) + operator fun get(x: Short, a: Any= "", b: Any = 1): Unit = TODO() //(1.3) + operator fun get(x: Short, a: Any= ""): Unit = TODO() //(1.3) + operator fun get(x: Byte, a: Any= "", b: Any = 1): Unit = TODO() //(1.4) + operator fun get(x: Byte, a: Any= ""): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + //to (1.1) + case.get(1) + //(1.1) return type is String + case.get(1) + //to (1.1) + case.get(x=1) + //(1.1) return type is String + case.get(x=1) + //as operator call case + 1 + //to (1.1) + case[1] + //(1.1) return type is String + case[1] +} 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/p-11/pos/4.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt new file mode 100644 index 00000000000..2f8419a07c8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.fir.kt @@ -0,0 +1,121 @@ +// !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 testPackCase1 + +fun case1() { + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + //to (1.1) + 1.boo(x = 1) + //(1.1) return type is String + 1.boo(x = 1) + +} + +private fun Int.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +private fun Int.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private fun Long.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +private fun Long.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private fun Short.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private fun Short.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +private fun Byte.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +private fun Byte.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 2 +package testPackCase2 +import testPackCase2.Case2.Companion.boo + +class Case2 { + val boo: Int = 1 + + companion object { + fun Int.boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun Int.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun Long.boo(x: Long, y: Int, a: Any = ""): Unit = TODO() //(1.2) + fun Long.boo(x: Long, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + fun Short.boo(x: Short, y: Int, a: Any = ""): Unit = TODO() //(1.3) + fun Short.boo(x: Short, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + fun Byte.boo(x: Byte, y: Int, a: Any = ""): Unit = TODO() //(1.4) + fun Byte.boo(x: Byte, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + } + + fun case() { + 1.boo(1, 1) + 1.boo(1, 1) + } +} + +fun case2(case: Case2) { + //to (1.1) + case.boo.boo(1, 2) + //(1.1) return type is String + case.boo.boo(1, 2) + //to (1.1) + case.boo.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo.boo(x = 1, y = 2) + + case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } + + case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } + + case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } + + case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } +} + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 3 +package testPackCase3 +import testPackCase3.Case3.Companion.get + +class Case3 { + val boo: Int = 1 + + companion object { + operator fun Int.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + operator fun Int.get(x: String, a: Any = ""): String = TODO() //(1.1) + operator fun Long.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + operator fun Long.get(x: String, a: Any = ""): Unit = TODO() //(1.2) + operator fun Short.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + operator fun Short.get(x: String, a: Any = ""): Unit = TODO() //(1.3) + operator fun Byte.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + operator fun Byte.get(x: String, a: Any = "" ): Unit = TODO() //(1.4) + } + + fun case() { + 1["1"] + 1["1"] + } +} + +fun case3(case: Case3) { + //to (1.1) + case.boo["1"] + //(1.1) return type is String + case.boo["1"] + + case.apply { 1["1"] } + case.apply { 1["1"] } + + case.let { 1["1"] } + case.let { 1["1"] } + + case.also { 1["1"] } + case.also { 1["1"] } + + case.run { 1["1"] } + case.run { 1["1"] } +} 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/p-11/pos/4.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt new file mode 100644 index 00000000000..dc4e94210be --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt @@ -0,0 +1,133 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY 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 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +fun case1() { + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + //to (1.1) + 1.boo(x = 1) + //(1.1) return type is String + 1.boo(x = 1) + +} + +private fun Int.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +private fun Int.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private fun Long.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +private fun Long.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private fun Short.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private fun Short.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +private fun Byte.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +private fun Byte.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 2 +package testPackCase2 +import testPackCase2.Case2.Companion.boo + +class Case2 { + val boo: Int = 1 + + companion object { + fun Int.boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun Int.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun Long.boo(x: Long, y: Int, a: Any = ""): Unit = TODO() //(1.2) + fun Long.boo(x: Long, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + fun Short.boo(x: Short, y: Int, a: Any = ""): Unit = TODO() //(1.3) + fun Short.boo(x: Short, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + fun Byte.boo(x: Byte, y: Int, a: Any = ""): Unit = TODO() //(1.4) + fun Byte.boo(x: Byte, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + } + + fun case() { + 1.boo(1, 1) + 1.boo(1, 1) + } +} + +fun case2(case: Case2) { + //to (1.1) + case.boo.boo(1, 2) + //(1.1) return type is String + case.boo.boo(1, 2) + //to (1.1) + case.boo.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo.boo(x = 1, y = 2) + + case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } + + case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } + + case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } + + case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } +} + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 3 +package testPackCase3 +import testPackCase3.Case3.Companion.get + +class Case3 { + val boo: Int = 1 + + companion object { + operator fun Int.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + operator fun Int.get(x: String, a: Any = ""): String = TODO() //(1.1) + operator fun Long.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + operator fun Long.get(x: String, a: Any = ""): Unit = TODO() //(1.2) + operator fun Short.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + operator fun Short.get(x: String, a: Any = ""): Unit = TODO() //(1.3) + operator fun Byte.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + operator fun Byte.get(x: String, a: Any = "" ): Unit = TODO() //(1.4) + } + + fun case() { + 1["1"] + 1["1"] + } +} + +fun case3(case: Case3) { + //to (1.1) + case.boo["1"] + //(1.1) return type is String + case.boo["1"] + + case.apply { 1["1"] } + case.apply { 1["1"] } + + case.let { 1["1"] } + case.let { 1["1"] } + + case.also { 1["1"] } + case.also { 1["1"] } + + case.run { 1["1"] } + case.run { 1["1"] } +} \ No newline at end of file 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/p-11/pos/4.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt new file mode 100644 index 00000000000..cc171c2edbc --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.fir.kt @@ -0,0 +1,101 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + case.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + +fun Case1.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +fun Case1.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +fun Case1.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +fun Case1.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +fun Case1.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) +fun Case1.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any = ""): Unit = TODO() //(1.2) + fun boo(x: Long, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int, a: Any = ""): Unit = TODO() //(1.3) + fun boo(x: Short, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int, a: Any = ""): Unit = TODO() //(1.4) + fun boo(x: Byte, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any = ""): Unit = TODO() //(1.2) + fun boo(x: Int, y: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun get(x: Int, a: Any = ""): String = TODO() //(1.1) + operator fun get(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + operator fun get(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + operator fun get(x: Long, a: Any = ""): Unit = TODO() //(1.2) + operator fun get(x: Short, a: Any = ""): Unit = TODO() //(1.3) + operator fun get(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + operator fun get(x: Byte, a: Any = ""): Unit = TODO() //(1.4) + operator fun get(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + case.apply { + //to (1.1) + get(1) + //(1.1) return type is String + get(1) + //to (1.1) + this [1] + //(1.1) return type is String + this [1] + } +} 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/p-11/pos/4.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt new file mode 100644 index 00000000000..075d53c8445 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt @@ -0,0 +1,113 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY 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 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: call with implicit receiver: different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + case.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + +fun Case1.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +fun Case1.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +fun Case1.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +fun Case1.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +fun Case1.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +fun Case1.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) +fun Case1.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Long, y: Int, a: Any = ""): Unit = TODO() //(1.2) + fun boo(x: Long, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int, a: Any = ""): Unit = TODO() //(1.3) + fun boo(x: Short, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int, a: Any = ""): Unit = TODO() //(1.4) + fun boo(x: Byte, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + fun boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + fun boo(x: Int, y: Short, a: Any = ""): Unit = TODO() //(1.2) + fun boo(x: Int, y: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun get(x: Int, a: Any = ""): String = TODO() //(1.1) + operator fun get(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + operator fun get(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + operator fun get(x: Long, a: Any = ""): Unit = TODO() //(1.2) + operator fun get(x: Short, a: Any = ""): Unit = TODO() //(1.3) + operator fun get(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + operator fun get(x: Byte, a: Any = ""): Unit = TODO() //(1.4) + operator fun get(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + case.apply { + //to (1.1) + get(1) + //(1.1) return type is String + get(1) + //to (1.1) + this [1] + //(1.1) return type is String + this [1] + } +} 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/p-11/pos/4.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt new file mode 100644 index 00000000000..ea206a07293 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.fir.kt @@ -0,0 +1,87 @@ +// !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 testPackCase1 +private fun Int.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +private fun Int.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private fun Int.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +private fun Int.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private fun Int.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +private fun Int.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private fun Int.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) +private fun Int.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +fun case1() { + 1.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +class Case2 { + private fun Int.boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + private fun Int.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + private fun Short.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.2) + private fun Short.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + private fun Long.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.3) + private fun Long.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + private fun Byte.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.4) + private fun Byte.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + + fun case2() { + 1.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } + } +} + + + + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackCase4 + +private operator fun Int.get(x: String, a: Any = ""): String = TODO() //(1.1) +private operator fun Int.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private operator fun Short.get(x: String, a: Any = ""): Unit = TODO() //(1.2) +private operator fun Short.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private operator fun Byte.get(x: String, a: Any = ""): Unit = TODO() //(1.3) +private operator fun Byte.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private operator fun Long.get(x: String, a: Any = ""): Unit = TODO() //(1.4) +private operator fun Long.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +fun case4() { + 1.apply { + //to (1.1) + get("1") + //(1.1) return type is String + get("1") + //to (1.1) + this["1"] + //(1.1) return type is String + this["1"] + } +} 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/p-11/pos/4.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt new file mode 100644 index 00000000000..707971a43cd --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt @@ -0,0 +1,99 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY 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 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 +private fun Int.boo(x: Int, a: Any = ""): String = TODO() //(1.1) +private fun Int.boo(x: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private fun Int.boo(x: Long, a: Any = ""): Unit = TODO() //(1.2) +private fun Int.boo(x: Long, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private fun Int.boo(x: Short, a: Any = ""): Unit = TODO() //(1.3) +private fun Int.boo(x: Short, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private fun Int.boo(x: Byte, a: Any = ""): Unit = TODO() //(1.4) +private fun Int.boo(x: Byte, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +fun case1() { + 1.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +class Case2 { + private fun Int.boo(x: Int, y: Int, a: Any = ""): String = TODO() //(1.1) + private fun Int.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) + private fun Short.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.2) + private fun Short.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) + private fun Long.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.3) + private fun Long.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) + private fun Byte.boo(x: Int, y: Int, a: Any = ""): Unit = TODO() //(1.4) + private fun Byte.boo(x: Int, y: Int, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + + fun case2() { + 1.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } + } +} + + + + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackCase4 + +private operator fun Int.get(x: String, a: Any = ""): String = TODO() //(1.1) +private operator fun Int.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.1) +private operator fun Short.get(x: String, a: Any = ""): Unit = TODO() //(1.2) +private operator fun Short.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.2) +private operator fun Byte.get(x: String, a: Any = ""): Unit = TODO() //(1.3) +private operator fun Byte.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.3) +private operator fun Long.get(x: String, a: Any = ""): Unit = TODO() //(1.4) +private operator fun Long.get(x: String, a: Any = "", b: Any = 1): Unit = TODO() //(1.4) + +fun case4() { + 1.apply { + //to (1.1) + get("1") + //(1.1) return type is String + get("1") + //to (1.1) + this["1"] + //(1.1) return type is String + this["1"] + } +} 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/p-11/pos/4.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt new file mode 100644 index 00000000000..a947d0db114 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.fir.kt @@ -0,0 +1,16 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 5 +class Case5 { + fun List.foo(x: T, y: Int = 1, z: Int = 1) : Unit =TODO() + + fun List.foo(x: T, y: Int = 1) : String =TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} 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/p-11/pos/4.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt new file mode 100644 index 00000000000..c4d3da033b3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt @@ -0,0 +1,29 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * PRIMARY 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 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * NUMBER: 5 + * DESCRIPTION: call with explicit receiver + */ + +// TESTCASE NUMBER: 5 +class Case5 { + fun List.foo(x: T, y: Int = 1, z: Int = 1) : Unit =TODO() + + fun List.foo(x: T, y: Int = 1) : String =TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} \ No newline at end of file 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/p-11/pos/5.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt new file mode 100644 index 00000000000..e4bc77811eb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.fir.kt @@ -0,0 +1,25 @@ +// !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(y: Int, x: Int): String = TODO() // (1.1) + fun foo(vararg x: Int): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: Any?, x: Any?): String = TODO() // (1.1) + fun foo(vararg x: Any?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} 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/p-11/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt new file mode 100644 index 00000000000..5b3f08e3c1c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.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 (POSITIVE) + * + * SPEC VERSION: 0.1-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 5 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 5 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The candidate having any variable-argument parameters is less specific + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(y: Int, x: Int): String = TODO() // (1.1) + fun foo(vararg x: Int): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: Any?, x: Any?): String = TODO() // (1.1) + fun foo(vararg x: Any?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} \ No newline at end of file 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/p-12/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt new file mode 100644 index 00000000000..8dc04d634b0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.fir.kt @@ -0,0 +1,164 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) + //to (1.1) + case.boo(x = 1) + //(1.1) return type is String + case.boo(x = 1) + +} + +fun Case1.boo(x: Int): String = TODO() //(1.1) +fun Case1.boo(x: Long): Unit = TODO() //(1.2) +fun Case1.boo(x: Short): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo(x = 1, y = 2) +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Int, y: Short): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo(x = 1, y = 2) +} + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun plus(x: Int): String = TODO() //(1.1) + operator fun plus(x: Long): Unit = TODO() //(1.2) + operator fun plus(x: Short): Unit = TODO() //(1.3) + operator fun plus(x: Byte): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + //to (1.1) + case.plus(1) + //(1.1) return type is String + case.plus(1) + //to (1.1) + case.plus(x = 1) + //(1.1) return type is String + case.plus(x = 1) + //as operator call case + 1 + //to (1.1) + case+1 + //(1.1) return type is String + case+1 +} + +// TESTCASE NUMBER: 5 +class Case5 { + fun List.foo(x: Int = 0): String = TODO() + fun List.foo(x: Short = 0): Unit = TODO() + fun List.foo(x: Byte = 0): Unit = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 6 +class Case6 { + fun List.foo(x: Int, y: Int = 1): String = TODO() + + fun List.foo(x: T): Unit = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 7 +class Case7 { + fun List.foo(x: T, y: Int): String = TODO() + + fun List.foo(x: T, y: Short): Unit = TODO() + + fun case(list: List) { + list.foo(1, 1) + list.foo(1, 1) + } +} + +// TESTCASE NUMBER: 8 +class Case8() { + fun foo(x: Int, y: Number?): Unit = TODO() // (1) + fun foo(vararg x: Int): String = TODO()//(2) +} + +fun testcase8(case: Case8) { + case.foo(1, 1) + case.foo(1, 1) +} + +// TESTCASE NUMBER: 9 +class Case9() { + fun xoo(y: Int, x: Byte): Unit = TODO() // (2.1) + fun xoo(y: Int, vararg x: Int): String = TODO()// (2.2) +} + +fun testcase9(case: Case9) { + case.xoo(1, 1) + case.xoo(1, 1) +} + +// TESTCASE NUMBER: 10 +class Case10() { + fun xoo(y: Int, x: Byte): Unit = TODO() // (2.1) + fun xoo(vararg x: Int): String = TODO()// (2.2) +} + +fun testcase10(case: Case10) { + case.xoo(1, 1) + case.xoo(1, 1) +} + +// TESTCASE NUMBER: 11 +class Case11() { + fun xoo(y: Int, x: Number): Unit = TODO() // (2.1) + fun xoo(vararg x: Int): String = TODO()// (2.2) +} + +fun testcase11(case: Case11) { + case.xoo(1, 1) + case.xoo(1, 1) +} 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/p-12/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt new file mode 100644 index 00000000000..857e0139387 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt @@ -0,0 +1,175 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: call with explicit receiver: different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) + //to (1.1) + case.boo(x = 1) + //(1.1) return type is String + case.boo(x = 1) + +} + +fun Case1.boo(x: Int): String = TODO() //(1.1) +fun Case1.boo(x: Long): Unit = TODO() //(1.2) +fun Case1.boo(x: Short): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo(x = 1, y = 2) +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Int, y: Short): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + //to (1.1) + case.boo(1, 2) + //(1.1) return type is String + case.boo(1, 2) + //to (1.1) + case.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo(x = 1, y = 2) +} + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun plus(x: Int): String = TODO() //(1.1) + operator fun plus(x: Long): Unit = TODO() //(1.2) + operator fun plus(x: Short): Unit = TODO() //(1.3) + operator fun plus(x: Byte): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + //to (1.1) + case.plus(1) + //(1.1) return type is String + case.plus(1) + //to (1.1) + case.plus(x = 1) + //(1.1) return type is String + case.plus(x = 1) + //as operator call case + 1 + //to (1.1) + case+1 + //(1.1) return type is String + case+1 +} + +// TESTCASE NUMBER: 5 +class Case5 { + fun List.foo(x: Int = 0): String = TODO() + fun List.foo(x: Short = 0): Unit = TODO() + fun List.foo(x: Byte = 0): Unit = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 6 +class Case6 { + fun List.foo(x: Int, y: Int = 1): String = TODO() + + fun List.foo(x: T): Unit = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 7 +class Case7 { + fun List.foo(x: T, y: Int): String = TODO() + + fun List.foo(x: T, y: Short): Unit = TODO() + + fun case(list: List) { + list.foo(1, 1) + list.foo(1, 1) + } +} + +// TESTCASE NUMBER: 8 +class Case8() { + fun foo(x: Int, y: Number?): Unit = TODO() // (1) + fun foo(vararg x: Int): String = TODO()//(2) +} + +fun testcase8(case: Case8) { + case.foo(1, 1) + case.foo(1, 1) +} + +// TESTCASE NUMBER: 9 +class Case9() { + fun xoo(y: Int, x: Byte): Unit = TODO() // (2.1) + fun xoo(y: Int, vararg x: Int): String = TODO()// (2.2) +} + +fun testcase9(case: Case9) { + case.xoo(1, 1) + case.xoo(1, 1) +} + +// TESTCASE NUMBER: 10 +class Case10() { + fun xoo(y: Int, x: Byte): Unit = TODO() // (2.1) + fun xoo(vararg x: Int): String = TODO()// (2.2) +} + +fun testcase10(case: Case10) { + case.xoo(1, 1) + case.xoo(1, 1) +} + +// TESTCASE NUMBER: 11 +class Case11() { + fun xoo(y: Int, x: Number): Unit = TODO() // (2.1) + fun xoo(vararg x: Int): String = TODO()// (2.2) +} + +fun testcase11(case: Case11) { + case.xoo(1, 1) + case.xoo(1, 1) +} \ No newline at end of file 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/p-12/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt new file mode 100644 index 00000000000..d0160c36797 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.fir.kt @@ -0,0 +1,109 @@ +// !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 testPackCase1 + +fun case1() { + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + //to (1.1) + 1.boo(x = 1) + //(1.1) return type is String + 1.boo(x = 1) + +} + +private fun Int.boo(x: Int): String = TODO() //(1.1) +private fun Long.boo(x: Long): Unit = TODO() //(1.2) +private fun Short.boo(x: Short): Unit = TODO() //(1.3) +private fun Byte.boo(x: Byte): Unit = TODO() //(1.4) + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 2 +package testPackCase2 +import testPackCase2.Case2.Companion.boo + +class Case2 { + val boo: Int = 1 + + companion object { + fun Int.boo(x: Int, y: Int): String = TODO() //(1.1) + fun Long.boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun Short.boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun Byte.boo(x: Byte, y: Int): Unit = TODO() //(1.4) + } + + fun case() { + 1.boo(1, 1) + 1.boo(1, 1) + } +} + +fun case2(case: Case2) { + //to (1.1) + case.boo.boo(1, 2) + //(1.1) return type is String + case.boo.boo(1, 2) + //to (1.1) + case.boo.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo.boo(x = 1, y = 2) + + case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } + + case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } + + case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } + + case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } +} + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 3 +package testPackCase3 +import testPackCase3.Case3.Companion.plus + +class Case3 { + val boo: Int = 1 + + companion object { + operator fun Int.plus(x: String): String = TODO() //(1.1) + operator fun Long.plus(x: String): Unit = TODO() //(1.2) + operator fun Short.plus(x: String): Unit = TODO() //(1.3) + operator fun Byte.plus(x: String): Unit = TODO() //(1.4) + } + + fun case() { + .plus; typeCall: function")!>1+"1" + 1+"1" + } +} + +fun case3(case: Case3) { + //to (1.1) + case.boo+"1" + //(1.1) return type is String + case.boo+"1" + + case.apply { .plus; typeCall: function")!>1+"1" } + case.apply { 1+"1" } + + case.let { .plus; typeCall: function")!>1+"1" } + case.let { 1+"1" } + + case.also { .plus; typeCall: function")!>1+"1" } + case.also { 1+"1" } + + case.run { .plus; typeCall: function")!>1+"1" } + case.run { 1+"1" } +} 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/p-12/pos/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt new file mode 100644 index 00000000000..dc51b026932 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt @@ -0,0 +1,120 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +fun case1() { + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + //to (1.1) + 1.boo(x = 1) + //(1.1) return type is String + 1.boo(x = 1) + +} + +private fun Int.boo(x: Int): String = TODO() //(1.1) +private fun Long.boo(x: Long): Unit = TODO() //(1.2) +private fun Short.boo(x: Short): Unit = TODO() //(1.3) +private fun Byte.boo(x: Byte): Unit = TODO() //(1.4) + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 2 +package testPackCase2 +import testPackCase2.Case2.Companion.boo + +class Case2 { + val boo: Int = 1 + + companion object { + fun Int.boo(x: Int, y: Int): String = TODO() //(1.1) + fun Long.boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun Short.boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun Byte.boo(x: Byte, y: Int): Unit = TODO() //(1.4) + } + + fun case() { + 1.boo(1, 1) + 1.boo(1, 1) + } +} + +fun case2(case: Case2) { + //to (1.1) + case.boo.boo(1, 2) + //(1.1) return type is String + case.boo.boo(1, 2) + //to (1.1) + case.boo.boo(x = 1, y = 2) + //(1.1) return type is String + case.boo.boo(x = 1, y = 2) + + case.apply { 1.boo(1, 1) } + case.apply { 1.boo(1, 1) } + + case.let { 1.boo(1, 1) } + case.let { 1.boo(1, 1) } + + case.also { 1.boo(1, 1) } + case.also { 1.boo(1, 1) } + + case.run { 1.boo(1, 1) } + case.run { 1.boo(1, 1) } +} + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 3 +package testPackCase3 +import testPackCase3.Case3.Companion.plus + +class Case3 { + val boo: Int = 1 + + companion object { + operator fun Int.plus(x: String): String = TODO() //(1.1) + operator fun Long.plus(x: String): Unit = TODO() //(1.2) + operator fun Short.plus(x: String): Unit = TODO() //(1.3) + operator fun Byte.plus(x: String): Unit = TODO() //(1.4) + } + + fun case() { + 1+"1" + 1+"1" + } +} + +fun case3(case: Case3) { + //to (1.1) + case.boo+"1" + //(1.1) return type is String + case.boo+"1" + + case.apply { 1+"1" } + case.apply { 1+"1" } + + case.let { 1+"1" } + case.let { 1+"1" } + + case.also { 1+"1" } + case.also { 1+"1" } + + case.run { 1+"1" } + case.run { 1+"1" } +} \ No newline at end of file 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/p-12/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt new file mode 100644 index 00000000000..ee7d40e4158 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.fir.kt @@ -0,0 +1,87 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + case.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + +fun Case1.boo(x: Int): String = TODO() //(1.1) +fun Case1.boo(x: Long): Unit = TODO() //(1.2) +fun Case1.boo(x: Short): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Int, y: Short): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun minus(x: Int): String = TODO() //(1.1) + operator fun minus(x: Long): Unit = TODO() //(1.2) + operator fun minus(x: Short): Unit = TODO() //(1.3) + operator fun minus(x: Byte): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + case.apply { + //to (1.1) + minus(1) + //(1.1) return type is String + minus(1) + //to (1.1) + this - 1 + //(1.1) return type is String + this - 1 + } +} 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/p-12/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt new file mode 100644 index 00000000000..e6027ab05a4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt @@ -0,0 +1,98 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: call with implicit receiver: different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1 + +fun case1(case: Case1) { + case.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + +fun Case1.boo(x: Int): String = TODO() //(1.1) +fun Case1.boo(x: Long): Unit = TODO() //(1.2) +fun Case1.boo(x: Short): Unit = TODO() //(1.3) +fun Case1.boo(x: Byte): Unit = TODO() //(1.4) + +// TESTCASE NUMBER: 2 +class Case2 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Long, y: Int): Unit = TODO() //(1.2) + fun boo(x: Short, y: Int): Unit = TODO() //(1.3) + fun boo(x: Byte, y: Int): Unit = TODO() //(1.4) +} + +fun case2(case: Case2) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun boo(x: Int, y: Int): String = TODO() //(1.1) + fun boo(x: Int, y: Short): Unit = TODO() //(1.2) +} + +fun case3(case: Case3) { + case.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } +} + + +// TESTCASE NUMBER: 4 +class Case4 { + operator fun minus(x: Int): String = TODO() //(1.1) + operator fun minus(x: Long): Unit = TODO() //(1.2) + operator fun minus(x: Short): Unit = TODO() //(1.3) + operator fun minus(x: Byte): Unit = TODO() //(1.4) +} + +fun case4(case: Case4) { + case.apply { + //to (1.1) + minus(1) + //(1.1) return type is String + minus(1) + //to (1.1) + this - 1 + //(1.1) return type is String + this - 1 + } +} 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/p-12/pos/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt new file mode 100644 index 00000000000..26f71e622f3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.fir.kt @@ -0,0 +1,75 @@ +// !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 testPackCase1 +private fun Int.boo(x: Int): String = TODO() //(1.1) +private fun Int.boo(x: Long): Unit = TODO() //(1.2) +private fun Int.boo(x: Short): Unit = TODO() //(1.3) +private fun Int.boo(x: Byte): Unit = TODO() //(1.4) + +fun case1() { + 1.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +class Case2 { + private fun Int.boo(x: Int, y: Int): String = TODO() //(1.1) + private fun Short.boo(x: Int, y: Int): Unit = TODO() //(1.2) + private fun Long.boo(x: Int, y: Int): Unit = TODO() //(1.3) + private fun Byte.boo(x: Int, y: Int): Unit = TODO() //(1.4) + + fun case2() { + 1.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } + } +} + + + + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackCase4 + +private operator fun Int.minus(x: String): String = TODO() //(1.1) +private operator fun Short.minus(x: String): Unit = TODO() //(1.2) +private operator fun Byte.minus(x: String): Unit = TODO() //(1.3) +private operator fun Long.minus(x: String): Unit = TODO() //(1.4) + +fun case4() { + 1.apply { + //to (1.1) + minus("1") + //(1.1) return type is String + minus("1") + //to (1.1) + this-"1" + //(1.1) return type is String + this-"1" + } +} 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/p-12/pos/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt new file mode 100644 index 00000000000..c2b07ea12b9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt @@ -0,0 +1,86 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 +private fun Int.boo(x: Int): String = TODO() //(1.1) +private fun Int.boo(x: Long): Unit = TODO() //(1.2) +private fun Int.boo(x: Short): Unit = TODO() //(1.3) +private fun Int.boo(x: Byte): Unit = TODO() //(1.4) + +fun case1() { + 1.apply { + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + //to (1.1) + boo(x = 1) + //(1.1) return type is String + boo(x = 1) + } +} + + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +class Case2 { + private fun Int.boo(x: Int, y: Int): String = TODO() //(1.1) + private fun Short.boo(x: Int, y: Int): Unit = TODO() //(1.2) + private fun Long.boo(x: Int, y: Int): Unit = TODO() //(1.3) + private fun Byte.boo(x: Int, y: Int): Unit = TODO() //(1.4) + + fun case2() { + 1.apply { + //to (1.1) + boo(1, 2) + //(1.1) return type is String + boo(1, 2) + //to (1.1) + boo(x = 1, y = 2) + //(1.1) return type is String + boo(x = 1, y = 2) + } + } +} + + + + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackCase4 + +private operator fun Int.minus(x: String): String = TODO() //(1.1) +private operator fun Short.minus(x: String): Unit = TODO() //(1.2) +private operator fun Byte.minus(x: String): Unit = TODO() //(1.3) +private operator fun Long.minus(x: String): Unit = TODO() //(1.4) + +fun case4() { + 1.apply { + //to (1.1) + minus("1") + //(1.1) return type is String + minus("1") + //to (1.1) + this-"1" + //(1.1) return type is String + this-"1" + } +} 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/p-12/pos/2.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt new file mode 100644 index 00000000000..8022b78b216 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.fir.kt @@ -0,0 +1,35 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1{ + infix fun boo(x: Int): String = TODO() //(1.1) + infix fun boo(x: Long): Unit = TODO() //(1.2) + infix fun boo(x: Short): Unit = TODO() //(1.3) + infix fun boo(x: Byte): Unit = TODO() //(1.4) +} + +fun case1(case: Case1) { + case.apply { + //to (1.1) + this boo 1 + //(1.1) return type is String + this boo 1 + + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + } + //to (1.1) + case boo 1 + //(1.1) return type is String + case boo 1 + + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) +} 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/p-12/pos/2.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt new file mode 100644 index 00000000000..b1dd3b0f685 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt @@ -0,0 +1,47 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: infix call: different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1{ + infix fun boo(x: Int): String = TODO() //(1.1) + infix fun boo(x: Long): Unit = TODO() //(1.2) + infix fun boo(x: Short): Unit = TODO() //(1.3) + infix fun boo(x: Byte): Unit = TODO() //(1.4) +} + +fun case1(case: Case1) { + case.apply { + //to (1.1) + this boo 1 + //(1.1) return type is String + this boo 1 + + //to (1.1) + boo(1) + //(1.1) return type is String + boo(1) + } + //to (1.1) + case boo 1 + //(1.1) return type is String + case boo 1 + + //to (1.1) + case.boo(1) + //(1.1) return type is String + case.boo(1) +} + 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/p-12/pos/2.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt new file mode 100644 index 00000000000..0ab96f4857e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.fir.kt @@ -0,0 +1,43 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1{ + infix fun Int.boo(x: Int): String = TODO() //(1.1) + infix fun Long.boo(x: Long): Unit = TODO() //(1.2) + infix fun Short.boo(x: Short): Unit = TODO() //(1.3) + infix fun Byte.boo(x: Byte): Unit = TODO() //(1.4) + + fun case(){ + //to (1.1) + 1 boo 1 + //(1.1) return type is String + 1 boo 1 + + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + } +} + +fun case1(case: Case1) { + case.apply { + //to (1.1) + 1 boo 1 + //(1.1) return type is String + 1 boo 1 + + 1.apply{ + //to (1.1) + this boo 1 + //(1.1) return type is String + this boo 1 + } + } + + + +} 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/p-12/pos/2.6.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt new file mode 100644 index 00000000000..c023498c1a3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt @@ -0,0 +1,55 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * NUMBER: 6 + * DESCRIPTION: infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int + */ + +// TESTCASE NUMBER: 1 +class Case1{ + infix fun Int.boo(x: Int): String = TODO() //(1.1) + infix fun Long.boo(x: Long): Unit = TODO() //(1.2) + infix fun Short.boo(x: Short): Unit = TODO() //(1.3) + infix fun Byte.boo(x: Byte): Unit = TODO() //(1.4) + + fun case(){ + //to (1.1) + 1 boo 1 + //(1.1) return type is String + 1 boo 1 + + //to (1.1) + 1.boo(1) + //(1.1) return type is String + 1.boo(1) + } +} + +fun case1(case: Case1) { + case.apply { + //to (1.1) + 1 boo 1 + //(1.1) return type is String + 1 boo 1 + + 1.apply{ + //to (1.1) + this boo 1 + //(1.1) return type is String + this boo 1 + } + } + + + +} + 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/p-12/pos/2.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt new file mode 100644 index 00000000000..4ba22d64170 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.fir.kt @@ -0,0 +1,50 @@ +// !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 testPackCase1 + +import testPackCase1.I1.Companion.invoke +import testPackCase1.I2.Companion.invoke + +class Case1() : I2, I1 { + + fun case() { + invoke(1) + invoke(1) + } +} + +interface I2{ + companion object { + operator fun invoke(x: Short): Unit = print(3) // (3) + } +} +interface I1{ + companion object { + operator fun invoke(x: Int): String = "print(3)" // (3) + } +} + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 + +class Case2() : I3 { + operator fun invoke(x: Short): Unit = print(3) // (1) + companion object { + operator fun invoke(x: Int): Unit = print(3) // (2) + } + + fun case() { + invoke(1) + invoke(1) + } +} + +interface I3 { + operator fun invoke(x: Int): String = "print(3)" // (3) +} 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/p-12/pos/2.7.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt new file mode 100644 index 00000000000..c6de3c222dc --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt @@ -0,0 +1,64 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 12 -> sentence 2 + * PRIMARY 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 3 + * built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 3 + * NUMBER: 7 + * DESCRIPTION: different built-in integer types and one of them is kotlin.Int + */ + + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I1.Companion.invoke +import testPackCase1.I2.Companion.invoke + +class Case1() : I2, I1 { + + fun case() { + invoke(1) + invoke(1) + } +} + +interface I2{ + companion object { + operator fun invoke(x: Short): Unit = print(3) // (3) + } +} +interface I1{ + companion object { + operator fun invoke(x: Int): String = "print(3)" // (3) + } +} + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 + +class Case2() : I3 { + operator fun invoke(x: Short): Unit = print(3) // (1) + companion object { + operator fun invoke(x: Int): Unit = print(3) // (2) + } + + fun case() { + invoke(1) + invoke(1) + } +} + +interface I3 { + operator fun invoke(x: Int): String = "print(3)" // (3) +} + 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/p-14/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt new file mode 100644 index 00000000000..7360d94c8c7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.fir.kt @@ -0,0 +1,65 @@ +// !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, y: Number?): Unit = TODO() // (1) + fun foo(vararg x: Short): Unit = TODO()//(2) + + fun testcase() { + foo(1, 1) + } +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: Any, x: Any): Unit = TODO() // (1.1) + fun foo(vararg x: Int?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(y: Any, x: Any): Unit = TODO() // (1.1) + fun foo(vararg x: Int?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} + +// TESTCASE NUMBER: 4 +class Case4() { + fun foo(y: Int, x: Short): Unit = TODO() // (1.1) + fun foo(y: Int, x: Long): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} + + +// TESTCASE NUMBER: 5 +class Case5() { + fun foo(y: Int, x: Short): Unit = TODO() // (1.1) + fun foo(y: Int, x: Long, a : Any =""): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} + +// TESTCASE NUMBER: 6 + +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun bar() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-14/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt new file mode 100644 index 00000000000..7c603c2a711 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: an overload ambiguity which must be reported if several candidates which are equally applicable for the call exests + */ +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: Int, y: Number?): Unit = TODO() // (1) + fun foo(vararg x: Short): Unit = TODO()//(2) + + fun testcase() { + foo(1, 1) + } +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(y: Any, x: Any): Unit = TODO() // (1.1) + fun foo(vararg x: Int?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(y: Any, x: Any): Unit = TODO() // (1.1) + fun foo(vararg x: Int?): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} + +// TESTCASE NUMBER: 4 +class Case4() { + fun foo(y: Int, x: Short): Unit = TODO() // (1.1) + fun foo(y: Int, x: Long): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + } +} + + +// TESTCASE NUMBER: 5 +class Case5() { + fun foo(y: Int, x: Short): Unit = TODO() // (1.1) + fun foo(y: Int, x: Long, a : Any =""): Unit = TODO() // (1.2) + + fun case(){ + foo(1, 1) + foo(1, 1) + } +} + +// TESTCASE NUMBER: 6 + +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun bar() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-14/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt new file mode 100644 index 00000000000..d4fb5a8596d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.fir.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 6 +// NOTE: todo link new sentences +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun bar() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-14/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt new file mode 100644 index 00000000000..029eec91940 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt @@ -0,0 +1,23 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: an overload ambiguity which must be reported if several candidates which are equally applicable for the call exests + */ + +// TESTCASE NUMBER: 6 +// NOTE: todo link new sentences +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun bar() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-14/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt new file mode 100644 index 00000000000..1cbb3f314a5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.fir.kt @@ -0,0 +1,56 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +import testPackCase2.I2.Companion.foo +import testPackCase2.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} 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/p-14/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt new file mode 100644 index 00000000000..cd2b24d984c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt @@ -0,0 +1,65 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * NUMBER: 3 + * DESCRIPTION: call with explicit receiver: different built-in integer types and both of them are kotlin.Int + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 +package testPackCase2 + +import testPackCase2.I2.Companion.foo +import testPackCase2.I1.Companion.foo + +class Case2() : I2, I1{ + + fun test(){ + foo(1) + } +} + +interface I2{ + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1{ + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} 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/p-14/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt new file mode 100644 index 00000000000..ebc348cbafa --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.fir.kt @@ -0,0 +1,44 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int): Unit = print(4) // (4) + } +} 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/p-14/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt new file mode 100644 index 00000000000..3869e6df763 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt @@ -0,0 +1,55 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: Both candidates are more applicable and few of them are non-parameterized + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int): Unit = print(4) // (4) + } +} 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/p-14/neg/1.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt new file mode 100644 index 00000000000..d19f90641af --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.fir.kt @@ -0,0 +1,48 @@ +// !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-38912 + */ +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, y: Any = ""): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, y: Any = ""): Unit = print(4) // (4) + } +} 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/p-14/neg/1.5.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt new file mode 100644 index 00000000000..243dab95b1d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt @@ -0,0 +1,60 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 2 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * NUMBER: 5 + * DESCRIPTION: Both candidates are more applicable and few of them is non-parameterized + */ + +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-38912 + */ +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, y: Any = ""): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, y: Any = ""): Unit = print(4) // (4) + } +} 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/p-14/neg/1.6.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt new file mode 100644 index 00000000000..4ba4ad842e5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.fir.kt @@ -0,0 +1,44 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int, y: Any): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, z: Any = "", vararg y: Any): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short, z: Any = "", vararg y: Any): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, z: Any = "", vararg y: Any): Unit = print(4) // (4) + } +} 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/p-14/neg/1.6.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt new file mode 100644 index 00000000000..2a047055962 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt @@ -0,0 +1,57 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 2 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 4 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 5 + * NUMBER: 6 + * DESCRIPTION: Both candidates are more applicable and few of them is non-parameterized + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int, y: Any): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, z: Any = "", vararg y: Any): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short, z: Any = "", vararg y: Any): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, z: Any = "", vararg y: Any): Unit = print(4) // (4) + } +} 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/p-14/neg/1.7.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt new file mode 100644 index 00000000000..f41d2776d7c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.fir.kt @@ -0,0 +1,44 @@ +// !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 testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int, y: Any): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, vararg y: Any): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short, vararg y: Any): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, vararg y: Any): Unit = print(4) // (4) + } +} 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/p-14/neg/1.7.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt new file mode 100644 index 00000000000..622bc508df7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt @@ -0,0 +1,56 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 14 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 3 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 2 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 11 -> sentence 5 + * NUMBER: 7 + * DESCRIPTION: Both candidates are more applicable and few of them is non-parameterized + */ + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 +package testPackCase1 + +import testPackCase1.I2.Companion.foo +import testPackCase1.I1.Companion.foo +import testPackCase1.I3.Companion.foo +import testPackCase1.I4.Companion.foo + +class Case1() : I2, I1, I3, I4 { + + fun test() { + foo(1) + } +} + +interface I2 { + companion object { + fun foo(x: Int, y: Any): Unit = print(1) // (1) + } +} + +interface I1 { + companion object { + fun foo(x: Int, vararg y: Any): String = "print(2)" // (2) + } +} + +interface I3 { + companion object { + fun foo(x: Short, vararg y: Any): Unit = print(3) // (3) + } +} + +interface I4 { + companion object { + fun foo(x: Int, vararg y: Any): Unit = print(4) // (4) + } +} 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/p-17/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.fir.kt new file mode 100644 index 00000000000..4db6e3767ce --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.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 testPackCase1 +class A : I1, I2 + +interface I1 +operator fun I1.invoke(): String = TODO() +interface I2 +operator fun I2.invoke(): String = TODO() + +fun case1(a: A) { + a.invoke() + a() + A()() +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(): String = TODO() +interface Interface2 +operator fun Interface2.invoke(): String = TODO() + +fun case1(a: I) { + a.invoke() + a() + + val x = object : I {} () +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + */ +package testPackCase3 + +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(x :() -> Unit): String = TODO() +interface Interface2 +operator fun Interface2.invoke(x :() -> Unit): String = TODO() + +fun case1(a: I) { + a.invoke{} + a{} + + val x = object : I {} {} +} 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/p-17/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt new file mode 100644 index 00000000000..789cb0b41ce --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt @@ -0,0 +1,68 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: If several properties are equally applicable, this is an overload ambiguity as usual + */ +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + */ +package testPackCase1 +class A : I1, I2 + +interface I1 +operator fun I1.invoke(): String = TODO() +interface I2 +operator fun I2.invoke(): String = TODO() + +fun case1(a: A) { + a.invoke() + a() + A()() +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(): String = TODO() +interface Interface2 +operator fun Interface2.invoke(): String = TODO() + +fun case1(a: I) { + a.invoke() + a() + + val x = object : I {} () +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + */ +package testPackCase3 + +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(x :() -> Unit): String = TODO() +interface Interface2 +operator fun Interface2.invoke(x :() -> Unit): String = TODO() + +fun case1(a: I) { + a.invoke{} + a{} + + val x = object : I {} {} +} \ No newline at end of file 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/p-17/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.fir.kt new file mode 100644 index 00000000000..d29f42599bf --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.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 testPackCase1 +class A : I1, I2 + +interface I1 +operator fun I1.invoke(): String = TODO() +interface I2 +operator fun I2.invoke(): String = TODO() + +fun case1(a: A) { + a.invoke() + a() + A()() +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(): String = TODO() +interface Interface2 +operator fun Interface2.invoke(): String = TODO() + +fun case1(a: I) { + a.invoke() + a() + + val x = object : I {} () +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + */ +package testPackCase3 + +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(x :() -> Unit): String = TODO() +interface Interface2 +operator fun Interface2.invoke(x :() -> Unit): String = TODO() + +fun case1(a: I) { + a.invoke{} + a{} + + val x = object : I {} {} +} 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/p-17/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt new file mode 100644 index 00000000000..cedaa0ad25d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt @@ -0,0 +1,68 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: If several properties are equally applicable, this is an overload ambiguity as usual (both are parametrized) + */ +// FILE: TestCase1.kt +/* + * TESTCASE NUMBER: 1 + */ +package testPackCase1 +class A : I1, I2 + +interface I1 +operator fun I1.invoke(): String = TODO() +interface I2 +operator fun I2.invoke(): String = TODO() + +fun case1(a: A) { + a.invoke() + a() + A()() +} + +// FILE: TestCase2.kt +/* + * TESTCASE NUMBER: 2 + */ +package testPackCase2 +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(): String = TODO() +interface Interface2 +operator fun Interface2.invoke(): String = TODO() + +fun case1(a: I) { + a.invoke() + a() + + val x = object : I {} () +} + +// FILE: TestCase3.kt +/* + * TESTCASE NUMBER: 3 + */ +package testPackCase3 + +interface I : Interface1, Interface2 + +interface Interface1 +operator fun Interface1.invoke(x :() -> Unit): String = TODO() +interface Interface2 +operator fun Interface2.invoke(x :() -> Unit): String = TODO() + +fun case1(a: I) { + a.invoke{} + a{} + + val x = object : I {} {} +} \ No newline at end of file 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/p-3/pos/1.1.fir.kt b/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.fir.kt new file mode 100644 index 00000000000..e76fffddd82 --- /dev/null +++ b/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.fir.kt @@ -0,0 +1,37 @@ +// !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 case() { + foo("") + foo("") + } +} + +// 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 case() { + 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 case() { + foo("") + foo("") + } +} 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/p-3/pos/1.1.kt b/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 new file mode 100644 index 00000000000..001b7116a28 --- /dev/null +++ b/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 @@ -0,0 +1,49 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: 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: for every non-default argument of the call a type constraint is built unless both are built-in integer types + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: CharSequence): Unit = TODO() // (3) + fun foo(x: String, z: String = ""): String = TODO() // (4) + + fun case() { + foo("") + foo("") + } +} + +// 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 case() { + 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 case() { + foo("") + foo("") + } +} + 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/p-3/pos/1.2.fir.kt b/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.2.fir.kt new file mode 100644 index 00000000000..058e74455f0 --- /dev/null +++ b/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.2.fir.kt @@ -0,0 +1,14 @@ +// !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() + fun case() { + this.boo(1, 1) + this.boo(1, 1) + } +} 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/p-3/pos/1.2.kt b/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.2.kt new file mode 100644 index 00000000000..9d73f847a5c --- /dev/null +++ b/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.2.kt @@ -0,0 +1,26 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: 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: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built + */ + +// TESTCASE NUMBER: 1 +class Case1 { + fun boo(y: Int, x: Number): Unit = TODO() + fun boo(vararg x: Int): String = TODO() + fun case() { + this.boo(1, 1) + this.boo(1, 1) + } +} + 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/p-3/pos/1.3.fir.kt b/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.3.fir.kt new file mode 100644 index 00000000000..0ebe8698717 --- /dev/null +++ b/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.3.fir.kt @@ -0,0 +1,71 @@ +// !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: Short): String = TODO() // (1.1) + fun foo(x: Byte): Unit = TODO() // (1.2) + fun case1() { + foo(1) + foo(1) + } +} + +fun case1(case: Case1) { + case.foo(1) + case.foo(1) +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(vararg x: Short): String = TODO() // (1.1) + fun foo(vararg x: Byte): Unit = TODO() // (1.2) + fun case2(case: Case2) { + foo(1, 1) + foo(1, 1) + } +} + +fun case2(case: Case2) { + case.foo(1, 1) + case.foo(1, 1) +} + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(vararg x: Short): String = TODO() // (1.2) + fun foo(x: Byte): Unit = TODO() // (1.1) + fun case3(case: Case3) { + foo(1) + foo(1) + } +} + +fun case3(case: Case3) { + case.foo(1) + case.foo(1) +} + + +// TESTCASE NUMBER: 4 +class Case4() { + infix fun foo(x: Short): String = TODO() // (1.1) + infix fun foo(x: Byte): Unit = TODO() // (1.2) + fun case() { + this foo 1 + this foo 1 + foo(1) + foo(1) + this.foo(1) + this.foo(1) + } +} + +fun case4(case: Case4) { + case foo 1 + case foo 1 + case.foo( 1) + case.foo( 1) +} 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/p-3/pos/1.3.kt b/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.3.kt new file mode 100644 index 00000000000..35d3e4bd05f --- /dev/null +++ b/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.3.kt @@ -0,0 +1,80 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: built-in-types-and-their-semantics, built-in-integer-types-1, integer-type-widening -> paragraph 3 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: prefer kotlin.Short to kotlin.Byte. + */ + +// TESTCASE NUMBER: 1 +class Case1() { + fun foo(x: Short): String = TODO() // (1.1) + fun foo(x: Byte): Unit = TODO() // (1.2) + fun case1() { + foo(1) + foo(1) + } +} + +fun case1(case: Case1) { + case.foo(1) + case.foo(1) +} + +// TESTCASE NUMBER: 2 +class Case2() { + fun foo(vararg x: Short): String = TODO() // (1.1) + fun foo(vararg x: Byte): Unit = TODO() // (1.2) + fun case2(case: Case2) { + foo(1, 1) + foo(1, 1) + } +} + +fun case2(case: Case2) { + case.foo(1, 1) + case.foo(1, 1) +} + +// TESTCASE NUMBER: 3 +class Case3() { + fun foo(vararg x: Short): String = TODO() // (1.2) + fun foo(x: Byte): Unit = TODO() // (1.1) + fun case3(case: Case3) { + foo(1) + foo(1) + } +} + +fun case3(case: Case3) { + case.foo(1) + case.foo(1) +} + + +// TESTCASE NUMBER: 4 +class Case4() { + infix fun foo(x: Short): String = TODO() // (1.1) + infix fun foo(x: Byte): Unit = TODO() // (1.2) + fun case() { + this foo 1 + this foo 1 + foo(1) + foo(1) + this.foo(1) + this.foo(1) + } +} + +fun case4(case: Case4) { + case foo 1 + case foo 1 + case.foo( 1) + case.foo( 1) +} \ No newline at end of file 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/p-3/pos/1.4.fir.kt b/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.4.fir.kt new file mode 100644 index 00000000000..e9454331052 --- /dev/null +++ b/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.4.fir.kt @@ -0,0 +1,68 @@ +// !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, z: String = ""): String = TODO() // (4) + } + + fun case() { + Companion("") + Companion("") + } +} + +// 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() { + Companion(1, 1) + Companion(1, 1) + } +} + +// TESTCASE NUMBER: 3 +class Case3() { + companion object { + operator fun invoke(x: CharSequence, x1: String = ""): Unit = TODO() // (3) + operator fun invoke(x: String, z: Any = ""): String = TODO() // (4) + } + + fun case() { + Companion("") + Companion("") + } +} + +// TESTCASE NUMBER: 4 +interface I { + companion object { + operator fun invoke(x: CharSequence): Unit = print(1) // (1) + operator fun invoke(x: String, z: String = ""): String { print(2); return "" } // (2) + } +} +class Case4() : I { + companion object { + operator fun invoke(x: CharSequence): Unit = print(3) // (3) + operator fun invoke(x: String, z: String = ""): Any { print(4); return "" } // (4) + } + + fun case() { + I.invoke("") + I.invoke("") + invoke("") + invoke("") + I("") + I("") + Case4("") + Case4("") + } +} 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/p-3/pos/1.4.kt b/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.4.kt new file mode 100644 index 00000000000..15d3d46b1cc --- /dev/null +++ b/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.4.kt @@ -0,0 +1,81 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1 + * PRIMARY LINKS: 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 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 1 + * overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 17 -> sentence 3 + * NUMBER: 4 + * DESCRIPTION: for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable) + */ + +// TESTCASE NUMBER: 1 +class Case1() { + companion object { + operator fun invoke(x: CharSequence): Unit = TODO() // (3) + operator fun invoke(x: String, z: String = ""): String = TODO() // (4) + } + + fun case() { + Companion("") + Companion("") + } +} + +// 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() { + Companion(1, 1) + Companion(1, 1) + } +} + +// TESTCASE NUMBER: 3 +class Case3() { + companion object { + operator fun invoke(x: CharSequence, x1: String = ""): Unit = TODO() // (3) + operator fun invoke(x: String, z: Any = ""): String = TODO() // (4) + } + + fun case() { + Companion("") + Companion("") + } +} + +// TESTCASE NUMBER: 4 +interface I { + companion object { + operator fun invoke(x: CharSequence): Unit = print(1) // (1) + operator fun invoke(x: String, z: String = ""): String { print(2); return "" } // (2) + } +} +class Case4() : I { + companion object { + operator fun invoke(x: CharSequence): Unit = print(3) // (3) + operator fun invoke(x: String, z: String = ""): Any { print(4); return "" } // (4) + } + + fun case() { + I.invoke("") + I.invoke("") + invoke("") + invoke("") + I("") + I("") + Case4("") + Case4("") + } +} \ No newline at end of file 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/p-9/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt new file mode 100644 index 00000000000..bf2b86b8240 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.fir.kt @@ -0,0 +1,13 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +// TESTCASE NUMBER: 1 +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun case1() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-9/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt new file mode 100644 index 00000000000..752fd4be102 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt @@ -0,0 +1,22 @@ +// !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-387 + * MAIN LINK:overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 9 -> sentence 2 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Neither of the two candidates is more applicable than the other and both are non-parameterized + */ +// TESTCASE NUMBER: 1 +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") {} //2 +fun case1() { + foo(A()) //OVERLOAD_RESOLUTION_AMBIGUITY +} 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/p-9/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt new file mode 100644 index 00000000000..df22fb15b0b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.fir.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +// TESTCASE NUMBER: 1 +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") : String = "" //2 +fun case1(a: A) { + foo(a) + foo(a) +} + +// TESTCASE NUMBER: 2 +class A2 : B2, C2 +interface B2 +interface C2 +fun boo(x: B2) ="" //(1) +fun boo(y: C, z: String = "boo") {} //2 +fun case2(a: A2) { + boo(a) + boo(a) +} 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/p-9/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt new file mode 100644 index 00000000000..836a2e207e0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt @@ -0,0 +1,34 @@ +// !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-387 + * MAIN LINK:overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 9 -> sentence 1 + * PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 7 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Neither of the two candidates is more applicable than the other and one is non-parameterized + */ +// TESTCASE NUMBER: 1 +class A : B, C +interface B +interface C +fun foo(x: B) {} //(1) +fun foo(y: C, z: String = "foo") : String = "" //2 +fun case1(a: A) { + foo(a) + foo(a) +} + +// TESTCASE NUMBER: 2 +class A2 : B2, C2 +interface B2 +interface C2 +fun boo(x: B2) ="" //(1) +fun boo(y: C, z: String = "boo") {} //2 +fun case2(a: A2) { + boo(a) + boo(a) +} 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 new file mode 100644 index 00000000000..8ff546ca11a --- /dev/null +++ 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 @@ -0,0 +1,856 @@ +{ + "14": { + "neg": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "an overload ambiguity which must be reported if several candidates which are equally applicable for the call exests", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "call with explicit receiver: different built-in integer types and both of them are kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt", + "unexpectedBehaviour": true, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 6, + "description": "an overload ambiguity which must be reported if several candidates which are equally applicable for the call exests", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "7": { + "neg": { + "3": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "call with explicit receiver: different built-in integer types and both of them are kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + } + ], + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Neither of the two candidates is more applicable than the other and both are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "pos": { + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "Neither of the two candidates is more applicable than the other and one is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Both candidates are more applicable and one of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types", + "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" + } + ] + } + }, + "11": { + "neg": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + } + ], + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + } + ], + "4": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt", + "unexpectedBehaviour": true, + "linkType": "primary" + } + ], + "5": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": " Both candidates are more applicable and few of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Both candidates are more applicable and few of them are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Both candidates are more applicable and one of them is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ], + "4": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "5": [ + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "The candidate having any variable-argument parameters is less specific", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "The candidate having any variable-argument parameters is less specific", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + } + }, + "12": { + "pos": { + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 11, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 11, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "prefer kotlin.Short to kotlin.Byte.", + "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.3.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types", + "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" + } + ], + "3": [ + { + "specVersion": "0.1-387", + "casesNumber": 11, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "infix call (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "call with explicit receiver", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with explicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "The candidate having any variable-argument parameters is less specific", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with implicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "call with implicit receiver: different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "call with explicit receiver (built-in integer types extesnsion): different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "4": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types", + "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" + } + ] + } + }, + "17": { + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ], + "3": [ + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "different built-in integer types and one of them is kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + } + ] + }, + "neg": { + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "If several properties are equally applicable, this is an overload ambiguity as usual", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "If several properties are equally applicable, this is an overload ambiguity as usual (both are parametrized)", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "9": { + "neg": { + "2": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "Neither of the two candidates is more applicable than the other and both are non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 2, + "description": "Neither of the two candidates is more applicable than the other and one is non-parameterized", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "8": { + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built", + "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.2.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 4, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types (Companion property-like callable)", + "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.4.kt", + "unexpectedBehaviour": false, + "linkType": "primary" + }, + { + "specVersion": "0.1-387", + "casesNumber": 3, + "description": "for every non-default argument of the call a type constraint is built unless both are built-in integer types", + "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" + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt new file mode 100644 index 00000000000..955187601be --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.fir.kt @@ -0,0 +1,85 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 { + fun List.foo(x: T): Unit = TODO() + fun List.foo(x: T): String = TODO() + + fun case(list: List, x: T) { + list.foo(x) + list.foo(x) + } + +} + +// TESTCASE NUMBER: 2 +class Case2 { + fun List.foo(x: Int?): Unit = TODO() + fun List.foo(x: Int): String = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun List.foo(x: Any): String = TODO() + + fun List.foo(x: T): Unit = TODO() + + fun case(list: List) { + list.foo('a') + list.foo('a') + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + fun List.foo(x: T, y: Any): Unit = TODO() + + fun List.foo(x: T, y: CharSequence): Unit = TODO() + + fun List.foo(x: T, y: String): String = TODO() + + fun case(list: List, x: Any) { + list.foo(x, "str") + list.foo(x, "str") + } +} + +// TESTCASE NUMBER: 5 +class Case5 { + class Child : Parent1, Parent2 + + interface Parent1 + interface Parent2 : Parent1 + + fun foo(x: Parent1) {} //(1) + fun foo(y: Parent2, z: String = "foo"): String = TODO() //2 + + fun testcase1() { + foo(Child()) + foo(Child()) + } +} +// TESTCASE NUMBER: 6 +class Case6 { + class Child : Parent1, Parent2 + + interface Parent1 + interface Parent2 : Parent1 + + fun foo(x: Parent1, z: String = "foo") {} //(1) + fun foo(y: Parent2): String = TODO() //2 + + fun testcase1() { + //foo(Child()) + foo(Child()) + foo(Child()) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt new file mode 100644 index 00000000000..abe6aa95f94 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt @@ -0,0 +1,93 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, rationale-1 -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The most specific callable can forward itself to any other callable from the overload candidate set, while the opposite is not true. + */ + +// TESTCASE NUMBER: 1 +class Case1 { + fun List.foo(x: T): Unit = TODO() + fun List.foo(x: T): String = TODO() + + fun case(list: List, x: T) { + list.foo(x) + list.foo(x) + } + +} + +// TESTCASE NUMBER: 2 +class Case2 { + fun List.foo(x: Int?): Unit = TODO() + fun List.foo(x: Int): String = TODO() + + fun case(list: List) { + list.foo(1) + list.foo(1) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun List.foo(x: Any): String = TODO() + + fun List.foo(x: T): Unit = TODO() + + fun case(list: List) { + list.foo('a') + list.foo('a') + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + fun List.foo(x: T, y: Any): Unit = TODO() + + fun List.foo(x: T, y: CharSequence): Unit = TODO() + + fun List.foo(x: T, y: String): String = TODO() + + fun case(list: List, x: Any) { + list.foo(x, "str") + list.foo(x, "str") + } +} + +// TESTCASE NUMBER: 5 +class Case5 { + class Child : Parent1, Parent2 + + interface Parent1 + interface Parent2 : Parent1 + + fun foo(x: Parent1) {} //(1) + fun foo(y: Parent2, z: String = "foo"): String = TODO() //2 + + fun testcase1() { + foo(Child()) + foo(Child()) + } +} +// TESTCASE NUMBER: 6 +class Case6 { + class Child : Parent1, Parent2 + + interface Parent1 + interface Parent2 : Parent1 + + fun foo(x: Parent1, z: String = "foo") {} //(1) + fun foo(y: Parent2): String = TODO() //2 + + fun testcase1() { + //foo(Child()) + foo(Child()) + foo(Child()) + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt new file mode 100644 index 00000000000..8e7c3855118 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.fir.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + + +// TESTCASE NUMBER: 1 +class Case1 { + fun List.foo(x: T?) {} + + fun List.foo(x: T) {} + + fun case(x: List, y: T) { + x.foo(y) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt new file mode 100644 index 00000000000..2e696743a09 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt @@ -0,0 +1,23 @@ +// !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-387 + * MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, rationale-1 -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If there are several functions with this property, none of them are the most specific and an overload resolution ambiguity error should be reported by the compiler + */ + +// TESTCASE NUMBER: 1 +class Case1 { + fun List.foo(x: T?) {} + + fun List.foo(x: T) {} + + fun case(x: List, y: T) { + x.foo(y) + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/testsMap.json new file mode 100644 index 00000000000..4dac7e615a0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/testsMap.json @@ -0,0 +1,30 @@ +{ + "3": { + "neg": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 1, + "description": "If there are several functions with this property, none of them are the most specific and an overload resolution ambiguity error should be reported by the compiler", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg/1.1.kt", + "unexpectedBehaviour": false, + "linkType": "main" + } + ] + } + }, + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-387", + "casesNumber": 6, + "description": "The most specific callable can forward itself to any other callable from the overload candidate set, while the opposite is not true.", + "path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.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 b4c297196ed..98227f4b6ea 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java @@ -25,7 +25,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInDiagnostics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "helpers", "linked/annotations", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/expressions/call-and-property-access-expressions", "linked/expressions/function-literals", "linked/inheritance", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/overloadable-operators", "linked/statements/assignments/simple-assignments", "linked/type-inference/local-type-inference", "linked/type-inference/smart-casts/smart-cast-types", "linked/type-system/subtyping", "linked/type-system/type-kinds/type-parameters"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "helpers", "linked/annotations", "linked/built-in-types-and-their-semantics", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/expressions/call-and-property-access-expressions", "linked/expressions/function-literals", "linked/inheritance", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/overloadable-operators", "linked/statements/assignments/simple-assignments", "linked/type-inference/local-type-inference", "linked/type-inference/smart-casts/smart-cast-types", "linked/type-system/subtyping", "linked/type-system/type-kinds/type-parameters"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @@ -37,7 +37,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "annotations", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "expressions/call-and-property-access-expressions", "expressions/function-literals", "inheritance", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "overloadable-operators", "statements/assignments/simple-assignments", "type-inference/local-type-inference", "type-inference/smart-casts/smart-cast-types", "type-system/subtyping", "type-system/type-kinds/type-parameters"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "annotations", "built-in-types-and-their-semantics", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "expressions/call-and-property-access-expressions", "expressions/function-literals", "inheritance", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "overloadable-operators", "statements/assignments/simple-assignments", "type-inference/local-type-inference", "type-inference/smart-casts/smart-cast-types", "type-system/subtyping", "type-system/type-kinds/type-parameters"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis") @@ -4211,6 +4211,426 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Choosing_the_most_specific_candidate_from_the_overload_candidate_set extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInChoosing_the_most_specific_candidate_from_the_overload_candidate_set() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Algorithm_of_msc_selection extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInAlgorithm_of_msc_selection() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_11 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_11() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt"); + } + + @TestMetadata("4.3.kt") + public void test4_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt"); + } + + @TestMetadata("4.4.kt") + public void test4_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt"); + } + + @TestMetadata("4.5.kt") + public void test4_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_12 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_12() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt"); + } + + @TestMetadata("2.4.kt") + public void test2_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt"); + } + + @TestMetadata("2.5.kt") + public void test2_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt"); + } + + @TestMetadata("2.6.kt") + public void test2_6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt"); + } + + @TestMetadata("2.7.kt") + public void test2_7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_14 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_14() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt"); + } + + @TestMetadata("1.6.kt") + public void test1_6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt"); + } + + @TestMetadata("1.7.kt") + public void test1_7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_17 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_17() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/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("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("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") + @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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_9 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_9() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/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("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Rationale_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInRationale_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 89711c0af14..68e46698c94 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 @@ -25,7 +25,7 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS } public void testAllFilesPresentInDiagnostics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "helpers", "linked/annotations", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/expressions/call-and-property-access-expressions", "linked/expressions/function-literals", "linked/inheritance", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/overloadable-operators", "linked/statements/assignments/simple-assignments", "linked/type-inference/local-type-inference", "linked/type-inference/smart-casts/smart-cast-types", "linked/type-system/subtyping", "linked/type-system/type-kinds/type-parameters"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "helpers", "linked/annotations", "linked/built-in-types-and-their-semantics", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/expressions/call-and-property-access-expressions", "linked/expressions/function-literals", "linked/inheritance", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/overloadable-operators", "linked/statements/assignments/simple-assignments", "linked/type-inference/local-type-inference", "linked/type-inference/smart-casts/smart-cast-types", "linked/type-system/subtyping", "linked/type-system/type-kinds/type-parameters"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @@ -37,7 +37,7 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "annotations", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "expressions/call-and-property-access-expressions", "expressions/function-literals", "inheritance", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "overloadable-operators", "statements/assignments/simple-assignments", "type-inference/local-type-inference", "type-inference/smart-casts/smart-cast-types", "type-system/subtyping", "type-system/type-kinds/type-parameters"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true, "annotations", "built-in-types-and-their-semantics", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "expressions/call-and-property-access-expressions", "expressions/function-literals", "inheritance", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "overloadable-operators", "statements/assignments/simple-assignments", "type-inference/local-type-inference", "type-inference/smart-casts/smart-cast-types", "type-system/subtyping", "type-system/type-kinds/type-parameters"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis") @@ -4211,6 +4211,426 @@ public class FirDiagnosticsTestSpecGenerated extends AbstractFirDiagnosticsTestS } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Choosing_the_most_specific_candidate_from_the_overload_candidate_set extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInChoosing_the_most_specific_candidate_from_the_overload_candidate_set() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Algorithm_of_msc_selection extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInAlgorithm_of_msc_selection() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_11 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_11() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/1.2.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.2.kt"); + } + + @TestMetadata("4.3.kt") + public void test4_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.3.kt"); + } + + @TestMetadata("4.4.kt") + public void test4_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.4.kt"); + } + + @TestMetadata("4.5.kt") + public void test4_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/4.5.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos/5.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-11/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_12 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_12() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.3.kt"); + } + + @TestMetadata("2.4.kt") + public void test2_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.4.kt"); + } + + @TestMetadata("2.5.kt") + public void test2_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.5.kt"); + } + + @TestMetadata("2.6.kt") + public void test2_6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.6.kt"); + } + + @TestMetadata("2.7.kt") + public void test2_7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos/2.7.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-12/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_14 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_14() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.5.kt"); + } + + @TestMetadata("1.6.kt") + public void test1_6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.6.kt"); + } + + @TestMetadata("1.7.kt") + public void test1_7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg/1.7.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-14/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_17 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_17() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/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("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg/2.2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-17/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("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") + @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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_9 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_9() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/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("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-9/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Rationale_1 extends AbstractFirDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInRationale_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/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/choosing-the-most-specific-candidate-from-the-overload-candidate-set/rationale-1/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/receivers") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java index ef756023560..7d66ac532ba 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -3535,6 +3535,68 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Choosing_the_most_specific_candidate_from_the_overload_candidate_set extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInChoosing_the_most_specific_candidate_from_the_overload_candidate_set() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Algorithm_of_msc_selection extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInAlgorithm_of_msc_selection() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractBlackBoxCodegenTestSpec { + 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/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + 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/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/receivers") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)