KT-274 stdlib part and commented test. Still require frontend test

This commit is contained in:
Alex Tkachman
2012-01-05 00:16:25 +02:00
parent 79049ca2e2
commit ebe2c375cd
3 changed files with 38 additions and 0 deletions
@@ -0,0 +1,14 @@
import std.*
fun box() : String {
val vector = java.util.Vector<Int>()
vector.add(1)
vector.add(2)
vector.add(3)
var sum = 0
for(e in vector.elements()) {
sum += e
}
return if(sum == 6) "OK" else "fail"
}
@@ -80,4 +80,8 @@ public class StdlibTest extends CodegenTestCase {
public void testKt864 () {
blackBoxFile("regressions/kt864.jet");
}
public void testKt274 () {
// blackBoxFile("regressions/kt274.kt");
}
}
+20
View File
@@ -7,6 +7,26 @@ import java.util.HashSet
import java.util.LinkedHashSet
import java.util.TreeSet
/*
Helper to make jet.Iterator usable in for
*/
inline fun <T> jet.Iterator<T>.iterator() = this
/*
Helper to make java.util.Iterator usable in for
*/
inline fun <T> java.util.Iterator<T>.iterator() = this
/*
Helper to make java.util.Enumeration usable in for
*/
inline fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
override val hasNext: Boolean
get() = hasMoreElements()
override fun next() = nextElement()
}
/*
* Extension functions on the standard Kotlin types to behave like the java.lang.* and java.util.* collections
*/