diff --git a/libraries/stdlib/src/kotlin/io/Files.kt b/libraries/stdlib/src/kotlin/io/Files.kt index 960c9093b59..54d654c29f5 100644 --- a/libraries/stdlib/src/kotlin/io/Files.kt +++ b/libraries/stdlib/src/kotlin/io/Files.kt @@ -86,7 +86,7 @@ public inline fun File.reader(): FileReader = FileReader(this) /** * Iterates through each line of this file then closing the underlying [[Reader]] when its completed */ -public inline fun File.forEachLine(block: (String) -> Unit): Unit = reader().forEachLine(block) +public inline fun File.forEachLine(block: (String) -> Any): Unit = reader().forEachLine(block) /** * Reads the entire content of the file as bytes diff --git a/libraries/stdlib/src/kotlin/io/JIO.kt b/libraries/stdlib/src/kotlin/io/JIO.kt index 841f65d6ff7..a980a337cc6 100644 --- a/libraries/stdlib/src/kotlin/io/JIO.kt +++ b/libraries/stdlib/src/kotlin/io/JIO.kt @@ -212,7 +212,7 @@ public inline fun Writer.buffered(bufferSize: Int = defaultBufferSize): Buffered /** * Iterates through each line of this reader then closing the [[Reader]] when its completed */ -public inline fun Reader.forEachLine(block: (String) -> Unit): Unit { +public inline fun Reader.forEachLine(block: (String) -> Any): Unit { this.use{ val iter = buffered().lineIterator() while (iter.hasNext) {