Add minimal generics and typed callable casts
This commit is contained in:
1 parent
51b397686d
commit
c9da0b256f
9 files changed
+419
-45
No files matched your search
@@ -229,7 +229,7 @@ fun Iterable.sortedBy(predicate) {
|
||||
|
||||
/* Return a shuffled copy of the iterable as a list. */
|
||||
fun Iterable.shuffled() {
|
||||
val list: List = toList
|
||||
val list: List = toList()
|
||||
list.shuffle()
|
||||
list
|
||||
}
|
||||
@@ -327,10 +327,10 @@ interface Delegate {
|
||||
Executes the block with `this` set to self and
|
||||
returns what the block returns.
|
||||
*/
|
||||
fun with(self, block) {
|
||||
fun with<T,R>(self: T, block: T.()->R): R {
|
||||
var result = Unset
|
||||
self.apply { result = block() }
|
||||
result
|
||||
result as R
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user