From e70bdb51c5638ffa41454678284042381436435b Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 18 Apr 2019 13:54:47 +0300 Subject: [PATCH] [NI] Automatically squash equal diagnostics in OI and NI in testdata --- .../testData/diagnostics/tests/Variance.kt | 2 +- .../controlFlowAnalysis/elvisNotProcessed.kt | 2 +- .../kt770.kt351.kt735_StatementType.kt | 2 +- .../tests/generics/projectionsScope/addAll.kt | 2 +- .../projectionsScope/typeMismatchInLambda.kt | 2 +- .../projectionsScope/typeParameterBounds.kt | 2 +- .../tests/generics/starProjections/invalid.kt | 2 +- .../NoInferenceFromDeclaredBounds.kt | 2 +- .../ignoreConstraintFromImplicitInNothing.kt | 4 +-- .../tests/inference/regressions/kt731.kt | 2 +- .../methodTypeParameter.kt | 6 ++-- ...rrectResultSubstitutorForErrorCandidate.kt | 2 +- .../dslMarker/threeImplicitReceivers.kt | 2 +- .../dslMarker/threeImplicitReceivers2.kt | 2 +- .../testsWithStdLib/addAllProjection.kt | 14 ++++----- .../javaAnnotationWithVarargArgument.kt | 2 +- .../kotlinAnnotationWithVarargArgument.kt | 2 +- .../coroutines/suspendFunctions.kt | 4 +-- .../noInferAnnotation.kt | 2 +- .../purelyImplementedCollection/arrayList.kt | 4 +-- .../arrayListNullable.kt | 2 +- .../customClassMutableCollection.kt | 2 +- .../customClassMutableList.kt | 4 +-- .../purelyImplementedCollection/maps.kt | 30 +++++++++---------- .../mapsWithNullableKey.kt | 18 +++++------ .../mapsWithNullableValues.kt | 20 ++++++------- .../purelyImplementedCollection/sets.kt | 12 ++++---- .../reified/reifiedNothingSubstitution.kt | 6 ++-- .../testsWithStdLib/resolve/kt4711.kt | 2 +- .../checkers/AbstractDiagnosticsTest.kt | 4 ++- 30 files changed, 82 insertions(+), 80 deletions(-) diff --git a/compiler/testData/diagnostics/tests/Variance.kt b/compiler/testData/diagnostics/tests/Variance.kt index c9bc5517ea6..4de5b052a5d 100644 --- a/compiler/testData/diagnostics/tests/Variance.kt +++ b/compiler/testData/diagnostics/tests/Variance.kt @@ -15,7 +15,7 @@ fun foo(c: Consumer, p: Producer, u: Usual) { val p2: Producer = p1 val u1: Usual = u - val u2: Usual = u1 + val u2: Usual = u1 } //Arrays copy example diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/elvisNotProcessed.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/elvisNotProcessed.kt index 660cbbe2082..e17ee5b0c38 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/elvisNotProcessed.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/elvisNotProcessed.kt @@ -34,6 +34,6 @@ val bbb = null ?: ( l() ?: null) val bbbb = ( l() ?: null) ?: ( l() ?: null) fun f(x : Long?): Long { - var a = x ?: (fun() {} ?: fun() {}) + var a = x ?: (fun() {} ?: fun() {}) return a } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt index d9b4e11148e..599e85e9e40 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt @@ -108,7 +108,7 @@ fun testImplicitCoercion() { val h = if (false) 4 else {} bar(if (true) { - 4 + 4 } else { z = 342 diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt index 632964f50a1..8f89d8247d3 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/addAll.kt @@ -24,7 +24,7 @@ fun foo(x: MC) { x.addAll(mc()) x.addAllMC(mc()) - x.addAll(c()) + x.addAll(c()) x.addAll(c()) x.addAllInv(mc()) diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt index 24eb799068e..b5b0572bc15 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt @@ -17,7 +17,7 @@ fun test(a: A, z: Out) { "" } a.bar { Out() } - a.bar { Out() } + a.bar { Out() } a.bar { z.id() } a.foo { diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt index 754cb50168e..ef0a0ba73f8 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeParameterBounds.kt @@ -16,7 +16,7 @@ fun foo2(a: A, b: A) { a.foo1(Out()) a.foo1<Out>(Out()) - a.foo1(Out()) + a.foo1(Out()) a.foo1(Out()) a.foo2(Inv()) diff --git a/compiler/testData/diagnostics/tests/generics/starProjections/invalid.kt b/compiler/testData/diagnostics/tests/generics/starProjections/invalid.kt index 54377f61c05..6c61d165fb9 100644 --- a/compiler/testData/diagnostics/tests/generics/starProjections/invalid.kt +++ b/compiler/testData/diagnostics/tests/generics/starProjections/invalid.kt @@ -17,7 +17,7 @@ fun main(a: A<*>, j: JavaClass<*>, i2: Inv2<*>) { j.foo() checkType { _() } i2.x checkType { _() } - j.bar(1, 2, Any()) + j.bar(1, 2, Any()) j.bar(null) } diff --git a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt index 3000bcfb85d..6adda742074 100644 --- a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt @@ -7,6 +7,6 @@ fun foo1() { fooT22() } -val n : Nothing = null.sure() +val n : Nothing = null.sure() fun T?.sure() : T = this!! diff --git a/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt b/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt index 31bede9221c..c39ab2ce8f4 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/ignoreConstraintFromImplicitInNothing.kt @@ -9,8 +9,8 @@ inline fun foo2(f: (T) -> Unit): Foo = Foo() fun test1() { val f1: Foo = foo1 { it checkType { _() } } - val f2: Foo = foo1 { it checkType { _() } } + val f2: Foo = foo1 { it checkType { _() } } val f3: Foo = foo2 { it checkType { _() } } - val f4: Foo = foo2 { it checkType { _() } } + val f4: Foo = foo2 { it checkType { _() } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt731.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt731.kt index 5cc531a56b1..d81bbf95be4 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt731.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt731.kt @@ -14,6 +14,6 @@ fun A.foo(x: (T)-> G): G { fun main() { val a = A(1) - val t: String = a.foo({p -> p}) + val t: String = a.foo({p -> p}) checkSubtype(t) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.kt b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.kt index 0c63b22b23e..7629ccbec8c 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.kt @@ -11,9 +11,9 @@ public class A { // FILE: k.kt fun test() { - A.bar(null, "") + A.bar(null, "") A.bar(null, "") - A.bar(null, "") - A.bar(null, A.platformString()) + A.bar(null, "") + A.bar(null, A.platformString()) } diff --git a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt index 3aae6947854..8fa76806ef3 100644 --- a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt +++ b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt @@ -2,7 +2,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER fun test(a: Int, b: Boolean) { - bar(a.foo(b)) + bar(a.foo(b)) } fun T.foo(l: (T) -> R): R = TODO() diff --git a/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt b/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt index a8c687035bc..5266a314a10 100644 --- a/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt +++ b/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt @@ -41,7 +41,7 @@ fun test() { baz { y() - x() + x() with(D()) { x() diff --git a/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers2.kt b/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers2.kt index 880b3efec3b..2f819ac657c 100644 --- a/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers2.kt +++ b/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers2.kt @@ -37,7 +37,7 @@ fun test() { baz { y() - x() + x() with(D()) { x() diff --git a/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt b/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt index 14839d203c3..174883622d5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/addAllProjection.kt @@ -1,15 +1,15 @@ // !WITH_NEW_INFERENCE fun test(mc: MutableCollection) { - mc.addAll(mc) + mc.addAll(mc) - mc.addAll(arrayListOf()) - mc.addAll(arrayListOf()) + mc.addAll(arrayListOf()) + mc.addAll(arrayListOf()) - mc.addAll(listOf("")) - mc.addAll(listOf("")) - mc.addAll(listOf("")) + mc.addAll(listOf("")) + mc.addAll(listOf("")) + mc.addAll(listOf("")) - mc.addAll(emptyList()) + mc.addAll(emptyList()) mc.addAll(emptyList()) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/javaAnnotationWithVarargArgument.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/javaAnnotationWithVarargArgument.kt index fe5c333ca20..00348297f80 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/javaAnnotationWithVarargArgument.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/javaAnnotationWithVarargArgument.kt @@ -6,6 +6,6 @@ public @interface A { } // FILE: b.kt -@A(*", "IGNORE")!>arrayOf(1, "b")) +@A(*arrayOf(1, "b")) fun test() { } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/kotlinAnnotationWithVarargArgument.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/kotlinAnnotationWithVarargArgument.kt index c6d1912c46e..87eb60ef350 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/kotlinAnnotationWithVarargArgument.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/kotlinAnnotationWithVarargArgument.kt @@ -2,6 +2,6 @@ annotation class B(vararg val args: String) -@B(*", "IGNORE")!>arrayOf(1, "b")) +@B(*arrayOf(1, "b")) fun test() { } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt index 0c8df1fcc0c..bd8751f3f84 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt @@ -38,7 +38,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } - severalParams("", 89, this as Continuation) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, this as Continuation) checkType { _() } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.kt index e7580563767..b5618b01cfe 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.kt @@ -13,7 +13,7 @@ fun test3(t1: @kotlin.internal.NoInfer T): T = t1 fun usage() { test1(1, "312") 1.test2("") - test3("") + test3("") } @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayList.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayList.kt index cf4acb7060f..00923da31df 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayList.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayList.kt @@ -14,10 +14,10 @@ fun foo() { x[0] = bar() x[0] = "" - val b1: MutableList = x + val b1: MutableList = x val b2: MutableList = x val b3: List = x val b4: Collection = x - val b6: MutableCollection = x + val b6: MutableCollection = x } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayListNullable.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayListNullable.kt index b014f174616..2ae79b83109 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayListNullable.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/arrayListNullable.kt @@ -15,7 +15,7 @@ fun foo() { x[0] = "" val b1: MutableList = x - val b2: MutableList = x + val b2: MutableList = x val b3: List = x val b4: Collection = x diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableCollection.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableCollection.kt index d201e11415d..1afb280e141 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableCollection.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableCollection.kt @@ -29,5 +29,5 @@ fun foo() { x.add("") val b1: Collection = x - val b2: MutableCollection = x + val b2: MutableCollection = x } diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.kt index d832be28d31..1c34e9d3988 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.kt @@ -32,10 +32,10 @@ fun foo() { x[0] = bar() x[0] = "" - val b1: MutableList = x + val b1: MutableList = x val b2: MutableList = x val b3: List = x val b4: Collection = x - val b6: MutableCollection = x + val b6: MutableCollection = x } diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/maps.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/maps.kt index 113f1266686..c244ad304dc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/maps.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/maps.kt @@ -18,14 +18,14 @@ fun hashMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x - val b3: Map = x - val b4: Map = x + val b3: Map = x + val b4: Map = x val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } @@ -42,14 +42,14 @@ fun treeMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x - val b3: Map = x - val b4: Map = x + val b3: Map = x + val b4: Map = x val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } @@ -66,14 +66,14 @@ fun concurrentHashMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x - val b3: Map = x - val b4: Map = x + val b3: Map = x + val b4: Map = x val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableKey.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableKey.kt index e12993e2cf3..56840a4351f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableKey.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableKey.kt @@ -17,15 +17,15 @@ fun hashMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x val b3: Map = x val b4: Map = x - val b5: Map = x + val b5: Map = x - val b6: Int = x[""] - val b7: Int = x[null] - val b8: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x[null] + val b8: Int = x.get("") val b9: Int? = x.get("") } @@ -42,14 +42,14 @@ fun treeMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x val b3: Map = x val b4: Map = x - val b5: Map = x + val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableValues.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableValues.kt index 665c16827df..43e34c7948f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableValues.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/mapsWithNullableValues.kt @@ -17,14 +17,14 @@ fun hashMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x - val b3: Map = x + val b3: Map = x val b4: Map = x - val b5: Map = x + val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } @@ -41,14 +41,14 @@ fun treeMapTest() { x[""] = nullableInt x[""] = 1 - val b1: MutableMap = x + val b1: MutableMap = x val b2: MutableMap = x - val b3: Map = x + val b3: Map = x val b4: Map = x - val b5: Map = x + val b5: Map = x - val b6: Int = x[""] - val b7: Int = x.get("") + val b6: Int = x[""] + val b7: Int = x.get("") val b8: Int? = x.get("") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/sets.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/sets.kt index 17d67f04599..865e8055d9b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/sets.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/sets.kt @@ -10,12 +10,12 @@ fun fooHashSet() { x.add(bar()) x.add("") - val b1: MutableSet = x + val b1: MutableSet = x val b2: MutableSet = x val b3: Set = x val b4: Collection = x - val b6: MutableCollection = x + val b6: MutableCollection = x } fun fooTreeSet() { @@ -24,12 +24,12 @@ fun fooTreeSet() { x.add(bar()) x.add("") - val b1: MutableSet = x + val b1: MutableSet = x val b2: MutableSet = x val b3: Set = x val b4: Collection = x - val b6: MutableCollection = x + val b6: MutableCollection = x } fun fooLinkedHashSet() { @@ -38,10 +38,10 @@ fun fooLinkedHashSet() { x.add(bar()) x.add("") - val b1: MutableSet = x + val b1: MutableSet = x val b2: MutableSet = x val b3: Set = x val b4: Collection = x - val b6: MutableCollection = x + val b6: MutableCollection = x } diff --git a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt index 073a9d0bccd..33f6d20c822 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/reified/reifiedNothingSubstitution.kt @@ -6,11 +6,11 @@ inline fun foo(block: () -> T): String = block().toString() inline fun javaClass(): Class = T::class.java fun box() { - val a = arrayOf(null!!) + val a = arrayOf(null!!) val b = Array<Nothing?>(5) { null!! } - val c = foo() { null!! } + val c = foo() { null!! } val d = foo { null!! } - val e = foo { "1" as Nothing } + val e = foo { "1" as Nothing } val e1 = foo { "1" as Nothing? } val f = javaClass<Nothing>() diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt index adc0cbdf402..d57a6ff4c60 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt @@ -10,7 +10,7 @@ fun main() { val pi = 4.0.toDouble() * delta * (1..n).reduce( {t, i -> val x = (i - 0.5) * delta - t + 1.0 / (1.0 + x * x) + t + 1.0 / (1.0 + x * x) }) // !!! pi has error type here diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index 0f292f78fdb..8406b6fd90b 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -195,7 +195,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { exceptionFromDynamicCallDescriptorsValidation = e } - KotlinTestUtils.assertEqualsToFile(getExpectedDiagnosticsFile(testDataFile), actualText.toString()) { s -> + KotlinTestUtils.assertEqualsToFile(getExpectedDiagnosticsFile(testDataFile), actualText.cleanupInferenceDiagnostics()) { s -> s.replace("COROUTINES_PACKAGE", coroutinesPackage) } @@ -211,6 +211,8 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { ) } + private fun StringBuilder.cleanupInferenceDiagnostics(): String = replace(Regex("NI;([\\S]*), OI;\\1([,!])")) { it.groupValues[1] + it.groupValues[2] } + protected open fun getExpectedDiagnosticsFile(testDataFile: File): File { return testDataFile }