Support access to protected members within inline functions

This commit is contained in:
Michael Bogdanov
2015-11-11 11:54:15 +03:00
parent 5a8ead0092
commit 3651ec9294
7 changed files with 99 additions and 8 deletions
@@ -0,0 +1,15 @@
import test.*
class A: P() {
override val FOO: String
get() = "fail"
override fun test(): String {
return "fail"
}
}
fun box() : String {
val p = P()
return p.protectedProp() + p.protectedFun()
}
@@ -0,0 +1,16 @@
package test
open class P {
protected open val FOO = "O"
protected open fun test() = "K"
inline fun protectedProp(): String {
return FOO
}
inline fun protectedFun(): String {
return test()
}
}
@@ -0,0 +1,15 @@
import test.*
class A: P() {
override val FOO: String
get() = "fail"
override fun test(): String {
return "fail"
}
}
fun box() : String {
val p = P()
return p.protectedProp() + p.protectedFun()
}
@@ -0,0 +1,19 @@
package test
open class Base {
protected open val FOO = "O"
protected open fun test() = "K"
}
open class P : Base() {
inline fun protectedProp(): String {
return FOO
}
inline fun protectedFun(): String {
return test()
}
}