diff --git a/compiler/testData/cfg/controlStructures/whenConditions.values b/compiler/testData/cfg/controlStructures/whenConditions.values index 6673e68682e..21564e661cf 100644 --- a/compiler/testData/cfg/controlStructures/whenConditions.values +++ b/compiler/testData/cfg/controlStructures/whenConditions.values @@ -11,7 +11,7 @@ fun foo(a: Number) { } --------------------- : {<: Number} NEW: magic[FAKE_INITIALIZER](a: Number) -> -a : * NEW: r(a) -> +a : Int! NEW: r(a) -> 1 : * NEW: r(1) -> 1 : * NEW: magic[EQUALS_IN_WHEN_CONDITION](1|, ) -> "1" : {<: String?} NEW: r("1") -> diff --git a/compiler/testData/codegen/box/builtinStubMethods/Collection.kt b/compiler/testData/codegen/box/builtinStubMethods/Collection.kt index 54d4e3b93a2..44f9b031a08 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/Collection.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/Collection.kt @@ -1,9 +1,9 @@ class MyCollection: Collection { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: T): Boolean = false override fun iterator(): Iterator = throw UnsupportedOperationException() - override fun containsAll(c: Collection): Boolean = false + override fun containsAll(c: Collection): Boolean = false override fun hashCode(): Int = 0 override fun equals(other: Any?): Boolean = false } diff --git a/compiler/testData/codegen/box/builtinStubMethods/List.kt b/compiler/testData/codegen/box/builtinStubMethods/List.kt index c86bc92b9ac..6f441a95162 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/List.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/List.kt @@ -1,9 +1,9 @@ class MyList: List { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: T): Boolean = false override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false + override fun containsAll(c: Collection): Boolean = false override fun get(index: Int): T = throw IndexOutOfBoundsException() override fun indexOf(o: Any?): Int = -1 override fun lastIndexOf(o: Any?): Int = -1 diff --git a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt index bd2f143558f..7f021222b69 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt @@ -1,9 +1,9 @@ class MyList(val v: T): List { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: T): Boolean = false override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false + override fun containsAll(c: Collection): Boolean = false override fun get(index: Int): T = v override fun indexOf(o: Any?): Int = -1 override fun lastIndexOf(o: Any?): Int = -1 diff --git a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt index afa2e7b48bb..057fc92a327 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt @@ -14,9 +14,9 @@ open class Super(val v: T) { class MyList(v: T): Super(v), List { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: T): Boolean = false override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false + override fun containsAll(c: Collection): Boolean = false override fun get(index: Int): T = v override fun indexOf(o: Any?): Int = -1 override fun lastIndexOf(o: Any?): Int = -1 diff --git a/compiler/testData/codegen/box/builtinStubMethods/SubstitutedList.kt b/compiler/testData/codegen/box/builtinStubMethods/SubstitutedList.kt index f99bb987d57..473aea37f55 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/SubstitutedList.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/SubstitutedList.kt @@ -1,9 +1,9 @@ class MyList: List { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: String): Boolean = false override fun iterator(): Iterator = throw Error() - override fun containsAll(c: Collection): Boolean = false + override fun containsAll(c: Collection): Boolean = false override fun get(index: Int): String = throw IndexOutOfBoundsException() override fun indexOf(o: Any?): Int = -1 override fun lastIndexOf(o: Any?): Int = -1 diff --git a/compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt b/compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt index d645e4e146d..65eaff7f18b 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt @@ -5,9 +5,9 @@ interface Addable { class C : Addable, List { override val size: Int get() = null!! override fun isEmpty(): Boolean = null!! - override fun contains(o: Any?): Boolean = null!! + override fun contains(o: String): Boolean = null!! override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection): Boolean = null!! + override fun containsAll(c: Collection): Boolean = null!! override fun get(index: Int): String = null!! override fun indexOf(o: Any?): Int = null!! override fun lastIndexOf(o: Any?): Int = null!! diff --git a/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt index a039ac792e8..e73d5b30b7d 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt @@ -7,9 +7,9 @@ open class SetStringImpl { class S : Set, SetStringImpl() { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: String): Boolean = false override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection) = false + override fun containsAll(c: Collection) = false } fun box(): String { diff --git a/compiler/testData/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt b/compiler/testData/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt index 137831502bb..244266cc0b6 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/manyTypeParametersWithUpperBounds.kt @@ -3,9 +3,9 @@ import java.util.Collections class A : Set { override val size: Int get() = 0 override fun isEmpty(): Boolean = true - override fun contains(o: Any?): Boolean = false + override fun contains(o: W): Boolean = false override fun iterator(): Iterator = Collections.emptySet().iterator() - override fun containsAll(c: Collection): Boolean = c.isEmpty() + override fun containsAll(c: Collection): Boolean = c.isEmpty() } fun expectUoe(block: () -> Any) { diff --git a/compiler/testData/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt b/compiler/testData/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt index 3186ef6eeb5..b77fd967035 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/nonTrivialSubstitution.kt @@ -4,8 +4,8 @@ class MyCollection : Collection>> { override fun iterator() = null!! override val size: Int get() = null!! override fun isEmpty(): Boolean = null!! - override fun contains(o: Any?): Boolean = null!! - override fun containsAll(c: Collection): Boolean = null!! + override fun contains(o: List>): Boolean = null!! + override fun containsAll(c: Collection>>): Boolean = null!! } fun box(): String { diff --git a/compiler/testData/codegen/box/builtinsProperties/bridges.kt b/compiler/testData/codegen/box/builtinsProperties/bridges.kt index 45216e69ec0..6cefaf826bd 100644 --- a/compiler/testData/codegen/box/builtinsProperties/bridges.kt +++ b/compiler/testData/codegen/box/builtinsProperties/bridges.kt @@ -6,9 +6,9 @@ interface A0 { class B0 : Collection, A0 { override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: Any?) = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() } open class A1 { @@ -17,9 +17,9 @@ open class A1 { class B1 : Collection, A1() { override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: Any?) = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() } interface I2 { @@ -42,9 +42,9 @@ interface I4 { class B4 : Collection, I4 { override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: Any?) = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() } interface I5 : Collection { @@ -53,9 +53,9 @@ interface I5 : Collection { class B5 : I5 { override fun isEmpty() = throw UnsupportedOperationException() - override fun contains(o: Any?) = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException() - override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() } fun box(): String { diff --git a/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt b/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt index 7e542f1f01c..7e1c21758ab 100644 --- a/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt +++ b/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt @@ -6,7 +6,7 @@ class A1 : MutableCollection { throw UnsupportedOperationException() } - override fun contains(o: Any?): Boolean { + override fun contains(o: String): Boolean { throw UnsupportedOperationException() } @@ -14,7 +14,7 @@ class A1 : MutableCollection { throw UnsupportedOperationException() } - override fun containsAll(c: Collection): Boolean { + override fun containsAll(c: Collection): Boolean { throw UnsupportedOperationException() } diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt index e698f95710e..f90a0b07117 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt @@ -1,9 +1,9 @@ abstract class C : Test.A, List { override val size: Int get() = null!! override fun isEmpty(): Boolean = null!! - override fun contains(o: Any?): Boolean = null!! + override fun contains(o: String): Boolean = null!! override fun iterator(): Iterator = null!! - override fun containsAll(c: Collection): Boolean = null!! + override fun containsAll(c: Collection): Boolean = null!! override fun get(index: Int): String = null!! override fun indexOf(o: Any?): Int = null!! override fun lastIndexOf(o: Any?): Int = null!! diff --git a/compiler/testData/diagnostics/tests/library/Collections.kt b/compiler/testData/diagnostics/tests/library/Collections.kt index 7fb089478b9..dc26c5da7e7 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.kt @@ -3,7 +3,7 @@ package collections fun testCollection(c: Collection, t: T) { c.size c.isEmpty() - c.contains(1) + c.contains(1) val iterator: Iterator = c.iterator() c.containsAll(c) @@ -19,7 +19,7 @@ fun testCollection(c: Collection, t: T) { fun testMutableCollection(c: MutableCollection, t: T) { c.size c.isEmpty() - c.contains(1) + c.contains(1) val iterator: Iterator = c.iterator() c.containsAll(c) @@ -61,7 +61,7 @@ fun testMutableList(l: MutableList, t: T) { fun testSet(s: Set, t: T) { s.size s.isEmpty() - s.contains(1) + s.contains(1) val iterator: Iterator = s.iterator() s.containsAll(s) @@ -77,7 +77,7 @@ fun testSet(s: Set, t: T) { fun testMutableSet(s: MutableSet, t: T) { s.size s.isEmpty() - s.contains(1) + s.contains(1) val iterator: Iterator = s.iterator() s.containsAll(s) diff --git a/js/js.translator/testData/java/arrayList/cases/containsAll.kt b/js/js.translator/testData/java/arrayList/cases/containsAll.kt index 3932f6e4ee7..3e68774715a 100644 --- a/js/js.translator/testData/java/arrayList/cases/containsAll.kt +++ b/js/js.translator/testData/java/arrayList/cases/containsAll.kt @@ -3,7 +3,7 @@ package foo import java.util.ArrayList; fun box(): String { - val list = arrayListOf(3, "2", -1, null, 0, 8, 5, "3", 77, -15) + val list: List = arrayListOf(3, "2", -1, null, 0, 8, 5, "3", 77, -15) val subset = arrayListOf(3, "2", -1, null) val empty = arrayListOf() val withOtherElements = arrayListOf(3, 54, null)