[Spec tests] Add tests to check overload resolution for implicitly imported infix functions

This commit is contained in:
anastasiia.spaseeva
2020-02-14 18:51:12 +03:00
committed by Victor Petukhov
parent 9711fda353
commit c9bb994fb5
12 changed files with 1011 additions and 0 deletions
@@ -0,0 +1,96 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Implicitly imported extension callable without infix modifier
*/
// FILE: Extensions.kt
package libPackage
class A() {
fun foo(x: Int) = "member fun foo"
}
// FILE: Extensions.kt
// TESTCASE NUMBER: 1, 2, 3, 4
package sentence3
import libPackage.A
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "pack scope extension fun foo"
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.A
class Case1() {
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "local extension fun foo"
fun case1() {
val a = A()
a <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
A() <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
}
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.A
interface Case2 {
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "local extension fun foo"
fun case2() {
val a = A()
a <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
A() <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
}
}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPack
import libPackage.A
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my package scope top level contains"
fun case3() {
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) ="my local scope contains"
val a = A()
a <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
A() <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackNew
import libPackage.A
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my package scope top level contains"
fun case4() {
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my local contains"
fun subfun() {
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my local contains"
val a = A()
a <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
A() <!INFIX_MODIFIER_REQUIRED!>foo<!> 1
}
}
@@ -0,0 +1,117 @@
// !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-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Local extension infix extension callables
*/
// FILE: Extensions.kt
package libPackage
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.contains
class Case1() {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local class scope contains")
return true
}
fun case1() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.contains
interface Case2 {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local interface scope contains")
return true
}
fun case2() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPack
import libPackage.contains
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case3() {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackNew
import libPackage.contains
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case4() {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
fun subfun() {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
}
@@ -0,0 +1,62 @@
// !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-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3
* NUMBER: 3
* DESCRIPTION: Explicitly imported infix extension callables
*/
// FILE: Extensions.kt
package libPackage
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.contains
fun case1() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.contains
fun case2() {
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
@@ -0,0 +1,58 @@
// !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-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
* NUMBER: 4
* DESCRIPTION: Star-imported infix extension callables
*/
// FILE: Extensions.kt
package libPackage
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.*
fun case1() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package testPack
import libPackage.*
operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case2() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
@@ -0,0 +1,33 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5
* NUMBER: 5
* DESCRIPTION: Star-imported extension callable only
*/
// FILE: Extensions.kt
package libPackage
private infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: TestCase2.kt
package sentence3
import libPackage.* //nothing to import, extension is private
// TESTCASE NUMBER: 1
fun case1() {
val regex = Regex("")
"" <!INFIX_MODIFIER_REQUIRED!>contains<!> regex
}
@@ -0,0 +1,122 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Local extension infix extension callables
*/
// TESTCASE NUMBER: 0, 1, 2, 3, 4
// FILE: Extensions.kt
package libPackage
class A() {
infix fun foo(x: Int) = "member fun foo"
}
// FILE: Extensions.kt
// TESTCASE NUMBER: 0
package sentence3
import libPackage.A
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "pack scope extension fun foo"
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.A
class Case1() {
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "local extension fun foo"
fun case1() {
val a = A()
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>a foo 1<!>
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>A() foo 1<!>
}
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.A
interface Case2 {
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "local extension fun foo"
fun case2() {
val a = A()
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>a foo 1<!>
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>A() foo 1<!>
}
}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPack
import libPackage.A
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my package scope top level contains"
fun case3() {
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my local scope contains"
val a = A()
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>a foo 1<!>
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>A() foo 1<!>
}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackNew
import libPackage.A
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my package scope top level contains"
fun case4() {
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my local contains"
fun subfun() {
infix fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>(x: Int) = "my local contains"
val a = A()
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>a foo 1<!>
<!DEBUG_INFO_CALL("fqName: libPackage.A.foo; typeCall: infix function")!>A() foo 1<!>
}
}
// FILE: TestCase5.kt
// TESTCASE NUMBER: 5
package testPackNew
class A() {
fun foo(i: Int) {}
infix fun A.foo(i: Int) {}
fun bar(a: A) {
//todo: add info if function is infix one
<!DEBUG_INFO_CALL("fqName: testPackNew.A.foo; typeCall: infix extension function")!>a foo 1<!>
}
fun buz(a: A){
fun foo(i: Int) {}
//todo: add info if function is infix one
<!DEBUG_INFO_CALL("fqName: testPackNew.A.foo; typeCall: infix extension function")!>a foo 1<!>
}
fun boo(a: A){
infix fun A.foo(i: Int) {}
<!DEBUG_INFO_CALL("fqName: testPackNew.A.boo.foo; typeCall: infix extension function")!>a foo 1<!>
}
}
@@ -0,0 +1,117 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
*
* NUMBER: 2
* DESCRIPTION: Local extension infix extension callables
*/
// FILE: Extensions.kt
package libPackage
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.contains
class Case1() {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local class scope contains")
return true
}
fun case1() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: sentence3.Case1.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.contains
interface Case2 {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local interface scope contains")
return true
}
fun case2() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: sentence3.Case2.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPack
import libPackage.contains
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case3() {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: testPack.case3.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackNew
import libPackage.contains
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case4() {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
fun subfun() {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: testPackNew.case4.subfun.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
}
@@ -0,0 +1,61 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3
*
* NUMBER: 3
* DESCRIPTION: Explicitly imported infix extension callables
*/
// FILE: Extensions.kt
package libPackage
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.contains
fun case1() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: libPackage.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package sentence3
import libPackage.contains
fun case2() {
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my local contains")
return true
}
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: sentence3.case2.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
@@ -0,0 +1,59 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
*
* NUMBER: 4
* DESCRIPTION: Star-imported infix extension callables
*/
// FILE: Extensions.kt
package libPackage
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: Extensions.kt
package sentence3
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.*
fun case1() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: sentence3.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package testPack
import libPackage.*
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my package scope top level contains")
return true
}
fun case2() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: testPack.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
@@ -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-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5
*
* NUMBER: 5
* DESCRIPTION: Star-imported infix extension callables
*/
// FILE: Extensions.kt
package libPackage
infix operator fun CharSequence.contains(regex: Regex): Boolean {
println("my contains")
return true
}
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package sentence3
import libPackage.*
fun case1() {
val regex = Regex("")
<!DEBUG_INFO_CALL("fqName: libPackage.contains; typeCall: infix operator extension function")!>"" contains regex<!>
}
@@ -0,0 +1,148 @@
{
"2": {
"neg": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Local extension infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported extension callable only",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/3.5.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Explicitly imported infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Star-imported infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Star-imported infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Implicitly imported extension callable without infix modifier",
"unexpectedBehaviour": false
}
],
"2": [
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Local extension infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Explicitly imported infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Implicitly imported extension callable without infix modifier",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt",
"unexpectedBehaviour": false
}
],
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported extension callable only",
"unexpectedBehaviour": false
}
]
},
"pos": {
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Star-imported infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 6,
"description": "Local extension infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Local extension infix extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Explicitly imported infix extension callables",
"unexpectedBehaviour": false
}
],
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Star-imported infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.4.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.5.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 6,
"description": "Local extension infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Local extension infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.2.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
"description": "Explicitly imported infix extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.3.kt",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -3503,6 +3503,108 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Infix_function_call extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInInfix_function_call() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/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/building-the-overload-candidate-set-ocs/infix-function-call/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/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/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.kt");
}
@TestMetadata("1.2.kt")
public void test1_2() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.kt");
}
@TestMetadata("1.3.kt")
public void test1_3() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.kt");
}
@TestMetadata("1.4.kt")
public void test1_4() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.kt");
}
@TestMetadata("3.5.kt")
public void test3_5() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/3.5.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/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("3.1.kt")
public void test3_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.1.kt");
}
@TestMetadata("3.2.kt")
public void test3_2() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.2.kt");
}
@TestMetadata("3.3.kt")
public void test3_3() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.3.kt");
}
@TestMetadata("3.4.kt")
public void test3_4() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.4.kt");
}
@TestMetadata("3.5.kt")
public void test3_5() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/3.5.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention")