stepango
03/07/2017, 2:59 AMtypealias Args = MutableMap<String, Any>
fun argsOf(block: Args.() -> Unit) = mutableMapOf<String, Any>().apply(block)
inline var Args.resourceId
get() = this["RESOURCE_ID"] as Long
set(value) {
this["RESOURCE_ID"] = value
}
class Test(val resourceId: Long) {
fun args() = argsOf {
this.resourceId = resourceId //Expect to refer to Test.resourceId here
}
}
fun main(vararg args:String) {
Test(1).args()
}
I'm getting NPE here
I'm not sure if it's a bug or expected behaviour