From 5c7c4b4cb6e6af142ace9494095aa07ed4fc9406 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Thu, 16 Apr 2020 13:07:35 +0300 Subject: [PATCH] FIR: Adjust testData for spec tests: infix priority ^KT-37374 Please, fix the tests --- .../p-1/pos/2.17.fir.kt | 123 ++++++++++++++++++ .../infix-function-call/p-2/neg/1.1.fir.kt | 96 ++++++++++++++ .../infix-function-call/p-2/neg/1.2.fir.kt | 117 +++++++++++++++++ .../infix-function-call/p-2/neg/1.3.fir.kt | 61 +++++++++ .../infix-function-call/p-2/neg/1.4.fir.kt | 58 +++++++++ .../infix-function-call/p-2/neg/4.5.fir.kt | 33 +++++ .../infix-function-call/p-2/pos/4.1.fir.kt | 122 +++++++++++++++++ .../infix-function-call/p-2/pos/4.3.fir.kt | 60 +++++++++ 8 files changed, 670 insertions(+) create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt new file mode 100644 index 00000000000..5b38df53f08 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.17.fir.kt @@ -0,0 +1,123 @@ +// !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-300 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, call-with-trailing-lambda-expressions -> paragraph 1 -> sentence 2 + * 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: 17 + * DESCRIPTION: Infix fun: 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.foo(x: ()->Int) = "pack scope extension fun foo" + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 + +package sentence3 +import libPackage.A + +class Case1() { + infix fun A.foo(x: ()->Int) = "local extension fun foo" + + fun case1() { + val a = A() + a foo {1} + A() foo {1} + } +} +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 + +package sentence3 +import libPackage.A + +interface Case2 { + infix fun A.foo(x: ()->Int) = "local extension fun foo" + + fun case2() { + val a = A() + a foo {1} + A() foo {1} + } +} + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testPack +import libPackage.A + +infix fun A.foo(x: ()->Int) = "my package scope top level trim" + + +fun case3() { + infix fun A.foo(x: ()->Int) = "my local scope trim" + + val a = A() + a foo {1} + A() foo {1} +} + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackNew +import libPackage.A + +infix fun A.foo(x: ()->Int) = "my package scope top level trim" + + +fun case4() { + + infix fun A.foo(x: ()->Int) = "my local trim" + + fun subfun() { + infix fun A.foo(x: ()->Int) = "my local trim" + val a = A() + a foo {1} + 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 + a foo {1} + } + + fun buz(a: A) { + fun foo(i: ()->Int) {} + //todo: add info if function is infix one + a foo {1} + } + + fun boo(a: A) { + infix fun A.foo(i: ()->Int) {} + a foo {1} + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt new file mode 100644 index 00000000000..ef84dfc96f4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.1.fir.kt @@ -0,0 +1,96 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -EXTENSION_SHADOWED_BY_MEMBER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * 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.foo(x: Int) = "pack scope extension fun foo" + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 + +package sentence3 +import libPackage.A + +class Case1() { + fun A.foo(x: Int) = "local extension fun foo" + + fun case1() { + val a = A() + a foo 1 + A() foo 1 + } +} +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 + +package sentence3 +import libPackage.A + +interface Case2 { + fun A.foo(x: Int) = "local extension fun foo" + + fun case2() { + val a = A() + a foo 1 + A() foo 1 + } +} + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testPack +import libPackage.A + +fun A.foo(x: Int) = "my package scope top level contains" + + +fun case3() { + fun A.foo(x: Int) ="my local scope contains" + + val a = A() + a foo 1 + A() foo 1 +} + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackNew +import libPackage.A + +fun A.foo(x: Int) = "my package scope top level contains" + + +fun case4() { + + fun A.foo(x: Int) = "my local contains" + + fun subfun() { + fun A.foo(x: Int) = "my local contains" + val a = A() + a foo 1 + A() foo 1 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt new file mode 100644 index 00000000000..d2443c82372 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.2.fir.kt @@ -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-313 + * 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("") + "" 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("") + "" 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("") + "" 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("") + "" contains regex + + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt new file mode 100644 index 00000000000..b384e35de99 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.3.fir.kt @@ -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 (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * 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("") + "" 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("") + "" contains regex +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt new file mode 100644 index 00000000000..04d0c971fab --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/1.4.fir.kt @@ -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-313 + * 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("") + "" 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("") + "" contains regex +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt new file mode 100644 index 00000000000..cc560249e4e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/neg/4.5.fir.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-313 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 4 + * 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("") + "" contains regex +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt new file mode 100644 index 00000000000..6d91d922633 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.1.fir.kt @@ -0,0 +1,122 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 4 + * 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.foo(x: Int) = "pack scope extension fun foo" + +// FILE: TestCase1.kt +// TESTCASE NUMBER: 1 + +package sentence3 +import libPackage.A + +class Case1() { + infix fun A.foo(x: Int) = "local extension fun foo" + + fun case1() { + val a = A() + a foo 1 + A() foo 1 + } +} +// FILE: TestCase2.kt +// TESTCASE NUMBER: 2 + +package sentence3 +import libPackage.A + +interface Case2 { + infix fun A.foo(x: Int) = "local extension fun foo" + + fun case2() { + val a = A() + a foo 1 + A() foo 1 + } +} + +// FILE: TestCase3.kt +// TESTCASE NUMBER: 3 +package testPack +import libPackage.A + +infix fun A.foo(x: Int) = "my package scope top level contains" + + +fun case3() { + infix fun A.foo(x: Int) = "my local scope contains" + + val a = A() + a foo 1 + A() foo 1 +} + +// FILE: TestCase4.kt +// TESTCASE NUMBER: 4 +package testPackNew +import libPackage.A + +infix fun A.foo(x: Int) = "my package scope top level contains" + + +fun case4() { + + infix fun A.foo(x: Int) = "my local contains" + + fun subfun() { + infix fun A.foo(x: Int) = "my local contains" + val a = A() + a foo 1 + 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 + a foo 1 + } + + fun buz(a: A){ + fun foo(i: Int) {} + //todo: add info if function is infix one + a foo 1 + } + + fun boo(a: A){ + infix fun A.foo(i: Int) {} + a foo 1 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.kt new file mode 100644 index 00000000000..3577a6d1824 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call/p-2/pos/4.3.fir.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 (POSITIVE) + * + * SPEC VERSION: 0.1-313 + * PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 2 -> sentence 4 + * 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("") + "" 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("") + "" contains regex +}