JS: add tests too prove that operator conventions are correctly inlined. Support inlining of invoke operator. See KT-7588

This commit is contained in:
Alexey Andreev
2016-12-14 14:40:49 +03:00
parent d3d406356c
commit c285e5ba3b
4 changed files with 114 additions and 2 deletions
@@ -0,0 +1,26 @@
// MODULE: lib
// FILE: lib.kt
class A {
inline operator fun plus(a: Int) = a + 10
}
class B
inline operator fun B.plus(b: Int) = b + 20
// MODULE: main(lib)
// FILE: main.kt
// CHECK_NOT_CALLED_IN_SCOPE: function=plus_za3lpa$ scope=box
// CHECK_NOT_CALLED_IN_SCOPE: function=plus scope=box
fun box(): String {
var result = A() + 1
if (result != 11) return "fail: member operator"
result = B() + 2
if (result != 22) return "fail: extension operator"
return "OK"
}