Change HashMap in test to custom class

It's implementing kotlin.Map with flexible arguments that is necessary in this test.
This commit is contained in:
Denis Zharkov
2015-07-03 16:23:04 +03:00
parent 151231ef1a
commit d350303951
2 changed files with 37 additions and 3 deletions
@@ -1,4 +1,16 @@
import java.util.HashMap
// FILE: MyMap.java
import java.util.AbstractMap;
import java.util.Set;
class MyMap<K, V> extends AbstractMap<K, V> {
@Override
public Set<Entry<K, V>> entrySet() {
return null;
}
}
// FILE: main.kt
interface ResolverForProject<M1> {
val exposeM: M1 get() = null!!
@@ -14,7 +26,7 @@ interface WithFoo {
}
fun <M2: WithFoo> foo(delegateResolver: ResolverForProject<M2?>): ResolverForProject<M2> {
val descriptorByModule = HashMap<M2, String>()
val descriptorByModule = MyMap<M2, String>()
val result = ResolverForProjectImpl(descriptorByModule, delegateResolver)
result.exposeM.foo() // M is not M2?
result.exposeM?.foo() // no warning, M is not M2, hense M is M2!
@@ -22,5 +34,5 @@ fun <M2: WithFoo> foo(delegateResolver: ResolverForProject<M2?>): ResolverForPro
return ResolverForProjectImpl(descriptorByModule, delegateResolver) // another bound check
}
// HashMap<M2, String> :< Map<M, String> => M = M2!
// MyMap<M2, String> :< Map<M, String> => M = M2!
// RFP<M2?> :< RFP<M> => M = M2?
@@ -2,6 +2,28 @@ package
internal fun </*0*/ M2 : WithFoo> foo(/*0*/ delegateResolver: ResolverForProject<M2?>): ResolverForProject<M2>
public/*package*/ open class MyMap</*0*/ K, /*1*/ V> : java.util.AbstractMap<K!, V!> {
public/*package*/ constructor MyMap</*0*/ K, /*1*/ V>()
invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.(Mutable)Set<K!>!
invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.(Mutable)Collection<V!>!
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any!
public open override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Any?): kotlin.Boolean
java.lang.Override() public open override /*1*/ fun entrySet(): kotlin.MutableSet<kotlin.MutableMap.MutableEntry<K!, V!>>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.Any?): V?
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun keySet(): kotlin.MutableSet<K!>
public open override /*1*/ /*fake_override*/ fun put(/*0*/ key: K!, /*1*/ value: V!): V?
public open override /*1*/ /*fake_override*/ fun putAll(/*0*/ m: kotlin.Map<out K!, V!>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.Any?): V?
public open override /*1*/ /*fake_override*/ fun size(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public open override /*1*/ /*fake_override*/ fun values(): kotlin.MutableCollection<V!>
}
internal interface ResolverForProject</*0*/ M1> {
internal open val exposeM: M1
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean