KT-581 wrong implicit receiver for intrinsic method call

This commit is contained in:
Alex Tkachman
2011-11-22 12:57:24 +02:00
parent efceb12f3b
commit 8eabc2978e
3 changed files with 45 additions and 0 deletions
@@ -0,0 +1,21 @@
namespace whats.the.difference
import java.util.HashSet
fun iarray(vararg a : Int) = a // BUG
fun IntArray.lastIndex() = size - 1
fun box() : String {
// Problematic code does not compile
// val vals = iarray(789, 678, 567, 456, 345, 234, 123, 012)
val vals = iarray(789, 678, 567, 456, 345, 234, 123, 12)
val diffs = HashSet<Int>
for (i in vals.indices)
for (j in i..vals.lastIndex())
diffs.add(vals[i] - vals[j])
System.out?.println(diffs.size())
return "OK"
}