From 816d89e3933a9f62f3554db0040e9ece4d05bf28 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Thu, 30 Nov 2017 14:07:01 +0300 Subject: [PATCH] [NI] Improved testdata after changes in applicabilities This commits introduces testdata changes, where NI behaviour strictly improved, after several previous fixes. For some tests, just WITH_NEW_INFERENCE directive was added. It indicates, that some of previous commits first introduced error in that test, and then some other commit fixed it (netting no overall testdata change). It is preferrably to keep those annotations until we will migrate to NI completely, to prevent unexpected regressions. --- .../ForLoopWithExtensionIteratorOnNullable.kt | 2 +- .../extensionComponentsOnNullable.kt | 6 ++-- .../MultiDeclarationErrors.kt | 2 +- .../tests/extensions/ExtensionFunctions.kt | 2 +- .../diagnostics/tests/generics/kt9203.kt | 1 + .../wrongNumberOfTypeArgumentsDiagnostic.kt | 4 +-- .../tests/imports/ImportOverloadFunctions.kt | 1 + ...gArgumentPassedToLocalExtensionFunction.kt | 2 +- .../InfixCallNullability.kt | 8 ++--- .../tests/nullabilityAndSmartCasts/kt2216.kt | 2 +- .../nullabilityWarnings/arithmetic.kt | 4 +-- .../diagnostics/tests/regressions/kt282.kt | 4 +-- .../diagnostics/tests/regressions/kt5362.kt | 2 +- .../dslMarker/threeImplicitReceivers.kt | 2 +- .../dslMarker/threeImplicitReceivers2.kt | 2 +- ...functionExpectedWhenSeveralInvokesExist.kt | 4 +-- .../specialConstructions/elvisAsCall.kt | 4 +-- .../tests/secondaryConstructors/generics2.kt | 1 + .../tests/secondaryConstructors/kt6993.kt | 1 + .../secondaryConstructors/thisNonExisting.kt | 2 ++ .../smartCasts/objectLiterals/captured.kt | 2 +- .../smartCasts/objectLiterals/exclexcl.kt | 2 +- .../varnotnull/plusplusMinusminus.kt | 2 +- .../targetedBuiltIns/concurrentMapRemove.kt | 1 + .../targetedBuiltIns/mutableMapRemove.kt | 1 + .../tests/targetedBuiltIns/stream.kt | 1 + .../typeAliasConstructorWrongVisibility.kt | 12 +++---- ...typeAliasConstructorWrongVisibility.ni.txt | 4 +-- .../typealias/typeAliasObjectWithInvoke.kt | 3 ++ .../typeAliasObjectWithInvoke.ni.txt | 33 +++++++++++++++++++ .../contracts/smartcasts/deeplyNested.kt | 3 +- .../contracts/smartcasts/intersectingInfo.kt | 13 ++++---- .../contracts/smartcasts/intersectionTypes.kt | 5 +-- .../nullabilitySmartcastWhenNullability.kt | 1 + .../smartcasts/operatorsTests/andOperator.kt | 13 ++++---- .../operatorsTests/equalsOperator.kt | 1 + .../smartcasts/operatorsTests/orOperator.kt | 13 ++++---- .../contracts/smartcasts/receiver.kt | 1 + 38 files changed, 110 insertions(+), 57 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.ni.txt diff --git a/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.kt b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.kt index 541f8f48c27..419a961aa80 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.kt @@ -18,5 +18,5 @@ class OtherContainer(val k: K) { fun test2() { val other: OtherContainer? = null // Error - for (s in other) {} + for (s in other) {} } diff --git a/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.kt b/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.kt index 683c832d6c6..f5bd8be4fda 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.kt @@ -9,7 +9,7 @@ fun foo(): Int { val d: Data? = null // An error must be here val (x, y) = d - return x + y + return x + y } data class NormalData(val x: T, val y: T) @@ -17,6 +17,6 @@ data class NormalData(val x: T, val y: T) fun bar(): Int { val d: NormalData? = null // An error must be here - val (x, y) = d - return x + y + val (x, y) = d + return x + y } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt index d2082c5cf17..4f0debaae31 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt @@ -11,7 +11,7 @@ class MyClass2 {} fun MyClass2.component1() = 1.3 fun test(mc1: MyClass, mc2: MyClass2) { - val (a, b) = mc1 + val (a, b) = mc1 val (c) = mc2 //a,b,c are error types diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index 2b2261ef62e..8164d2d65bc 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -20,7 +20,7 @@ class A infix operator fun A.plus(a : Any) { 1.foo() - true.foo() + true.foo() 1 } diff --git a/compiler/testData/diagnostics/tests/generics/kt9203.kt b/compiler/testData/diagnostics/tests/generics/kt9203.kt index d01e331cbc3..e7503e713fd 100644 --- a/compiler/testData/diagnostics/tests/generics/kt9203.kt +++ b/compiler/testData/diagnostics/tests/generics/kt9203.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // FULL_JDK import java.util.stream.Collectors diff --git a/compiler/testData/diagnostics/tests/generics/wrongNumberOfTypeArgumentsDiagnostic.kt b/compiler/testData/diagnostics/tests/generics/wrongNumberOfTypeArgumentsDiagnostic.kt index 6a9d801228a..cee31ed0e29 100644 --- a/compiler/testData/diagnostics/tests/generics/wrongNumberOfTypeArgumentsDiagnostic.kt +++ b/compiler/testData/diagnostics/tests/generics/wrongNumberOfTypeArgumentsDiagnostic.kt @@ -11,6 +11,6 @@ fun test1() { fun test2() { val m0 = java.util.HashMap() - val m1 = java.util.HashMap() - val m2 = java.util.HashMap() + val m1 = java.util.HashMap() + val m2 = java.util.HashMap() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.kt b/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.kt index 59c504c06a5..325bbe9e0aa 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE +// !WITH_NEW_INFERENCE // FILE: 1.kt package k diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt index b0f02ede1de..b46e39f8f5b 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt @@ -13,7 +13,7 @@ fun test(f: Runnable.(Int) -> Unit, runnable: Runnable) { fun Int.test(f: String.(Int) -> Unit) { f("", 0) - f("") + f("") with("") { f(0) f(0.0) diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt index a865800f548..8762c3ab6f7 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt @@ -9,17 +9,17 @@ operator infix fun A.div(i : Int) {} operator infix fun A?.times(i : Int) {} fun test(x : Int?, a : A?) { - x.plus(1) + x.plus(1) x?.plus(1) - x + 1 + x + 1 -x x.unaryMinus() x?.unaryMinus() - a.plus(1) + a.plus(1) a?.plus(1) a plus 1 - a + 1 + a + 1 -a a.unaryMinus() a?.unaryMinus() diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2216.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2216.kt index 0dda48f605e..d5cbe11a26d 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2216.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2216.kt @@ -16,7 +16,7 @@ fun foo() { val y: Int? = 0 val z: Int? = 0 bar(if (y != null) y else z, y) - y + 2 + y + 2 baz(y, y, if (y == null) return else y, y) baz(y, z!!, z, y) } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt index 5762b49cb30..c04b26a0a7a 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt @@ -38,7 +38,7 @@ fun test() { 1 + platformJ platformNN + 1 - platformN + 1 + platformN + 1 platformJ + 1 1 plus platformNN @@ -50,6 +50,6 @@ fun test() { platformJ plus 1 platformNN += 1 - platformN += 1 + platformN += 1 platformJ += 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt282.kt b/compiler/testData/diagnostics/tests/regressions/kt282.kt index 534cd59c739..add5982d012 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt282.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt282.kt @@ -12,8 +12,8 @@ operator fun Int?.contains(x : Int) : Boolean = false fun f(): Unit { var set : Set? = null val i : Int? = null - i + 1 + i + 1 set + 1 - 1 in set + 1 in set 1 in 2 } diff --git a/compiler/testData/diagnostics/tests/regressions/kt5362.kt b/compiler/testData/diagnostics/tests/regressions/kt5362.kt index e6a694f5a77..087b3f8ca2e 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt5362.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt5362.kt @@ -25,7 +25,7 @@ public class Manager { class Task(val callback: Manager.() -> Unit) : Runnable { override public fun run() { - callback() // Manager is not accessible here, but no error is shown + callback() // Manager is not accessible here, but no error is shown } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt b/compiler/testData/diagnostics/tests/resolve/dslMarker/threeImplicitReceivers.kt index 4caa9282a22..a8c687035bc 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 e3de4f47a40..880b3efec3b 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/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.kt b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.kt index 3acf3163842..54f271c4dbf 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.kt @@ -8,7 +8,7 @@ class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { identifier() - identifier(123) - identifier(1, 2) + identifier(123) + identifier(1, 2) 1.fn() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/elvisAsCall.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/elvisAsCall.kt index 99b8136a494..8caafdeeb43 100644 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/elvisAsCall.kt +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/elvisAsCall.kt @@ -23,13 +23,13 @@ fun testDataFlowInfo1(a: Int?, b: Int?) { val c: Int = a ?: b!! doInt(c) // b is nullable if a != null - b + 1 + b + 1 } fun testDataFlowInfo2(a: Int?, b: Int?) { doInt(a ?: b!!) // b is nullable if a != null - b + 1 + b + 1 } fun testTypeMismatch(a: String?, b: Any) { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.kt index 11f0ab82b12..f6929e9fb71 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +// !WITH_NEW_INFERENCE open class B(x: R1, y: R2) class A0 { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/kt6993.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/kt6993.kt index 16002652544..736edb67a42 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/kt6993.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/kt6993.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +// !WITH_NEW_INFERENCE class X(val t: T) { constructor(t: T, i: Int) : this(i) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/thisNonExisting.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/thisNonExisting.kt index ea6583bf1ab..12230ab2219 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/thisNonExisting.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/thisNonExisting.kt @@ -1,4 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +// !WITH_NEW_INFERENCE + class A { constructor(x: Int) {} constructor(x: String) {} diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt index 8e622fb5467..4edee8fe60c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt @@ -17,7 +17,7 @@ fun foo(): Int { k.run() val d: Int = c // a is captured so smart cast is not possible - return d + a + return d + a } else return -1 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/exclexcl.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/exclexcl.kt index 24c38b0349c..0ab702ecc3d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/exclexcl.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/exclexcl.kt @@ -16,7 +16,7 @@ fun foo(): Int { k.run() val d: Int = c // a is not null because of k constructor, but we do not know it - return a + d + return a + d } else return -1 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.kt index fca1eea8bf3..906039eceeb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.kt @@ -15,7 +15,7 @@ fun bar(arg: Long?): Long { return i-- + i } if (i++ == 7L) { - return i++ + i + return i++ + i } return 0L } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/concurrentMapRemove.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/concurrentMapRemove.kt index 23ac45b6830..a241bdce431 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/concurrentMapRemove.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/concurrentMapRemove.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // FULL_JDK import java.util.concurrent.* diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/mutableMapRemove.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/mutableMapRemove.kt index b0a4a912026..40016362b96 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/mutableMapRemove.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/mutableMapRemove.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE +// !WITH_NEW_INFERENCE // FULL_JDK class KotlinMap1 : java.util.AbstractMap() { diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt index 0792fa81854..678abf38109 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/stream.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // FULL_JDK import java.util.stream.* diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.kt index 175dd129a00..d46c107b689 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.kt @@ -10,18 +10,18 @@ open class MyClass private constructor(val x: Int) { typealias MyAlias = MyClass -val test1 = MyAlias(1) -val test1a = MyClass(1) +val test1 = MyAlias(1) +val test1a = MyClass(1) -val test2 = MyAlias("") -val test2a = MyClass("") +val test2 = MyAlias("") +val test2a = MyClass("") val test3 = MyAlias(1.0) val test3a = MyClass(1.0) class MyDerived : MyClass(1.0) { - val test4 = MyAlias(1) - val test4a = MyClass(1) + val test4 = MyAlias(1) + val test4a = MyClass(1) val test5 = MyAlias("") val test5a = MyClass("") val test6 = MyAlias(1.0) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.ni.txt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.ni.txt index a988147485d..b8f5d91237e 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.ni.txt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongVisibility.ni.txt @@ -19,8 +19,8 @@ public open class MyClass { public final class MyDerived : MyClass { public constructor MyDerived() - public final val test4: [ERROR : Type for MyAlias(1)] - public final val test4a: [ERROR : Type for MyClass(1)] + public final val test4: MyAlias /* = MyClass */ + public final val test4a: MyClass public final val test5: MyAlias /* = MyClass */ public final val test5a: MyClass public final val test6: MyAlias /* = MyClass */ diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.kt index 6e4059292de..51940a6ec13 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.kt @@ -1,3 +1,6 @@ +// !WITH_NEW_INFERENCE +// NI_EXPECTED_FILE + object ObjectWithInvoke { operator fun invoke() = this } diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.ni.txt b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.ni.txt new file mode 100644 index 00000000000..809fa64eb98 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.ni.txt @@ -0,0 +1,33 @@ +package + +public val test1: ObjectWithInvoke +public val test2: ObjectWithInvoke +public val test3: CWI /* = ClassWithCompanionObjectWithInvoke */ +public val test4: kotlin.Any +public val test5: kotlin.Any +public val test5a: kotlin.Any + +public final class ClassWithCompanionObjectWithInvoke { + public constructor ClassWithCompanionObjectWithInvoke() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ x: kotlin.Any): kotlin.Any + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public object ObjectWithInvoke { + private constructor ObjectWithInvoke() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(): ObjectWithInvoke + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} +public typealias CWI = ClassWithCompanionObjectWithInvoke +public typealias WI = ObjectWithInvoke diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt index 3a0ed45f125..686f5683fef 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* @@ -97,6 +98,6 @@ fun branchedAndNestedWithNativeOperators(x: Any?, y: Any?) { ) x.length y.length - y.inc() + y.inc() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt index e6af8cbadaf..239705e634d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* @@ -29,12 +30,12 @@ fun intersectingInfo(x: Any?, y: Any?) { if ((isString(x) && y is String) || (!notIsString(x) && !notIsInt(y))) { x.length y.length - y.inc() + y.inc() } else { x.length y.length - y.inc() + y.inc() } } @@ -47,13 +48,13 @@ fun intersectingInfo2(x: Any?, y: Any?) { (!notIsString(x) && isString(y) && y is Int) || (x is String && !notIsInt(y) && x is Int)) { x.length - x.inc() + x.inc() y.length - y.inc() + y.inc() } x.length - x.inc() + x.inc() y.length - y.inc() + y.inc() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt index 97350d5d023..c8988438e1d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* @@ -26,7 +27,7 @@ fun testDeMorgan(x: Any?) { } else { x.length - x.inc() + x.inc() } } @@ -34,7 +35,7 @@ fun testDeMorgan2(x: Any?) { // x !is String || x !is Int if (notIsString(x) || notIsInt(x)) { x.length - x.inc() + x.inc() } else { x.length diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt index 13c61bf314e..0de4ae7fd1f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt index 9e6bdc226a5..3874cddcb8c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* @@ -40,17 +41,17 @@ fun truetrue(x: Any?) { x.inc() } x.length - x.inc() + x.inc() } fun truefalse(x: Any?) { if (trueWhenString(x) && falseWhenInt(x)) { x.length - x.inc() + x.inc() } else { x.length - x.inc() + x.inc() } } @@ -61,19 +62,19 @@ fun falsetrue(x: Any?) { } else { x.length - x.inc() + x.inc() } } fun falsefalse(x: Any?) { if (falseWhenString(x) && falseWhenInt(x)) { x.length - x.inc() + x.inc() } else { // Note that we can't argue that we have any of smartcasts here, // because we don't know which one of both arguments was 'false' to bring us here x.length - x.inc() + x.inc() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt index fda2a6e15cb..159ce4370f3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt index 7344aa03c97..01a7a852133 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.* @@ -34,18 +35,18 @@ fun falseWhenInt(x: Any?): Boolean { fun truetrue(x: Any?) { if (trueWhenString(x) || trueWhenInt(x)) { x.length - x.inc() + x.inc() } else { x.length - x.inc() + x.inc() } } fun truefalse(x: Any?) { if (trueWhenString(x) || falseWhenInt(x)) { x.length - x.inc() + x.inc() } else { x.length @@ -56,18 +57,18 @@ fun truefalse(x: Any?) { fun falsetrue(x: Any?) { if (falseWhenString(x) || trueWhenInt(x)) { x.length - x.inc() + x.inc() } else { x.length - x.inc() + x.inc() } } fun falsefalse(x: Any?) { if (falseWhenString(x) || falseWhenInt(x)) { x.length - x.inc() + x.inc() } else { x.length diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt index 99df8f78efd..2da15b538b8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +ReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER +// !WITH_NEW_INFERENCE import kotlin.internal.contracts.*