An overridden abstract member with a more specific "return type" than an overridden concrete member
should be explicitly overridden even if the class in question can have abstract members.
This commit is contained in:
Dmitry Petrov
2017-01-18 17:39:09 +03:00
parent f89de02ff0
commit b36e3bc083
8 changed files with 291 additions and 129 deletions
@@ -80,6 +80,7 @@ fun <T: Any> T.check(predicate: (T) -> Boolean): T? = if (predicate(this)) this
inline fun <reified T : Any> Any?.safeAs(): T? = this as? T
inline fun <reified T : Any> Any?.cast(): T = this as T
inline fun <reified T : Any> Any?.assertedCast(message: () -> String): T = this as? T ?: throw AssertionError(message())
fun <T : Any> constant(calculator: () -> T): T {
val cached = constantMap[calculator]