Added test for KT-4711

Error type with no error reported from type inference
 #KT-4711 Fixed
This commit is contained in:
Svetlana Isakova
2014-11-17 19:45:47 +03:00
parent e31e63aabe
commit 9cd5f51b88
4 changed files with 873 additions and 1 deletions
@@ -0,0 +1,20 @@
//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 * (1..n).<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>reduce<!>(
{t, i ->
val x = (i - 0.5) * delta
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")
}