Wrap property reference instance before storing to static field

This commit is contained in:
Alexander Udalov
2015-07-10 17:11:49 +03:00
parent 16b5b95556
commit 670565b251
4 changed files with 51 additions and 36 deletions
@@ -16,12 +16,17 @@
package org.jetbrains.kotlin.utils
private val IDENTITY: Function1<Any?, Any?> = { it }
private val IDENTITY: (Any?) -> Any? = { it }
suppress("UNCHECKED_CAST")
public fun <T> identity(): Function1<T, T> = IDENTITY as Function1<T, T>
public fun <T> identity(): (T) -> T = IDENTITY as (T) -> T
private val ALWAYS_TRUE: Function1<Any?, Boolean> = { true }
private val ALWAYS_TRUE: (Any?) -> Boolean = { true }
public fun <T> alwaysTrue(): Function1<T, Boolean> = ALWAYS_TRUE
public fun <T> alwaysTrue(): (T) -> Boolean = ALWAYS_TRUE
public val DO_NOTHING: (Any?) -> Unit = { }
public fun <T> doNothing(): (T) -> Unit = DO_NOTHING