Files
kotlin-fork/compiler/testData/diagnostics/tests/kt11167.kt
T
Marco Pennekamp a777ffcd8a [AA] KT-55566 StandaloneProjectFactory: Setup JDK default module roots
- Setup JDK default module roots in `StandaloneProjectFactory` (compare
  with `KotlinCoreEnvironment`). The implementation is a distilled
  version of `ClasspathRootsResolver`'s default module handling.
- This fixes an issue where some LL FIR tests with JDK 17 and 11 had
  mismatched types between Kotlin and Java sources.

^KT-55566 fixed
2023-01-04 11:46:11 +00:00

17 lines
445 B
Kotlin
Vendored

// FIR_IDENTICAL
// JDK_KIND: FULL_JDK_11
// WITH_STDLIB
import java.util.stream.IntStream
fun foo(s: IntStream) {
val n = 1000000000
val delta = 1.0 / n
val startTimeNanos = System.nanoTime()
val pi = 4.0 * delta * s.mapToDouble { i ->
val x = (i - 0.5) * delta
1.0 / (1.0 + x * x)
}.sum()
val elapseTime = (System.nanoTime() - startTimeNanos) / 1e9
println("Parallel Streams $pi $n $elapseTime")
}