Lambda --> reference supports bound references now #KT-13111 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-03-09 16:29:15 +03:00
parent 831467891c
commit 3a14a5c461
12 changed files with 126 additions and 31 deletions
@@ -1,7 +1,6 @@
// IS_APPLICABLE: false
// IS_APPLICABLE: true
class Owner(val z: Int) {
// Possible only in 1.1 with bound references (this::foo)
val x = { arg: Int <caret> -> foo(arg) }
}
@@ -0,0 +1,8 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
val x = this::foo
}
fun Owner.foo(y: Int) = y + z
@@ -1,7 +1,6 @@
// IS_APPLICABLE: false
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
// Possible only in 1.1 with bound references (this::foo)
val x = { arg: Int <caret> -> foo(arg) }
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
val x = this::foo
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
}
val owner = Owner(42)
val x = { arg: Int <caret> -> owner.foo(arg) }
@@ -0,0 +1,9 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
}
val owner = Owner(42)
val x = owner::foo
@@ -0,0 +1,9 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
}
fun bar(owner: Owner) {
val x = { arg: Int <caret> -> owner.foo(arg) }
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: true
class Owner(val z: Int) {
fun foo(y: Int) = y + z
}
fun bar(owner: Owner) {
val x = owner::foo
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: true
// WITH_RUNTIME
class Owner(val z: Int) {
fun foo(y: Int) = y + z
val x = 7.let {<caret> foo(it) }
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: true
// WITH_RUNTIME
class Owner(val z: Int) {
fun foo(y: Int) = y + z
val x = 7.let(this::foo)
}