From d350303951d4af4d707768b7f11d1353623c43ae Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 3 Jul 2015 16:23:04 +0300 Subject: [PATCH] Change HashMap in test to custom class It's implementing kotlin.Map with flexible arguments that is necessary in this test. --- .../methodCall/multipleExactBoundsNullable.kt | 18 ++++++++++++--- .../multipleExactBoundsNullable.txt | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt index 72cd6adfb41..c9de5cf0c8a 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt @@ -1,4 +1,16 @@ -import java.util.HashMap +// FILE: MyMap.java + +import java.util.AbstractMap; +import java.util.Set; + +class MyMap extends AbstractMap { + @Override + public Set> entrySet() { + return null; + } +} + +// FILE: main.kt interface ResolverForProject { val exposeM: M1 get() = null!! @@ -14,7 +26,7 @@ interface WithFoo { } fun foo(delegateResolver: ResolverForProject): ResolverForProject { - val descriptorByModule = HashMap() + val descriptorByModule = MyMap() 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 foo(delegateResolver: ResolverForProject): ResolverForPro return ResolverForProjectImpl(descriptorByModule, delegateResolver) // another bound check } -// HashMap :< Map => M = M2! +// MyMap :< Map => M = M2! // RFP :< RFP => M = M2? \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt index dbc14f5d9b7..6a283d0e3f9 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt @@ -2,6 +2,28 @@ package internal fun foo(/*0*/ delegateResolver: ResolverForProject): ResolverForProject +public/*package*/ open class MyMap : java.util.AbstractMap { + public/*package*/ constructor MyMap() + invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.(Mutable)Set! + invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.(Mutable)Collection! + 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> + 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 + 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): 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 +} + internal interface ResolverForProject { internal open val exposeM: M1 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean