Fix for KT-6895: Compile error on Android (EXCEPTION FROM SIMULATION) when declaring locals in an inline function

#KT-6895 Fixed
This commit is contained in:
Michael Bogdanov
2015-04-15 15:21:49 +03:00
parent 0080ebd386
commit 48aef1eb28
5 changed files with 89 additions and 31 deletions
@@ -0,0 +1,22 @@
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.write
class UpdateableThing {
private val lock = ReentrantReadWriteLock()
private var updateCount = 0
fun performUpdates<T>(block: () -> T): T {
lock.write {
++updateCount
val result = block()
--updateCount
return result
}
}
}
fun box(): String {
return UpdateableThing().performUpdates { "OK" }
}