[Spec tests] Add tests for overload-resolution, building-the-overload-candidate-set-ocs, operator-call:

-properties available through the invoke convention are non-eligible for operator calls
  -smart casts and overload-resolution
  -candidate sets
This commit is contained in:
anastasiia.spaseeva
2020-02-19 19:15:58 +03:00
committed by Victor Petukhov
parent 4301744d2d
commit 35de6a3f6e
27 changed files with 2803 additions and 74 deletions
@@ -0,0 +1,86 @@
{
"6": {
"pos": {
"4": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Extension callables, declared in the package scope, for for-loop operator iterator call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.4.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Star-imported extension callables for for-loop operator iterator call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.5.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Extension callables, declared in the package scope, for delegated properties call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.9.kt",
"unexpectedBehaviour": false
}
],
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Non-extension member callables for for-loop operator iterator call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Non-extension member callables for delegated properties call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.6.kt",
"unexpectedBehaviour": false
}
],
"5": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Star-imported extension callables for delegated properties call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.10.kt",
"unexpectedBehaviour": false
}
],
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Explicitly imported extension callables for delegated properties call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.8.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Explicitly imported extension callables for for-loop operator iterator call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.3.kt",
"unexpectedBehaviour": false
}
],
"2": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Local extension callables for for-loop operator iterator call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "local extension callables for delegated properties call",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.7.kt",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -0,0 +1,75 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Non-extension member callables for for-loop operator iterator call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var flag = false
class MyIterator(shouldBeCalled: Boolean = false) : CharIterator() {
init {
flag = shouldBeCalled
}
private var index = 0
override fun nextChar(): Char { index++; return 'd'}
override fun hasNext(): Boolean = index < 5
}
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.iterator
import libPackage1.invoke
import libPackage2.*
class Iterable(iterator: Inv) {
operator fun iterator(): CharIterator = MyIterator(true)
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = MyIterator()
}
operator fun Iterable.iterator(): CharIterator = MyIterator()
fun box(): String {
operator fun Iterable.iterator(): CharIterator = MyIterator()
for (i in Iterable(Inv('c'))) {
println(i)
}
return if (flag)
"OK"
else "NOK"
}
@@ -0,0 +1,71 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 10
* DESCRIPTION: Star-imported extension callables for delegated properties call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var isGetCalled = false
var isSetCalled = false
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
isGetCalled = true
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
isSetCalled = true
}
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
//import libPackage1.getValue
//import libPackage1.setValue
import libPackage2.*
import kotlin.reflect.KProperty
class Delegate {}
fun box() : String {
class Test {
var p: String by Delegate()
}
val test = Test()
assert(!isGetCalled && !isSetCalled)
test.p = "NEW"
if (isSetCalled && !isGetCalled) {
isSetCalled = false
val x = test.p
if (!isSetCalled && isGetCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,75 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Local extension callables for for-loop operator iterator call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var flag = false
class MyIterator(shouldBeCalled: Boolean = false) : CharIterator() {
init {
flag = shouldBeCalled
}
private var index = 0
override fun nextChar(): Char { index++; return 'd'}
override fun hasNext(): Boolean = index < 5
}
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.iterator
import libPackage1.invoke
import libPackage2.*
class Iterable(iterator: Inv) {
/*operator fun iterator(): CharIterator = MyIterator()*/
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = MyIterator()
}
operator fun Iterable.iterator(): CharIterator = MyIterator()
fun box(): String {
operator fun Iterable.iterator(): CharIterator = MyIterator(true)
for (i in Iterable(Inv('c'))) {
println(i)
}
return if (flag)
"OK"
else "NOK"
}
@@ -0,0 +1,75 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 3
* DESCRIPTION: Explicitly imported extension callables for for-loop operator iterator call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var flag = false
class MyIterator(shouldBeCalled: Boolean = false) : CharIterator() {
init {
flag = shouldBeCalled
}
private var index = 0
override fun nextChar(): Char { index++; return 'd'}
override fun hasNext(): Boolean = index < 5
}
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator(true)
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.iterator
import libPackage1.invoke
import libPackage2.*
class Iterable(iterator: Inv) {
/*operator fun iterator(): CharIterator = MyIterator()*/
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = MyIterator()
}
operator fun Iterable.iterator(): CharIterator = MyIterator()
fun box(): String {
/*operator fun Iterable.iterator(): CharIterator = MyIterator()*/
for (i in Iterable(Inv('c'))) {
println(i)
}
return if (flag)
"OK"
else "NOK"
}
@@ -0,0 +1,75 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 4
* DESCRIPTION: Extension callables, declared in the package scope, for for-loop operator iterator call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var flag = false
class MyIterator(shouldBeCalled: Boolean = false) : CharIterator() {
init {
flag = shouldBeCalled
}
private var index = 0
override fun nextChar(): Char { index++; return 'd'}
override fun hasNext(): Boolean = index < 5
}
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator(true)
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator()
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
/*import libPackage1.iterator
import libPackage1.invoke*/
import libPackage2.*
class Iterable(iterator: Inv) {
/*operator fun iterator(): CharIterator = MyIterator()*/
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = MyIterator()
}
operator fun Iterable.iterator(): CharIterator = MyIterator(true)
fun box(): String {
/*operator fun Iterable.iterator(): CharIterator = MyIterator()*/
for (i in Iterable(Inv('c'))) {
println(i)
}
return if (flag)
"OK"
else "NOK"
}
@@ -0,0 +1,77 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 5
* DESCRIPTION: Star-imported extension callables for for-loop operator iterator call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var flag = false
class MyIterator(shouldBeCalled: Boolean = false) : CharIterator() {
init {
flag = shouldBeCalled
}
private var index = 0
override fun nextChar(): Char { index++; return 'd'}
override fun hasNext(): Boolean = index < 5
}
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator(true)
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Iterable
import testPack.Inv
operator fun Iterable.iterator() : CharIterator = MyIterator(true)
operator fun Inv.invoke() : CharIterator = MyIterator()
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
/*import libPackage1.iterator
import libPackage1.invoke*/
import libPackage2.*
class Iterable(iterator: Inv) {
/*operator fun iterator(): CharIterator = MyIterator()*/
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = MyIterator()
}
/*
operator fun Iterable.iterator(): CharIterator = MyIterator(true)
*/
fun box(): String {
/*operator fun Iterable.iterator(): CharIterator = MyIterator()*/
for (i in Iterable(Inv('c'))) {
println(i)
}
return if (flag)
"OK"
else "NOK"
}
@@ -0,0 +1,84 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 6
* DESCRIPTION: Non-extension member callables for delegated properties call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var isGetCalled = false
var isSetCalled = false
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.getValue
import libPackage1.setValue
import libPackage2.*
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
isGetCalled = true
return ""
}
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
isSetCalled = true
}
}
class Test {
var p: String by Delegate()
}
fun box() : String {
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
val test = Test()
assert(!isGetCalled && !isSetCalled)
test.p = "NEW"
if (isSetCalled && !isGetCalled) {
isSetCalled = false
val x = test.p
if (!isSetCalled && isGetCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,81 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 7
* DESCRIPTION: local extension callables for delegated properties call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var isGetCalled = false
var isSetCalled = false
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.getValue
import libPackage1.setValue
import libPackage2.*
import kotlin.reflect.KProperty
class Delegate {}
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
fun box() : String {
class Test {
var p: String by Delegate()
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
isGetCalled = true
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
isSetCalled = true
}
}
val test = Test()
assert(!isGetCalled && !isSetCalled)
test.p = "NEW"
if (isSetCalled && !isGetCalled) {
isSetCalled = false
val x = test.p
if (!isSetCalled && isGetCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,77 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 8
* DESCRIPTION: Explicitly imported extension callables for delegated properties call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var isGetCalled = false
var isSetCalled = false
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
isGetCalled = true
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
isSetCalled = true
}
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
import libPackage1.getValue
import libPackage1.setValue
import libPackage2.*
import kotlin.reflect.KProperty
class Delegate {}
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
}
fun box() : String {
class Test {
var p: String by Delegate()
}
val test = Test()
assert(!isGetCalled && !isSetCalled)
test.p = "NEW"
if (isSetCalled && !isGetCalled) {
isSetCalled = false
val x = test.p
if (!isSetCalled && isGetCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,76 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 3 -> sentence 1
* NUMBER: 9
* DESCRIPTION: Extension callables, declared in the package scope, for delegated properties call
*/
// FILE: LibMyIterator.kt
package libMyIteratorPackage
var isGetCalled = false
var isSetCalled = false
// FILE: Lib1.kt
package libPackage1
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Lib2.kt
package libPackage2
import libMyIteratorPackage.*
import testPack.Delegate
import kotlin.reflect.KProperty
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
// FILE: Test.kt
package testPack
import libMyIteratorPackage.*
//import libPackage1.getValue
//import libPackage1.setValue
import libPackage2.*
import kotlin.reflect.KProperty
class Delegate {}
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
isGetCalled = true
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
isSetCalled = true
}
fun box() : String {
class Test {
var p: String by Delegate()
}
val test = Test()
assert(!isGetCalled && !isSetCalled)
test.p = "NEW"
if (isSetCalled && !isGetCalled) {
isSetCalled = false
val x = test.p
if (!isSetCalled && isGetCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,68 @@
{
"2": {
"pos": {
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Extension callables, declared in the package scope, for for-loop operator iterator call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Star-imported extension callables for for-loop operator iterator call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Non-extension member callables for for-loop operator iterator call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Star-imported extension callables for delegated properties call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Explicitly imported extension callables for delegated properties call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Extension callables, declared in the package scope, for delegated properties call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Non-extension member callables for delegated properties call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Local extension callables for for-loop operator iterator call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "Explicitly imported extension callables for for-loop operator iterator call",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "local extension callables for delegated properties call",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -1,7 +1,123 @@
{
"1": {
"pos": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "smart cast for the property available through the operator invoke",
"path": "compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.kt",
"unexpectedBehaviour": true
}
]
}
},
"6": {
"pos": {
"4": [
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Extension callables declared in the package scope",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.4.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of explicitly imported, declared in the package scope and star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 6,
"description": "sets of extension callables declared in the package scope",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
}
],
"5": [
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "Star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.5.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.6.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "set of star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of declared in the package scope and star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt",
"unexpectedBehaviour": false
}
],
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 10,
"description": "Non-extension member callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "set of non-extension member callables only",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "The sets of non-extension member callables named f of type T;",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 5,
"description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of non-extension member callables only",
"unexpectedBehaviour": false
}
],
"2": [
{
"specVersion": "0.1-268",
"casesNumber": 5,
"description": "Non-extension member callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.kt",
"unexpectedBehaviour": true
},
{
"specVersion": "0.1-268",
"casesNumber": 2,
@@ -48,39 +164,14 @@
"unexpectedBehaviour": true
}
],
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "set of non-extension member callables only",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "The sets of non-extension member callables named f of type T;",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 5,
"description": "sets of non-extension member callables, local, explicitly imported, declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of non-extension member callables only",
"unexpectedBehaviour": false
}
],
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Explicitly imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.3.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
@@ -95,42 +186,6 @@
"unexpectedBehaviour": false
}
],
"4": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of explicitly imported, declared in the package scope and star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 6,
"description": "sets of extension callables declared in the package scope",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of declared in the package scope and star-imported extension callables",
"unexpectedBehaviour": false
}
],
"5": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "set of star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "sets of declared in the package scope and star-imported extension callables",
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver/p-6/pos/4.2.kt",
"unexpectedBehaviour": false
}
],
"6": [
{
"specVersion": "0.1-268",
@@ -0,0 +1,240 @@
// !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, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Non-extension member callables
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1, 2
package libPackage
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
import kotlin.reflect.KProperty
operator fun Case.E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Inv()
operator fun Case.Inv.<!EXTENSION_SHADOWED_BY_MEMBER!>invoke<!>(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1, 2
package testPackCase1
import libPackage.plus
import libPackage.*
import libPackage.invoke
class Case() {
class E(val plus: Inv? = null) {
operator fun plus(value: Int) = Case()
}
class Inv() {
operator fun invoke(value: Int) = Case()
}
fun foo(e: E) {
operator fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.E.plus; typeCall: operator function")!>e+1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.E.plus; typeCall: operator function")!>e+1<!>
e.<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.E.plus; typeCall: operator function")!>plus(1)<!>
e.plus?.<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.Inv.invoke; typeCall: operator function")!>invoke(1)<!> //ok
}
}
// FILE: LibCase3.kt
// TESTCASE NUMBER: 3, 4
package libPackage
import testPackCase3.Case
import testPackCase3.Case.Inv
import testPackCase3.Case.E
operator fun Case.E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Inv()
operator fun Case.Inv.<!EXTENSION_SHADOWED_BY_MEMBER!>invoke<!>(i: Int) = 1
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3, 4
package testPackCase3
import libPackage.plus
import libPackage.*
import libPackage.invoke
class Case() {
class E(val plus: Inv? = null) {
operator fun plus(value: Int) = Case()
}
class Inv() {
operator fun invoke(value: Int) = Case()
}
fun foo(e: E) {
operator fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
operator fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.E.plus; typeCall: operator function")!>e+1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.E.plus; typeCall: operator function")!>e+1<!>
}
fun boo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.E.plus; typeCall: operator function")!>e+1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.E.plus; typeCall: operator function")!>e+1<!>
}
}
// FILE: LibCase5.kt
// TESTCASE NUMBER: 5, 6
package libPackage
import testPackCase5.Case
import testPackCase5.Case.Inv
import testPackCase5.Case.E
operator fun Case.E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
operator fun Case.Inv.<!EXTENSION_SHADOWED_BY_MEMBER!>invoke<!>(i: Int) {}
// FILE: TestCase6.kt
// TESTCASE NUMBER: 5, 6
package testPackCase5
import libPackage.plusAssign
import libPackage.*
import libPackage.invoke
class Case() {
class E(val plusAssign: Inv? = null) {
operator fun plusAssign(value: Int) {}
}
class Inv() {
operator fun invoke(value: Int) {}
}
fun foo(e: E) {
operator fun Case.E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
<!DEBUG_INFO_CALL("fqName: testPackCase5.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase5.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
e.<!DEBUG_INFO_CALL("fqName: testPackCase5.Case.E.plusAssign; typeCall: operator function")!>plusAssign(1)<!>
e.plusAssign?.<!DEBUG_INFO_CALL("fqName: testPackCase5.Case.Inv.invoke; typeCall: operator function")!>invoke(1)<!> //ok
}
}
// FILE: LibCase7.kt
// TESTCASE NUMBER: 7, 8
package libPackage
import testPackCase8.Case
import testPackCase8.Case.Inv
import testPackCase8.Case.E
operator fun Case.E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
operator fun Case.Inv.<!EXTENSION_SHADOWED_BY_MEMBER!>invoke<!>(i: Int) {}
// FILE: TestCase8.kt
// TESTCASE NUMBER: 7, 8
package testPackCase8
import libPackage.plusAssign
import libPackage.*
import libPackage.invoke
class Case() {
class E(val plusAssign: Inv? = null) {
operator fun plusAssign(value: Int) {}
}
class Inv() {
operator fun invoke(value: Int) {}
}
fun foo(e: E) {
operator fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
operator fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
<!DEBUG_INFO_CALL("fqName: testPackCase8.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase8.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
}
fun boo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
<!DEBUG_INFO_CALL("fqName: testPackCase8.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase8.Case.E.plusAssign; typeCall: operator function")!>e+=1<!>
}
}
// FILE: LibCase9.kt
// TESTCASE NUMBER: 9, 10
package libPackage
import testPackCase10.Iterable
import testPackCase10.Inv
operator fun Iterable.<!EXTENSION_SHADOWED_BY_MEMBER!>iterator<!>() : CharIterator = TODO()
operator fun Inv.<!EXTENSION_SHADOWED_BY_MEMBER!>invoke<!>() {}
// FILE: TestCase10.kt
// TESTCASE NUMBER: 9, 10
package testPackCase10
import libPackage.iterator
import libPackage.invoke
class Iterable(iterator: Inv) {
operator fun iterator() : CharIterator = TODO()
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = TODO()
}
operator fun Iterable.<!EXTENSION_SHADOWED_BY_MEMBER!>iterator<!>() : CharIterator = TODO()
fun case(){
operator fun Iterable.<!EXTENSION_SHADOWED_BY_MEMBER!>iterator<!>() : CharIterator = TODO()
val iterable: Iterable = Iterable(Inv('c'))
fun foo(){
iterable.<!DEBUG_INFO_CALL("fqName: testPackCase10.Iterable.iterator; typeCall: operator function")!>iterator()<!>
for (i in iterable) {
println(i)
}
}
iterable.<!DEBUG_INFO_CALL("fqName: testPackCase10.Iterable.iterator; typeCall: operator function")!>iterator()<!>
for (i in iterable) {
println(i)
}
}
@@ -0,0 +1,217 @@
// !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, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 2
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Non-extension member callables
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
import kotlin.reflect.KProperty
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testPackCase1
import libPackage.plus
import libPackage.*
import libPackage.invoke
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
operator fun E.plus(value: Int) = Case()
run {
<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.foo.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase1.Case.foo.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: LibCase1.kt
// TESTCASE NUMBER: 2
package libPackage
import testPackCase2.Case
import testPackCase2.Case.Inv
import testPackCase2.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 2
package testPackCase2
import libPackage.plus
import libPackage.*
import libPackage.invoke
operator fun Case.E.plus(value: Int) = Case()
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
operator fun E.plus(value: Int) = Case()
run {
operator fun E.plus(value: Int) = Case()
<!DEBUG_INFO_CALL("fqName: testPackCase2.Case.foo.<anonymous>.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase2.Case.foo.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: LibCase3.kt
// TESTCASE NUMBER: 3
package libPackage
import testPackCase3.Case
import testPackCase3.Case.Inv
import testPackCase3.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPackCase3
import libPackage.plusAssign
import libPackage.invoke
import libPackage.*
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
operator fun E.plusAssign(value: Int) {}
run {
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.foo.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase3.Case.foo.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
// FILE: LibCase4.kt
// TESTCASE NUMBER: 4
package libPackage
import testPackCase4.Case
import testPackCase4.Case.Inv
import testPackCase4.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackCase4
import libPackage.plusAssign
import libPackage.*
import libPackage.invoke
operator fun Case.E.plusAssign(value: Int) {}
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
operator fun E.plusAssign(value: Int) {}
run {
operator fun E.plusAssign(value: Int) {}
<!DEBUG_INFO_CALL("fqName: testPackCase4.Case.foo.<anonymous>.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase4.Case.foo.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
// FILE: TestCase5.kt
/*
* TESTCASE NUMBER: 5
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36996
*/
package testPackCase5
import kotlin.reflect.KProperty
class Delegate {
/*operator*/ fun getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
/*operator*/ fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
}
}
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {}
fun case() {
class Test {
var p: String <!OPERATOR_MODIFIER_REQUIRED, OPERATOR_MODIFIER_REQUIRED!>by<!> Delegate()
operator fun Delegate.getValue(thisRef: Any?, property: KProperty<*>): String {
return ""
}
operator fun Delegate.setValue(thisRef: Any?, property: KProperty<*>, value: String) {
}
}
val test = Test()
test.p = "NEW"
val x = test.p
}
@@ -0,0 +1,193 @@
// !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, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 3
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 3
* DESCRIPTION: Explicitly imported extension callables
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage1
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage2
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testPackCase1
import libPackage1.plus
import libPackage1.invoke
import libPackage2.*
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
<!DEBUG_INFO_CALL("fqName: libPackage1.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage1.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: LibCase2.kt
// TESTCASE NUMBER: 2
package libPackage1
import testPackCase2.Case
import testPackCase2.Case.Inv
import testPackCase2.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: LibCase2.kt
// TESTCASE NUMBER: 2
package libPackage2
import testPackCase2.Case
import testPackCase2.Case.Inv
import testPackCase2.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase2.kt
// TESTCASE NUMBER: 2
package testPackCase2
import libPackage1.plus
import libPackage1.invoke
import libPackage2.*
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
<!DEBUG_INFO_CALL("fqName: libPackage1.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage1.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: LibCase3.kt
// TESTCASE NUMBER: 3
package libPackage
import testPackCase3.Case
import testPackCase3.Case.Inv
import testPackCase3.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPackCase3
import libPackage.plusAssign
import libPackage.invoke
import libPackage.*
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
// FILE: LibCase4.kt
// TESTCASE NUMBER: 4
package libPackage
import testPackCase4.Case
import testPackCase4.Case.Inv
import testPackCase4.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackCase4
import libPackage.plusAssign
import libPackage.*
import libPackage.invoke
operator fun Case.E.plusAssign(value: Int) {}
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
@@ -0,0 +1,194 @@
// !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, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 4
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 4
* DESCRIPTION: Extension callables declared in the package scope
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
operator fun Case.E.plus(value: Int) = Case().Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testPackCase1
import libPackage.*
operator fun Case.E.plus(value: Int) = Case().Inv()
operator fun Case.Inv.invoke(i: Int) = 1
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
inner class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
<!DEBUG_INFO_CALL("fqName: testPackCase1.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase1.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: Lib1.kt
// TESTCASE NUMBER: 2
package libPackage1
import testPackCase2.Case
import testPackCase2.Case.Inv
import testPackCase2.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: Lib2.kt
// TESTCASE NUMBER: 2
package testPackCase2
import testPackCase2.Case
import testPackCase2.Case.Inv
import testPackCase2.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 2
package testPackCase2
import libPackage1.*
class Case() {
operator fun plus(value: Int) = Case()
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
<!DEBUG_INFO_CALL("fqName: testPackCase2.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase2.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: LibCase3.kt
// TESTCASE NUMBER: 3
package libPackage
import testPackCase3.Case
import testPackCase3.Case.Inv
import testPackCase3.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 3
package testPackCase3
import libPackage.*
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
inner class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
<!DEBUG_INFO_CALL("fqName: testPackCase3.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase3.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
// FILE: Lib1.kt
// TESTCASE NUMBER: 4
package libPackage1
import testPackCase4.Case
import testPackCase4.Case.Inv
import testPackCase4.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: Lib2.kt
// TESTCASE NUMBER: 4
package testPackCase4
import testPackCase4.Case
import testPackCase4.Case.Inv
import testPackCase4.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testPackCase4
import libPackage1.*
class Case() {
operator fun plusAssign(value: Int) {}
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
<!DEBUG_INFO_CALL("fqName: testPackCase4.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: testPackCase4.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
@@ -0,0 +1,103 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 5
* DESCRIPTION: Star-imported extension callables
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage
import testPackCase1.Case
import testPackCase1.Case.Inv
import testPackCase1.Case.E
operator fun Case.E.plus(value: Int) = Inv()
operator fun Case.Inv.invoke(i: Int) = 1
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testPackCase1
import libPackage.*
class Case() {
class E(val plus: Inv? = null) {
/*operator*/ fun plus(value: Int) = Case()
}
class Inv() {
/*operator*/ fun invoke(value: Int) = Case()
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plus<!>(value: Int) = Case()
run {
<!DEBUG_INFO_CALL("fqName: libPackage.plus; typeCall: operator extension function")!>e + 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage.plus; typeCall: operator extension function")!>e + 1<!>
}
}
// FILE: Lib1.kt
// TESTCASE NUMBER: 2
package libPackage1
public <!NOTHING_TO_INLINE!>inline<!> operator fun CharSequence.contains(regex: Regex): Boolean = regex.containsMatchIn(this)
// FILE: TestCase1.kt
// TESTCASE NUMBER: 2
package testPackCase2
import libPackage1.*
class Case() {
fun foo() {
"".<!DEBUG_INFO_CALL("fqName: libPackage1.contains; typeCall: inline operator extension function")!>contains(Regex(""))<!>
}
}
// FILE: LibCase3.kt
// TESTCASE NUMBER: 3
package libPackage
import testPackCase3.Case
import testPackCase3.Case.Inv
import testPackCase3.Case.E
operator fun Case.E.plusAssign(value: Int) {}
operator fun Case.Inv.invoke(i: Int) {}
// FILE: TestCase3.kt
// TESTCASE NUMBER: 1
package testPackCase3
import libPackage.*
class Case() {
class E(val plusAssign: Inv? = null) {
/*operator*/ fun plusAssign(value: Int) {}
}
class Inv() {
/*operator*/ fun invoke(value: Int) {}
}
fun foo(e: E) {
/*operator*/ fun E.<!EXTENSION_SHADOWED_BY_MEMBER!>plusAssign<!>(value: Int) {}
run {
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
<!DEBUG_INFO_CALL("fqName: libPackage.plusAssign; typeCall: operator extension function")!>e += 1<!>
}
}
@@ -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-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 3
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 6 -> sentence 5
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 6
* DESCRIPTION: Star-imported extension callables
*/
// FILE: LibCase1.kt
// TESTCASE NUMBER: 1
package libPackage
/*public*/ private <!NOTHING_TO_INLINE!>inline<!> operator fun CharSequence.contains(regex: Regex): Boolean = regex.containsMatchIn(this)
// FILE: TestCase1.kt
// TESTCASE NUMBER: 1
package testPackCase1
import libPackage.*
class Case() {
fun foo() {
"".<!DEBUG_INFO_CALL("fqName: kotlin.text.contains; typeCall: inline operator extension function")!>contains(Regex(""))<!>
}
}
@@ -0,0 +1,227 @@
// !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, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: properties available through the invoke convention are non-eligible for operator calls
*/
// FILE: TestCase1.kt
/*
* TESTCASE NUMBER: 1
* NOTE:Delegated properties
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36844
*/
package testPackCase1
fun case1() {
var b = B()
val a: String = b.p
}
class B() {
val p: String by Delegate() // DELEGATE_SPECIAL_FUNCTION_MISSING expected
}
class Delegate {
val getValue = G()
}
class G {
operator fun invoke(i: Int): String = ""
}
// FILE: TestCase2.kt
/*
* TESTCASE NUMBER: 2
* NOTE:Delegated properties
*/
package testPackCase2
fun case2() {
var b = B()
val a: String = b.p
b.p = ""
}
class B() {
var p: String by <!DELEGATE_SPECIAL_FUNCTION_MISSING!>Delegate()<!> // DELEGATE_SPECIAL_FUNCTION_MISSING expected
}
class Delegate {
val getValue = G()
val setValue = S()
}
class G {
operator fun invoke(i: Int): String = ""
}
class S {
operator fun invoke(i: String) {}
}
// FILE: TestCase3.kt
/*
* TESTCASE NUMBER: 3
* NOTE: Arithmetic and comparison operators
*/
package testPackCase3
class Comp() {
operator fun invoke(i: Int): Int = 1
}
class Arifm() {
operator fun invoke(i: Int) {}
}
class B() {
val plus = Arifm()
val minus = Arifm()
val compareTo = Comp()
}
fun case3() {
var b = B()
b <!PROPERTY_AS_OPERATOR!>+<!> 5
b <!PROPERTY_AS_OPERATOR!>-<!> 5
b <!PROPERTY_AS_OPERATOR!><<!> 5
b <!PROPERTY_AS_OPERATOR!>>=<!> 5
}
// FILE: TestCase4.kt
/*
* TESTCASE NUMBER: 4
* NOTE: Operator-form assignments
*/
package testPackCase4
class Assign() {
operator fun invoke(i: Int) {}
}
class B(val minusAssign: Assign = Assign()) {
val plusAssign = Assign()
}
fun case3() {
var b = B()
b <!PROPERTY_AS_OPERATOR!>+=<!> 2
b <!PROPERTY_AS_OPERATOR!>-=<!> 3
}
// FILE: TestCase5.kt
/*
* TESTCASE NUMBER: 5
* NOTE: Arithmetic and comparison operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36852
*/
package testPackCase5
class Case5() {
fun f(c: Case5){
this <!OPERATOR_MODIFIER_REQUIRED!>+<!> 1 //OPERATOR_MODIFIER_REQUIRED for class plus, resolved to (1)
c <!OPERATOR_MODIFIER_REQUIRED!>+<!> 1 //OPERATOR_MODIFIER_REQUIRED for class plus, resolved to (1)
}
inner class plus constructor(val i:Int){
operator fun invoke(i:Int) {} //(1)
}
}
// FILE: TestCase6.kt
/*
* TESTCASE NUMBER: 6
* NOTE: Arithmetic and comparison operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36852
*/
package testPackCase6
class B(var a: Int = 0) {
inner class E(){
val plus :E =TODO()
fun foo(b: B){
this <!PROPERTY_AS_OPERATOR!>+<!> 1
}
operator fun invoke(value: Int) = B()
}
}
// FILE: TestCase7.kt
/*
* TESTCASE NUMBER: 7
* NOTE: for-loop operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36898
*/
package testPackCase7
fun case7 () {
val iterable: Iterable = Iterable(Inv('s'))
for (i in iterable) {
println(i)
}
}
class Iterable(val iterator: Inv) {
// operator fun iterator() : CharIterator = TODO()
}
class Inv(val c: Char) {
operator fun invoke(): CharIterator = object : CharIterator() {
private var index = 0
override fun nextChar(): Char {
index++; return c
}
override fun hasNext(): Boolean = index < 5
}
}
// FILE: TestCase8.kt
/*
* TESTCASE NUMBER: 8
* NOTE: for-loop operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36898
*/
package testPackCase8
fun case8 () {
val iterable: Iterable = Iterable()
for (i in iterable) {
println(i)
}
}
class Iterable() {
// operator fun iterator() : CharIterator = TODO()
}
val Iterable.iterator: Inv
get() = Inv('c')
class Inv(val c: Char) {
operator fun invoke(): CharIterator = object : CharIterator() {
private var index = 0
override fun nextChar(): Char {
index++; return c
}
override fun hasNext(): Boolean = index < 5
}
}
@@ -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 (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: properties available through the invoke convention are non-eligible for operator calls
*/
// FILE: TestCase1.kt
/*
* TESTCASE NUMBER: 1
* NOTE: Arithmetic and comparison operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36855
*/
package testPackCase1
class Arithmetic() {
operator fun invoke(i: Int) = B()
}
class B() {
operator fun plus(i: Int) : B =B()
val plusAssign = Arithmetic()
fun case7(){
var b =B()
b<!ASSIGN_OPERATOR_AMBIGUITY!>+=<!>1 //ASSIGN_OPERATOR_AMBIGUITY
this <!ASSIGNMENT_OPERATOR_SHOULD_RETURN_UNIT, PROPERTY_AS_OPERATOR!>+=<!> 1 //ASSIGNMENT_OPERATOR_SHOULD_RETURN_UNIT, PROPERTY_AS_OPERATOR
}
}
fun case1() {
var b = B()
b <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> 1 //ASSIGN_OPERATOR_AMBIGUITY
}
// FILE: TestCase2.kt
/*
* TESTCASE NUMBER: 1
* NOTE: Arithmetic and comparison operators
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36855
*/
package testPackCase2
class Arithmetic() {
operator fun invoke(i: Int) = B()
}
class B() {
operator fun plusAssign(i: Int) {}
val plus = Arithmetic()
fun case2(b: B) {
b += 1 //ok
var b1 = B()
b1 <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> 1 //ASSIGN_OPERATOR_AMBIGUITY
this += 1 //ok
}
}
fun case2() {
var b = B()
b <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> 1 //ASSIGN_OPERATOR_AMBIGUITY
}
@@ -0,0 +1,73 @@
{
"4": {
"neg": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "smart case for property `plus` available through the operator invoke",
"path": "compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.kt",
"unexpectedBehaviour": true
},
{
"specVersion": "0.1-268",
"casesNumber": 8,
"description": "properties available through the invoke convention are non-eligible for operator calls",
"unexpectedBehaviour": true
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "properties available through the invoke convention are non-eligible for operator calls",
"unexpectedBehaviour": true
}
]
}
},
"2": {
"pos": {
"3": [
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Extension callables declared in the package scope",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 3,
"description": "Star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 10,
"description": "Non-extension member callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "Star-imported extension callables",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-268",
"casesNumber": 5,
"description": "Non-extension member callables",
"unexpectedBehaviour": true
},
{
"specVersion": "0.1-268",
"casesNumber": 4,
"description": "Explicitly imported extension callables",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -0,0 +1,43 @@
// !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: type-inference, smart-casts, smart-cast-sink-stability -> paragraph 5 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 4 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION: smart case for property `plus` available through the operator invoke
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36876
*/
// TESTCASE NUMBER: 1
class Case1() {
class E(val plus: Inv? = null, val value: Inv? = null)
class Inv() {
operator fun invoke(value: Int) = Case1()
}
fun foo(e: E) {
if (e.plus != null) {
run { e <!PROPERTY_AS_OPERATOR, UNSAFE_OPERATOR_CALL!>+<!> 1 }
/*
[PROPERTY_AS_OPERATOR] (ok)
Properties cannot be used in operator conventions: 'invoke' in 'operatorCall.Case1.Inv'
[UNSAFE_OPERATOR_CALL] (nok)
Operator call corresponds to a dot-qualified call 'e.plus(1)' which is not allowed on a nullable receiver 'e'.
*/
e <!PROPERTY_AS_OPERATOR, UNSAFE_OPERATOR_CALL!>+<!> 1
<!DEBUG_INFO_SMARTCAST!>e.plus<!>.invoke(1) //ok
}
}
}
@@ -0,0 +1,38 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: type-inference, smart-casts, smart-cast-sink-stability -> paragraph 5 -> sentence 1
* RELEVANT PLACES: overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 1 -> sentence 1
* overload-resolution, building-the-overload-candidate-set-ocs, call-with-an-explicit-receiver -> paragraph 3 -> sentence 1
* NUMBER: 1
* DESCRIPTION: smart cast for the property available through the operator invoke
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-36876
*/
// TESTCASE NUMBER: 1
class Case1() {
class E(val plus: Inv? = null, val value: Inv? = null)
class Inv() {
operator fun invoke(value: Int) = Case1()
}
fun foo(e: E) {
if (e.value != null) {
run { e.<!UNSAFE_IMPLICIT_INVOKE_CALL!>value<!>(1) }
/*
[UNSAFE_CALL] (nok)
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Case1.Inv?
*/
e.<!UNSAFE_IMPLICIT_INVOKE_CALL!>value<!>(1)
}
}
}
@@ -0,0 +1,24 @@
{
"5": {
"neg": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "smart case for property `plus` available through the operator invoke",
"unexpectedBehaviour": true
}
]
},
"pos": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 1,
"description": "smart cast for the property available through the operator invoke",
"unexpectedBehaviour": true
}
]
}
}
}
@@ -25,7 +25,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
}
public void testAllFilesPresentInDiagnostics() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "linked/type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/annotations", "linked/statements/assignments/simple-assignments", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overloadable-operators", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "linked/type-inference/smart-casts/smart-cast-types", "linked/type-inference/local-type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/annotations", "linked/statements/assignments/simple-assignments", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overloadable-operators", "linked/overload-resolution/c-level-partition", "linked/overload-resolution/determining-function-applicability-for-a-specific-call", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked")
@@ -37,7 +37,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
}
public void testAllFilesPresentInLinked() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "annotations", "statements/assignments/simple-assignments", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overloadable-operators", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-inference/smart-casts/smart-cast-types", "type-inference/local-type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "annotations", "statements/assignments/simple-assignments", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overloadable-operators", "overload-resolution/c-level-partition", "overload-resolution/determining-function-applicability-for-a-specific-call", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph");
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis")
@@ -3605,6 +3605,124 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Operator_call extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInOperator_call() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-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/operator-call/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-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/operator-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/operator-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/operator-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/operator-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/operator-call/p-2/pos/3.5.kt");
}
@TestMetadata("3.6.kt")
public void test3_6() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.6.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/operator-call/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_4 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_4() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/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/operator-call/p-4/neg/1.1.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/operator-call/p-4/neg"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos/1.1.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention")
@@ -3980,6 +4098,94 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Type_inference extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInType_inference() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference"), Pattern.compile("^(.+)\\.kt$"), null, true, "smart-casts/smart-cast-types", "local-type-inference");
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smart_casts extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmart_casts() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts"), Pattern.compile("^(.+)\\.kt$"), null, true, "smart-cast-types");
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Smart_cast_sink_stability extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInSmart_cast_sink_stability() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_5 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_5() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/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/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg/1.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/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/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos/1.1.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-cast-sink-stability/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-system")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -25,7 +25,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInBox() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "templates");
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "templates", "linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked")
@@ -37,7 +37,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInLinked() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), null, true);
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "overload-resolution/building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions")
@@ -3302,7 +3302,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInOverload_resolution() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution"), Pattern.compile("^(.+)\\.kt$"), null, true);
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution"), Pattern.compile("^(.+)\\.kt$"), null, true, "building-the-overload-candidate-set-ocs/call-with-an-explicit-receiver");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs")
@@ -3314,7 +3314,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInBuilding_the_overload_candidate_set_ocs() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs"), Pattern.compile("^(.+)\\.kt$"), null, true);
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs"), Pattern.compile("^(.+)\\.kt$"), null, true, "call-with-an-explicit-receiver");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/infix-function-call")
@@ -3360,6 +3360,95 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Operator_call extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInOperator_call() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_2 extends AbstractBlackBoxCodegenTestSpec {
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/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/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("3.1.kt")
public void test3_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.1.kt");
}
@TestMetadata("3.10.kt")
public void test3_10() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.10.kt");
}
@TestMetadata("3.2.kt")
public void test3_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.2.kt");
}
@TestMetadata("3.3.kt")
public void test3_3() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.3.kt");
}
@TestMetadata("3.4.kt")
public void test3_4() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.4.kt");
}
@TestMetadata("3.5.kt")
public void test3_5() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.5.kt");
}
@TestMetadata("3.6.kt")
public void test3_6() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.6.kt");
}
@TestMetadata("3.7.kt")
public void test3_7() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.7.kt");
}
@TestMetadata("3.8.kt")
public void test3_8() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.8.kt");
}
@TestMetadata("3.9.kt")
public void test3_9() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos/3.9.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/overload-resolution/callables-and-invoke-convention")