[Spec tests] Add test for infix fun + KT-36786

This commit is contained in:
anastasiia.spaseeva
2020-02-17 17:50:43 +03:00
committed by Victor Petukhov
parent c9bb994fb5
commit 4301744d2d
8 changed files with 389 additions and 0 deletions
@@ -0,0 +1,37 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-268
* PLACE: overload-resolution, building-the-overload-candidate-set-ocs, infix-function-call -> paragraph 4 -> sentence 1
* NUMBER: 1
* DESCRIPTION: infix calls for properties
*/
class C() {
var isInvokeCalled = false
infix operator fun invoke(i: Int) { isInvokeCalled = true } //(1)
}
class B() {
val memberValC
get() = c
}
val c = C()
val B.extensionValC: C
get() = c
fun box(): String{
val b = B()
b memberValC 3 //resolved to (1) o_O
if (b.memberValC.isInvokeCalled) {
c.isInvokeCalled = false
b extensionValC 4 //resolved to (1) o_O
if (b.extensionValC.isInvokeCalled)
return "OK"
}
return "NOK"
}
@@ -0,0 +1,14 @@
{
"4": {
"pos": {
"1": [
{
"specVersion": "0.1-268",
"casesNumber": 0,
"description": "infix calls for properties",
"unexpectedBehaviour": false
}
]
}
}
}