Support private package properties in inline functions
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val packageResult = packageInline { a, b -> a + b }
|
||||
if (packageResult != "OK") return "package inline fail: $packageResult"
|
||||
|
||||
val samePackageResult = samePackageCall()
|
||||
if (samePackageResult != "OK") return "same package inline fail: $samePackageResult"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
private val packageProp = "O"
|
||||
|
||||
private fun packageFun() = "K"
|
||||
|
||||
inline fun packageInline(p: (String, String) -> String): String {
|
||||
return p(packageProp, packageFun())
|
||||
}
|
||||
|
||||
fun samePackageCall(): String {
|
||||
return packageInline { s, s2 -> s + s2 }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import test.*
|
||||
|
||||
fun box() : String {
|
||||
val p = P()
|
||||
|
||||
if (p.testPrivate() != "OK") return "fail 1 ${p.testPrivate()}"
|
||||
|
||||
if (p.testFinal() != "OK") return "fail 2 ${p.testFinal()}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package test
|
||||
|
||||
class P {
|
||||
private val FOO_PRIVATE = "OK"
|
||||
|
||||
final val FOO_FINAL = "OK"
|
||||
|
||||
private inline fun fooPrivate(): String {
|
||||
return FOO_PRIVATE
|
||||
}
|
||||
|
||||
private inline fun fooFinal(): String {
|
||||
return FOO_FINAL
|
||||
}
|
||||
|
||||
fun testPrivate(): String {
|
||||
return fooPrivate()
|
||||
}
|
||||
|
||||
fun testFinal(): String {
|
||||
return fooFinal()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user