KT-11823 Generate proper argument for closure constructor for this as a free variable. Give some explanation for function that generates closure arguments as well as a clear name. Give explanation to some code in UsageTracker.isSingletonReceiver, augmented by a test case.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package foo
|
||||
|
||||
object A {
|
||||
val x = 23
|
||||
val y = { x }
|
||||
fun foo() = { x }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, A.foo()())
|
||||
assertEquals(23, A.y())
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// See KT-11823
|
||||
package foo
|
||||
|
||||
class Outer(val x: Int) {
|
||||
inner class Inner() {
|
||||
fun foo() = { x }
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, Outer(23).Inner().foo()())
|
||||
return "OK"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// See KT-11823
|
||||
package foo
|
||||
|
||||
class Outer(val x: Int) {
|
||||
inner class Inner() {
|
||||
fun foo(): Int {
|
||||
class A {
|
||||
fun bar() = x
|
||||
}
|
||||
return A().bar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, Outer(23).Inner().foo())
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user