avoid unnecessary verbose type parameters now the type inferencer is better

This commit is contained in:
James Strachan
2012-08-17 09:44:52 +01:00
parent a4e80c7d5d
commit ecbd4daefb
10 changed files with 14 additions and 32 deletions
+3 -8
View File
@@ -132,7 +132,7 @@ class CollectionTest {
// lets concatenate some strings
expect("1234") {
val numbers = arrayList(1, 2, 3, 4)
numbers.map<Int, String>{it.toString()}.fold(""){ a, b -> a + b}
numbers.map{it.toString()}.fold(""){ a, b -> a + b}
}
}
@@ -146,7 +146,7 @@ class CollectionTest {
test fun foldRight() {
expect("1234") {
val numbers = arrayList(1, 2, 3, 4)
numbers.map<Int, String>{it.toString()}.foldRight(""){ a, b -> a + b}
numbers.map{it.toString()}.foldRight(""){ a, b -> a + b}
}
}
@@ -198,14 +198,9 @@ class CollectionTest {
assertEquals("a, b, c, *", text2)
}
/*
TODO compiler bug
we should be able to remove the explicit type <String,Int> on the map function
http://youtrack.jetbrains.net/issue/KT-1145
*/
test fun map() {
val data = arrayList("foo", "bar")
val lengths = data.map<String, Int>{ it.length }
val lengths = data.map{ it.length }
assertTrue {
lengths.all{it == 3}
}