Redundant/conflicting projections

This commit is contained in:
Andrey Breslav
2012-11-22 12:52:14 +04:00
parent 5b93ae2d08
commit c849a0c4e3
24 changed files with 79 additions and 42 deletions
@@ -36,8 +36,8 @@ fun test1() {
val i = both(1, "")
val j = both(id(1), id(""))
i : Comparable<out Any?>
j : Comparable<out Any?>
i : Comparable<*>
j : Comparable<*>
}
fun list<T>(value: T) : ArrayList<T> {
@@ -2,7 +2,7 @@
//+JDK
package d
public fun <T> Collection<out T>.filterToMy(result : MutableList<in T>, filter : (T) -> Boolean) : Collection<out T> {
public fun <T> MutableCollection<out T>.filterToMy(result : MutableList<in T>, filter : (T) -> Boolean) : MutableCollection<out T> {
for (t in this){
if (filter(t)){
result.add(t)
@@ -11,13 +11,13 @@ public fun <T> Collection<out T>.filterToMy(result : MutableList<in T>, filter :
return this
}
fun foo(result: MutableList<in String>, val collection: Collection<String>, prefix : String){
fun foo(result: MutableList<in String>, val collection: MutableCollection<String>, prefix : String){
collection.filterToMy(result, {it.startsWith(prefix)})
}
fun test(result: MutableList<in Any>, val collection: Collection<String>, prefix : String){
fun test(result: MutableList<in Any>, val collection: MutableCollection<String>, prefix : String){
val c = collection.filterToMy(result, {it.startsWith(prefix)})
c: Collection<out String>
c: MutableCollection<out String>
}
//from library