Add tests for KT-19511 and KT-21192 (with void -> boolean)

This commit is contained in:
Mikhail Glukhikh
2017-11-27 13:15:54 +03:00
parent bf2e3decaa
commit 07ec4ecd7f
2 changed files with 20 additions and 0 deletions
@@ -0,0 +1,5 @@
package consumer;
public interface Consumer<T> {
boolean consumer(T t);
}
+15
View File
@@ -61,4 +61,19 @@ fun foo8(a: Int) {
if (a > 1) a == 10 else a == -1 // both unused
if (a == 10) {} else if (a == -1) {} // both used
}
fun foo9() {
consumer.Consumer<Any?> { it == null } // used
}
class Test(val successCondition: (Int) -> Boolean) {
fun pass(num: Int): Boolean = successCondition(num)
}
fun foo10() {
val t1 = Test({it == 69})
if (t1.pass(42)) {
//
}
}