Choose proper context for accessor generation: skip inline ones; Fix for KT-6102: Bypass synthetic accessor when inlining lambda which calls private member
#KT-6102 Fixed
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
inline fun call(s: () -> Unit) {
|
||||
s()
|
||||
}
|
||||
|
||||
class A {
|
||||
|
||||
private fun method() {}
|
||||
|
||||
private val prop = 1
|
||||
|
||||
fun test1() {
|
||||
call {
|
||||
method()
|
||||
prop
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
call {
|
||||
call {
|
||||
method()
|
||||
prop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//0 access\$
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
inline fun call(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
|
||||
class A {
|
||||
|
||||
private val prop: String = "O"
|
||||
get() = call { field + "K" }
|
||||
|
||||
private val prop2: String = "O"
|
||||
get() = call { call { field + "K" } }
|
||||
|
||||
fun test1(): String {
|
||||
return prop
|
||||
}
|
||||
|
||||
fun test2(): String {
|
||||
return prop2
|
||||
}
|
||||
}
|
||||
|
||||
//0 access\$
|
||||
@@ -0,0 +1,36 @@
|
||||
inline fun call(s: () -> Unit) {
|
||||
s()
|
||||
}
|
||||
|
||||
open class Base {
|
||||
|
||||
protected open fun method() {}
|
||||
|
||||
protected open val prop = 1
|
||||
|
||||
}
|
||||
|
||||
class A: Base() {
|
||||
|
||||
override fun method() {}
|
||||
|
||||
override val prop = 1
|
||||
|
||||
fun test1() {
|
||||
call {
|
||||
super.method()
|
||||
super.prop
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
call {
|
||||
call {
|
||||
super.method()
|
||||
super.prop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//0 access\$
|
||||
Reference in New Issue
Block a user