Generalize run() scope function.
#KT-5235 Fixed
This commit is contained in:
@@ -11,7 +11,12 @@ public fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||
/**
|
||||
* Calls the specified function.
|
||||
*/
|
||||
public inline fun <T> run(f: () -> T): T = f()
|
||||
public inline fun <R> run(f: () -> R): R = f()
|
||||
|
||||
/**
|
||||
* Calls the specified function with this value as its receiver.
|
||||
*/
|
||||
public inline fun <T, R> T.run(f: T.() -> R): R = f()
|
||||
|
||||
/**
|
||||
* Execute f with given receiver
|
||||
|
||||
Reference in New Issue
Block a user