Fix inlining of invoke operator [#KT-25474]

* add test
This commit is contained in:
Roman Artemev
2018-07-16 17:54:29 +03:00
committed by Roman Artemev
parent a457a9f870
commit e4b314c26c
4 changed files with 48 additions and 9 deletions
+29
View File
@@ -0,0 +1,29 @@
// EXPECTED_REACHABLE_NODES: 1189
// CHECK_CONTAINS_NO_CALLS: testDispatch
// CHECK_CONTAINS_NO_CALLS: testExtension
class Bar {
inline operator fun invoke(f: () -> String) { f() }
}
class Baz
inline operator fun Baz.invoke(f: () -> String) { f() }
class Foo {
val bar = Bar()
val baz = Baz()
}
fun testDispatch(foo: Foo): String {
foo.bar { return "O" }
return "FailDispatch;"
}
fun testExtension(foo: Foo): String {
foo.baz { return "K" }
return "FailExtension;"
}
fun box(): String {
val f = Foo()
return testDispatch(f) + testExtension(f)
}