Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt
T
Svetlana Isakova 02301a0d70 KT-7597 ErrorType leaked into backend
#KT-7597 Fixed
2015-04-30 21:24:51 +03:00

21 lines
648 B
Kotlin
Vendored

//KT-4711 Error type with no error reported from type inference
fun main(args:Array<String>) {
val n = 100
val delta = 1.0 / n
val startTimeNanos = System.nanoTime()
// the problem sits on the next line:
val pi = 4.0.toDouble() * delta <!OVERLOAD_RESOLUTION_AMBIGUITY!>*<!> (1..n).reduce(
{t, i ->
val x = (i - 0.5) * delta
<!TYPE_MISMATCH!>t + 1.0 / (1.0 + x * x)<!>
})
// !!! pi has error type here
val elapseTime = (System.nanoTime() - startTimeNanos) / 1e9
println("pi_sequential_reduce $<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>pi<!> $n $elapseTime")
}