Files
kotlin-fork/compiler/testData/codegen/box/callableReference/function/kt21787.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

22 lines
694 B
Kotlin
Vendored

// WITH_STDLIB
class Container {
var id: Int? = null
}
class TestClass {
private fun createContainer(id: Int): Container { val q = Container(); q.id = id; return q }
fun createContainers1(from: Int = 0, to: Int = 100) = (from .. to).map(::createContainer)
fun createContainers2(from: Int = 0, to: Int = 100): List<Container> { return (from .. to).map(::createContainer) }
}
fun box(): String {
val testClass = TestClass()
val containers1 = testClass.createContainers1().size
if (containers1 != 101) return "fail 1: $containers1"
val containers2 = testClass.createContainers2().size
if (containers2 != 101) return "fail 2: $containers2"
return "OK"
}