made Map covariant on second parameter

This commit is contained in:
Svetlana Isakova
2012-09-19 15:21:20 +04:00
parent 3dd9c6ab10
commit 0ff9d95704
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ public trait MutableSet<E> : Set<E>, MutableCollection<E> {
override fun clear()
}
public trait Map<K, V> {
public trait Map<K, out V> {
// Query Operations
public fun size() : Int
public fun isEmpty() : Boolean
+1 -1
View File
@@ -864,7 +864,7 @@ public final class jet.LongRange : jet.Range<jet.Long>, jet.LongIterable {
public final val EMPTY: jet.LongRange
}
}
public abstract trait jet.Map</*0*/ K : jet.Any?, /*1*/ V : jet.Any?> : jet.Any {
public abstract trait jet.Map</*0*/ K : jet.Any?, /*1*/ out V : jet.Any?> : jet.Any {
public abstract fun containsKey(/*0*/ key: jet.Any?): jet.Boolean
public abstract fun containsValue(/*0*/ value: jet.Any?): jet.Boolean
public abstract fun entrySet(): jet.Set<jet.Map.Entry<K, V>>
@@ -136,14 +136,14 @@ fun inheritedExtensionProperties(properties: Collection<KProperty>): Map<KClass,
// TODO for some reason the SortedMap causes kotlin to freak out a little :)
fun extensionFunctions(functions: Collection<KFunction>): Map<KClass, List<KFunction>> {
val map = TreeMap<KClass, List<KFunction>>()
val map = TreeMap<KClass, MutableList<KFunction>>()
functions.filter{ it.extensionClass != null }.groupByTo(map){ it.extensionClass!! }
return map
}
// TODO for some reason the SortedMap causes kotlin to freak out a little :)
fun extensionProperties(properties: Collection<KProperty>): Map<KClass, List<KProperty>> {
val map = TreeMap<KClass, List<KProperty>>()
val map = TreeMap<KClass, MutableList<KProperty>>()
properties.filter{ it.extensionClass != null }.groupByTo(map){ it.extensionClass!! }
return map
}
@@ -1037,7 +1037,7 @@ class KPackage(model: KModel, val descriptor: NamespaceDescriptor,
}
fun groupClassMap(): Map<String, List<KClass>> {
return classes.groupByTo(TreeMap<String, List<KClass>>()){it.group}
return classes.groupByTo(TreeMap<String, MutableList<KClass>>()){it.group}
}
fun packageFunctions() = functions.filter{ it.extensionClass == null }