From bcc88020140c4e01fcf24730dced3594d2147390 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Wed, 17 Apr 2019 03:04:58 +0300 Subject: [PATCH] [NI] Avoid constraints from expected type for effectively empty system Expression will be checked against expected type later. Theoretically, this is not very good, but it aligns with the old inference, plus it helps avoiding multiple type mismatch diagnostics. --- .../calls/components/KotlinCallCompleter.kt | 5 +++++ .../testData/diagnostics/tests/AutoCreatedIt.kt | 2 +- compiler/testData/diagnostics/tests/Basic.kt | 2 +- .../tests/BinaryCallsOnNullableValues.kt | 6 +++--- .../tests/DefaultValuesTypechecking.kt | 4 ++-- .../diagnostics/tests/EnumEntryAsType.kt | 6 +++--- .../diagnostics/tests/FunctionReturnTypes.kt | 2 +- .../diagnostics/tests/PackageQualified.kt | 2 +- .../tests/SafeCallNonNullReceiverReturnNull.kt | 2 +- compiler/testData/diagnostics/tests/Variance.kt | 8 ++++---- .../tests/annotations/kt1860-negative.kt | 2 +- .../tests/annotations/kt1860-positive.kt | 2 +- .../generic/genericFunctionsWithNullableTypes.kt | 2 +- .../diagnostics/tests/cast/AsInBinaryUnary.kt | 4 ++-- .../tests/checkArguments/booleanExpressions.kt | 8 ++++---- .../kt770.kt351.kt735_StatementType.kt | 4 ++-- .../specialConstructsAndPlatformTypes.kt | 2 +- .../diagnostics/tests/cyclicHierarchy/kt303.kt | 2 +- .../tests/dataFlowInfoTraversal/Return.kt | 2 +- .../ComponentFunctionReturnTypeMismatch.kt | 2 +- .../FolLoopTypeComponentTypeMismatch.kt | 2 +- .../destructuringDeclarations/underscore.kt | 2 +- .../inference/differentDelegatedExpressions.kt | 4 ++-- .../inference/genericMethodInGenericClass.kt | 2 +- .../noOperatorModifierOnProvideDelegate.kt | 2 +- .../unsupportedOperatorProvideDelegate.kt | 2 +- .../typeMismatchForGetReturnType.kt | 2 +- .../delegation/clashes/finalMemberOverridden.kt | 2 +- .../severalDelegates.kt | 2 +- .../diagnostics/tests/evaluate/divisionByZero.kt | 2 +- .../inferredFunctionalType.kt | 4 ++-- .../destructuringInLambdas/simple.kt | 4 ++-- .../destructuringInLambdas/underscore.kt | 2 +- .../capturedParameters/innerLocalClass.kt | 2 +- .../generics/capturedParameters/localClass.kt | 2 +- .../generics/capturedParameters/objectLiteral.kt | 2 +- .../tests/generics/innerClasses/iterator.kt | 2 +- .../generics/innerClasses/qualifiedOuter.kt | 2 +- ...considerTypeNotNullOnlyIfItHasNotNullBound.kt | 2 +- .../nullability/smartCastsValueArgument.kt | 4 ++-- .../tests/generics/nullability/tpInBounds.kt | 4 ++-- .../tests/generics/projectionsScope/kt7296.kt | 2 +- .../projectionsScope/typeMismatchInLambda.kt | 2 +- .../varProjection/setterNotProjectedOutAssign.kt | 2 +- ...oercionToUnitForIfAsLastExpressionInLambda.kt | 2 +- .../diagnostics/tests/inference/kt1293.kt | 2 +- .../tests/inference/regressions/kt2883.kt | 2 +- .../upperBounds/useBoundsIfUnknownParameters.kt | 2 +- .../diagnostics/tests/infos/SmartCasts.kt | 4 ++-- ...lineLambdaInDefaultInlineParameterDisabled.kt | 2 +- .../samByProjectedType/genericInReturnType.kt | 2 +- compiler/testData/diagnostics/tests/kt310.kt | 2 +- .../diagnostics/tests/library/Collections.kt | 16 ++++++++-------- .../sameClassNameDifferentPackages.kt | 2 +- .../testData/diagnostics/tests/objects/kt5527.kt | 6 +++--- .../nullabilityWarnings/assignToVar.kt | 2 +- .../nullabilityWarnings/conditions.kt | 10 +++++----- .../nullabilityWarnings/dataFlowInfo.kt | 4 ++-- .../nullabilityWarnings/defaultParameters.kt | 2 +- .../nullabilityWarnings/delegation.kt | 2 +- .../nullabilityWarnings/passToJava.kt | 8 ++++---- .../platformTypes/nullabilityWarnings/throw.kt | 2 +- .../regressions/TypeMismatchOnUnaryOperations.kt | 2 +- .../diagnostics/tests/regressions/kt251.kt | 4 ++-- .../overloadConflicts/originalExamples.kt | 2 +- .../tests/scopes/inheritance/methodsPriority.kt | 2 +- .../inheritFromContainingClass_after.kt | 4 ++-- .../inheritFromContainingClass_before.kt | 4 ++-- .../scopes/inheritance/statics/localVsStatic.kt | 2 +- .../script/destructuringDeclarationsScript.kts | 2 +- .../tests/secondaryConstructors/return.kt | 2 +- .../tests/smartCasts/elvisExprNotNull.kt | 2 +- .../tests/smartCasts/explicitDefaultGetter.kt | 2 +- .../tests/smartCasts/propertyToNotNull.kt | 2 +- .../tests/smartCasts/safecalls/anotherVal.kt | 2 +- .../smartCasts/safecalls/falseSecondArgument.kt | 2 +- .../safecalls/receiverAndChainFalse.kt | 2 +- .../tests/smartCasts/varnotnull/forEach.kt | 2 +- .../smartCasts/varnotnull/forEachWithBreak.kt | 2 +- .../smartCasts/varnotnull/forEachWithContinue.kt | 2 +- .../tests/smartCasts/varnotnull/varIntNull.kt | 2 +- .../diagnostics/tests/subtyping/localClasses.kt | 2 +- .../tests/subtyping/nestedIntoLocalClasses.kt | 2 +- .../tests/subtyping/nestedLocalClasses.kt | 2 +- .../samAdapters/InnerClassInGeneric.kt | 2 +- .../diagnostics/tests/when/BranchBypassVal.kt | 2 +- .../diagnostics/tests/when/BranchBypassVar.kt | 2 +- 87 files changed, 130 insertions(+), 125 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index 6bf753df18b..f66bc91c25b 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -148,6 +148,11 @@ class KotlinCallCompleter( if (returnType == null) return if (expectedType == null || TypeUtils.noExpectedType(expectedType)) return + // This is needed to avoid multiple mismatch errors as we type check resulting type against expected one later + // Plus, it helps with IDE-tests where it's important to have particular diagnostics. + // Note that it aligns with the old inference, see CallCompleter.completeResolvedCallAndArguments + if (csBuilder.currentStorage().notFixedTypeVariables.isEmpty()) return + // We don't add expected type constraint for constant expression like "1 + 1" because of type coercion for numbers: // val a: Long = 1 + 1, note that result type of "1 + 1" will be Int and adding constraint with Long will produce type mismatch if (!resolutionCallbacks.isCompileTimeConstant(resolvedCall, expectedType)) { diff --git a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt index 7110379adda..db0b1006919 100644 --- a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt +++ b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt @@ -13,7 +13,7 @@ fun text() { bar2 {} bar2 {1} bar2 {it} - bar2 {it -> it} + bar2 {it -> it} } fun bar(f : (Int, Int) -> Int) {} diff --git a/compiler/testData/diagnostics/tests/Basic.kt b/compiler/testData/diagnostics/tests/Basic.kt index 3d820e00bb1..c12c76e6811 100644 --- a/compiler/testData/diagnostics/tests/Basic.kt +++ b/compiler/testData/diagnostics/tests/Basic.kt @@ -10,7 +10,7 @@ fun test() : Int { } class A() { - val x : Int = foo1(xx) + val x : Int = foo1(xx) } fun foo1() {} diff --git a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt index c4142161c76..54855bdc82d 100644 --- a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt +++ b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt @@ -26,7 +26,7 @@ fun f(): Unit { x in 1..2 val y : Boolean? = true - false || y - y && true - y && 1 + false || y + y && true + y && 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt index e2e2c7cc335..1d53a3591c7 100644 --- a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt +++ b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt @@ -1,14 +1,14 @@ // !WITH_NEW_INFERENCE val x = "" -fun bar(x : Int = "", y : Int = x, z : String = y) { +fun bar(x : Int = "", y : Int = x, z : String = y) { } // KT-371 Resolve default parameters for constructors class A(x : Int = y, y : Int = x) { // None of the references is resolved, no types checked - fun foo(bool: Boolean, a: Int = b, b: String = a) {} + fun foo(bool: Boolean, a: Int = b, b: String = a) {} } val z = 3 diff --git a/compiler/testData/diagnostics/tests/EnumEntryAsType.kt b/compiler/testData/diagnostics/tests/EnumEntryAsType.kt index 383a58c73ec..ff475d00452 100644 --- a/compiler/testData/diagnostics/tests/EnumEntryAsType.kt +++ b/compiler/testData/diagnostics/tests/EnumEntryAsType.kt @@ -9,7 +9,7 @@ enum class Color { class MyColor(val x: Color.RED, y: Color.RED) : Color.RED { - var z: Color.RED = Color.RED + var z: Color.RED = Color.RED set(arg: Color.RED) { z = arg } fun foo(arg: Color.RED): Color.RED = arg @@ -17,7 +17,7 @@ class MyColor(val x: Color.RED, y: Color.RED { class Local : Color.RED fun local(arg: Color.RED): Color.RED = arg - val temp: Color.RED = Color.RED + val temp: Color.RED = Color.RED temp as? Color.RED if (temp is Color.RED) { return temp as Color.RED @@ -26,7 +26,7 @@ class MyColor(val x: Color.RED, y: Color.obj is Color.RED) { return obj } - return Color.RED + return Color.RED } } diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index c049c95fb57..8709c938ffc 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -45,7 +45,7 @@ fun intFunctionLiteral(): Int = { 1 fun blockReturnUnitMismatch() : Int {return} fun blockReturnValueTypeMismatch() : Int {return 3.4} fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return Unit} +fun blockReturnValueTypeMismatchUnit() : Int {return Unit} fun blockAndAndMismatch() : Int { true && false diff --git a/compiler/testData/diagnostics/tests/PackageQualified.kt b/compiler/testData/diagnostics/tests/PackageQualified.kt index f37ddce8df4..a0f38399b6b 100644 --- a/compiler/testData/diagnostics/tests/PackageQualified.kt +++ b/compiler/testData/diagnostics/tests/PackageQualified.kt @@ -20,7 +20,7 @@ abstract class Foo() { package foobar.a import java.util.* - val b : List? = a + val b : List? = a val b1 : util.List? = a // FILE: b.kt diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt index 44d3feb0d78..eccc9ecef1c 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt @@ -3,5 +3,5 @@ fun Int.gg() = null fun ff() { val a: Int = 1 - val b: Int = a?.gg() + val b: Int = a?.gg() } diff --git a/compiler/testData/diagnostics/tests/Variance.kt b/compiler/testData/diagnostics/tests/Variance.kt index 6af79f87cb3..c9bc5517ea6 100644 --- a/compiler/testData/diagnostics/tests/Variance.kt +++ b/compiler/testData/diagnostics/tests/Variance.kt @@ -8,14 +8,14 @@ abstract class Producer {} abstract class Usual {} fun foo(c: Consumer, p: Producer, u: Usual) { - val c1: Consumer = c + val c1: Consumer = c val c2: Consumer = c1 val p1: Producer = p - val p2: Producer = p1 + val p2: Producer = p1 - val u1: Usual = u - val u2: Usual = u1 + val u1: Usual = u + val u2: Usual = u1 } //Arrays copy example diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt index b9ac57a2ee3..bed18d44445 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt @@ -4,7 +4,7 @@ fun foo(@varargs f : Int) {} var bar : Int = 1 set(@varargs v) {} -val x : (Int) -> Int = {@varargs x : Int -> x} +val x : (Int) -> Int = {@varargs x : Int -> x} class Hello(@varargs args: Any) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt index 74d7ad2cb64..3b5cde4b8d8 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt @@ -8,7 +8,7 @@ fun foo(@test f : Int) {} var bar : Int = 1 set(@test v) {} -val x : (Int) -> Int = {@test x : Int -> x} // todo fix parser annotation on lambda parameter +val x : (Int) -> Int = {@test x : Int -> x} // todo fix parser annotation on lambda parameter class Hello(@test args: Any) { } diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt b/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt index f291e692e14..b3e430d19b8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/genericFunctionsWithNullableTypes.kt @@ -33,5 +33,5 @@ fun test(x: T) { val s4: Pair = bar(null, null, ::foo) val s5: Pair = bar(1, "", ::foo) - val (a1: Int, b1: String) = bar(1, "", ::foo) + val (a1: Int, b1: String) = bar(1, "", ::foo) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/AsInBinaryUnary.kt b/compiler/testData/diagnostics/tests/cast/AsInBinaryUnary.kt index 433edcaa998..e99f82e46bd 100644 --- a/compiler/testData/diagnostics/tests/cast/AsInBinaryUnary.kt +++ b/compiler/testData/diagnostics/tests/cast/AsInBinaryUnary.kt @@ -20,11 +20,11 @@ operator fun Impl2.unaryMinus() = Impl2() // See also KT-10384: in non-error functions, as is necessary! fun add1(x: Impl2, y: Base): Impl1 = x as Base + y -fun error1(x: Impl2, y: Base): Impl1 = x + y +fun error1(x: Impl2, y: Base): Impl1 = x + y fun add2(x: Base, y: Impl2): Impl1 = x + y as Base -fun error2(x: Base, y: Impl2): Impl1 = x + y +fun error2(x: Base, y: Impl2): Impl1 = x + y fun minus3(x: Impl2): Impl1 = -(x as Base) diff --git a/compiler/testData/diagnostics/tests/checkArguments/booleanExpressions.kt b/compiler/testData/diagnostics/tests/checkArguments/booleanExpressions.kt index 65c6b28d2b9..ef0b86b1202 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/booleanExpressions.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/booleanExpressions.kt @@ -1,7 +1,7 @@ // !WITH_NEW_INFERENCE fun foo1(b: Boolean, c: Int) { - if (b && c) {} - if (b || c) {} - if (c && b) {} - if (c || b) {} + if (b && c) {} + if (b || c) {} + if (c && b) {} + if (c || b) {} } 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 a0f4d3b4d35..d9b4e11148e 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt @@ -27,7 +27,7 @@ fun foo() { z = 34 } } - val f: ()-> Int = r + val f: ()-> Int = r val g: ()-> Any = r } @@ -80,7 +80,7 @@ fun testCoercionToUnit() { 45 } } - val f : () -> String = checkType + val f : () -> String = checkType } fun doSmth(i: Int) {} diff --git a/compiler/testData/diagnostics/tests/controlStructures/specialConstructsAndPlatformTypes.kt b/compiler/testData/diagnostics/tests/controlStructures/specialConstructsAndPlatformTypes.kt index 5f6ffc58b5a..6701e083bf1 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/specialConstructsAndPlatformTypes.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/specialConstructsAndPlatformTypes.kt @@ -12,7 +12,7 @@ public class J { val testImplicitExclExcl1: String = J.s val testImplicitExclExcl2: String? = J.s -val testImplicitExclExcl3: String = J.m[""] +val testImplicitExclExcl3: String = J.m[""] val testImplicitExclExcl4: String? = J.m[""] val testExclExcl1: String = J.s!! diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/kt303.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/kt303.kt index 6f9879f4238..6a10987081e 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/kt303.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/kt303.kt @@ -9,4 +9,4 @@ open class Bar() : Foo() { } -val x : Int = Foo() +val x : Int = Foo() diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Return.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Return.kt index 29792de3840..f238bbddf38 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Return.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Return.kt @@ -14,5 +14,5 @@ fun foo(): Int { val z: Int? = null if (z != null) return if (z == null) z else z - return z + return z } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt b/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt index 0e15d8c1d53..71e9390c6d3 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt @@ -5,5 +5,5 @@ class A { } fun a(aa : A) { - val (a: String, b1: String) = aa + val (a: String, b1: String) = aa } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt index 18898c2e515..cc370383f35 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt @@ -9,7 +9,7 @@ class C { } fun test() { - for ((x: Double, y: Int) in C()) { + for ((x: Double, y: Int) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt index 786d0a55f99..8725abe00de 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt @@ -26,7 +26,7 @@ fun test() { foo(_, _) } - for ((_ : String, _ : Int) in C()) { + for ((_ : String, _ : Int) in C()) { foo(_, _) } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt index 3b587e9a4c0..b4788b32450 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt @@ -12,8 +12,8 @@ class A(outer: Outer) { var b: String by foo(getMyProperty()) var r: String by foo(outer.getContainer().getMyProperty()) - var e: String by + foo(getMyProperty()) - var f: String by foo(getMyProperty()) - 1 + var e: String by + foo(getMyProperty()) + var f: String by foo(getMyProperty()) - 1 } fun foo(a: Any?) = MyProperty() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt index 426f6a8ccef..13cdf6a375e 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt @@ -25,4 +25,4 @@ class C() { } var c1: Int by C() -var c2: Int by C() +var c2: Int by C() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt index e1740e837a5..6cc2b6c2221 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt @@ -13,6 +13,6 @@ fun String.provideDelegate(a: Any?, p: KProperty<*>) = StringDelegate(this) operator fun String.getValue(a: Any?, p: KProperty<*>) = this val test1: String by "OK" -val test2: Int by "OK" +val test2: Int by "OK" val test3 by "OK" diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/unsupportedOperatorProvideDelegate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/unsupportedOperatorProvideDelegate.kt index d73903ce1e0..ce168f0cb2a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/unsupportedOperatorProvideDelegate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/unsupportedOperatorProvideDelegate.kt @@ -11,5 +11,5 @@ class WrongDelegate(val x: Int) { operator fun String.getValue(thisRef: Any?, prop: Any) = this val test1: String by "OK" -val test2: Int by "OK" +val test2: Int by "OK" val test3 by "OK" \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt index 4da869760da..884b0ccfedb 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt @@ -3,7 +3,7 @@ import kotlin.reflect.KProperty -val c: Int by Delegate() +val c: Int by Delegate() class Delegate { operator fun getValue(t: Any?, p: KProperty<*>): String { diff --git a/compiler/testData/diagnostics/tests/delegation/clashes/finalMemberOverridden.kt b/compiler/testData/diagnostics/tests/delegation/clashes/finalMemberOverridden.kt index 5a0a087013d..dc6663af184 100644 --- a/compiler/testData/diagnostics/tests/delegation/clashes/finalMemberOverridden.kt +++ b/compiler/testData/diagnostics/tests/delegation/clashes/finalMemberOverridden.kt @@ -53,4 +53,4 @@ class CBarT : IBarT { class Test7 : Final(), IBarT by CBarT() -class Test8 : Final(), IBarT by CBar() +class Test8 : Final(), IBarT by CBar() diff --git a/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/severalDelegates.kt b/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/severalDelegates.kt index 1ff9963b1ee..8260598308f 100644 --- a/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/severalDelegates.kt +++ b/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/severalDelegates.kt @@ -23,6 +23,6 @@ public abstract class MyClass : Base1, Base2 { } } -class A : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() { +class A : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt b/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt index ea1c09a76d5..f58114b824e 100644 --- a/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt +++ b/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt @@ -12,7 +12,7 @@ val a7 = 1.div(a1) val a8 = 1.div(a2) val a9 = 2 * (1.div(0)) -val b1: Byte = 1 / 0 +val b1: Byte = 1 / 0 @Ann(1 / 0) val b2 = 1 annotation class Ann(val i : Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.kt index 7e1244e7913..bf44f13a905 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.kt @@ -22,8 +22,8 @@ fun bar(aList: List) { b checkType { _() } } - aList.foo { (a: String, b) -> - a checkType { _() } + aList.foo { (a: String, b) -> + a checkType { _() } b checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.kt index d579dc46b2d..7f7ca456609 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.kt @@ -42,8 +42,8 @@ fun bar() { d checkType { _() } } - foo { (a: String, b) -> - a checkType { _() } + foo { (a: String, b) -> + a checkType { _() } b checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt index 995ef00f2b6..5bae03b2eff 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt @@ -51,7 +51,7 @@ fun bar() { _ checkType { _() } } - foo { (_: String, b) -> + foo { (_: String, b) -> _.hashCode() b checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.kt index 7a71dcf7276..fba197b17fa 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.kt @@ -20,7 +20,7 @@ private class Outer { private var doubleStringInt = Outer().Inner().foo()() private fun bar() { - doubleCharSequenceInt = doubleStringNumber + doubleCharSequenceInt = doubleStringNumber doubleCharSequenceInt = doubleStringInt doubleStringInt = Outer().Inner().foo()() diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.kt index 8f5b7adb8af..983949fc3e9 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.kt @@ -15,7 +15,7 @@ class Q { private var y = foo()() fun bar() { - x = y + x = y x = foo()() y = foo()() diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/objectLiteral.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/objectLiteral.kt index c9ea22ad7b3..08cd7c2008a 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/objectLiteral.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/objectLiteral.kt @@ -13,7 +13,7 @@ class Q { private var y = foo() fun bar() { - x = y + x = y x = foo() y = foo() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.kt index 87e065d0ce3..ba8304bdef5 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.kt @@ -29,7 +29,7 @@ fun commonSupertype(x: E, y: E): E = x fun foo() { var myIt = A().iterator() - myIt = A().iterator() + myIt = A().iterator() val csIt: Iterator = A().iterator() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.kt index 4c8e862fbf7..9dab49456cb 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.kt @@ -11,7 +11,7 @@ class Outer { z.checkType { _() } z.checkType { _.Inner>() } - inner = x + inner = x } class Nested diff --git a/compiler/testData/diagnostics/tests/generics/nullability/considerTypeNotNullOnlyIfItHasNotNullBound.kt b/compiler/testData/diagnostics/tests/generics/nullability/considerTypeNotNullOnlyIfItHasNotNullBound.kt index e791f13517f..db106d01917 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/considerTypeNotNullOnlyIfItHasNotNullBound.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/considerTypeNotNullOnlyIfItHasNotNullBound.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +NewInference inline fun foo(x: T?, y: T): T { - if (x is S) return x + if (x is S) return x return y } diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsValueArgument.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsValueArgument.kt index 92486a37bc2..7449ffe9b10 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsValueArgument.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsValueArgument.kt @@ -12,7 +12,7 @@ fun foo(x: T) { if (x != null) {} y1 = x - y2 = x + y2 = x bar1(x) bar1(x) @@ -31,7 +31,7 @@ fun foo(x: T) { if (x is CharSequence) { y1 = x - y2 = x + y2 = x bar1(x) bar2(x) diff --git a/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.kt b/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.kt index fd2989b84c0..2294e02915e 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.kt @@ -24,10 +24,10 @@ class A { } if (1 == 1) { - t = tN + t = tN } - t = y + t = y if (y != null) { t = y diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.kt index 44c46edf58d..a34babd823e 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.kt @@ -9,7 +9,7 @@ fun main() { val a : ArrayList> = ArrayList() val b : ListOfLists = ListOfLists(a) val c : ListOfLists<*> = b - val d : ArrayList> = c.x + val d : ArrayList> = c.x c.x checkType { _>>() } } diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt index ae517f771ab..24eb799068e 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt @@ -18,7 +18,7 @@ fun test(a: A, z: Out) { } a.bar { Out() } a.bar { Out() } - a.bar { z.id() } + a.bar { z.id() } a.foo { z.foobar(if (1 > 2) return@foo "" else "") diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterNotProjectedOutAssign.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterNotProjectedOutAssign.kt index b72c5e14314..3a985d9f749 100644 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterNotProjectedOutAssign.kt +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterNotProjectedOutAssign.kt @@ -5,6 +5,6 @@ interface Tr { } fun test(t: Tr<*>) { - t.v = t + t.v = t t.v checkType { _>() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt index b232d44632e..056d3472cc6 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt @@ -12,7 +12,7 @@ fun foo(): String? { run { if (true) return@run - if (true) return Obj() // correct error, type check against return type of function "foo" + if (true) return Obj() // correct error, type check against return type of function "foo" } run { diff --git a/compiler/testData/diagnostics/tests/inference/kt1293.kt b/compiler/testData/diagnostics/tests/inference/kt1293.kt index bc4bc63e5ea..9d48301a5cc 100644 --- a/compiler/testData/diagnostics/tests/inference/kt1293.kt +++ b/compiler/testData/diagnostics/tests/inference/kt1293.kt @@ -5,7 +5,7 @@ package kt1293 fun main() { val intArray = arrayOfNulls(10) - val i : Int = intArray[0] + val i : Int = intArray[0] requiresInt(intArray[0]) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt index 572ab5a249b..31cb85319f3 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt @@ -29,5 +29,5 @@ fun testWithoutInference(col: MutableCollection) { doAction { col.add(2) } - val u: Unit = col.add(2) + val u: Unit = col.add(2) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt index 1bb4b7d73a4..fb46c5cf4c5 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt @@ -8,5 +8,5 @@ class Client>(x: X) fun test() { val c = Client(StringBase()) // Type inference fails here for T. - val i : Int = c + val i : Int = c } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/infos/SmartCasts.kt b/compiler/testData/diagnostics/tests/infos/SmartCasts.kt index c4c51b922d9..f410f1e4479 100644 --- a/compiler/testData/diagnostics/tests/infos/SmartCasts.kt +++ b/compiler/testData/diagnostics/tests/infos/SmartCasts.kt @@ -149,7 +149,7 @@ fun illegalWhenBody(a: Any): Int = when return a - is String -> return a + is String -> return a } } fun declarations(a: Any?) { @@ -222,7 +222,7 @@ fun f(): String { fun foo(aa: Any?): Int { var a = aa if (a is Int?) { - return a + return a } return 1 } diff --git a/compiler/testData/diagnostics/tests/inline/inlineLambdaInDefaultInlineParameterDisabled.kt b/compiler/testData/diagnostics/tests/inline/inlineLambdaInDefaultInlineParameterDisabled.kt index 90ae1b88905..ef3dae6f475 100644 --- a/compiler/testData/diagnostics/tests/inline/inlineLambdaInDefaultInlineParameterDisabled.kt +++ b/compiler/testData/diagnostics/tests/inline/inlineLambdaInDefaultInlineParameterDisabled.kt @@ -7,7 +7,7 @@ inline fun inlineFun(lambda: () -> String) = lambda() fun noInlineFun(lambda: () -> String) = lambda() -inline fun default0_1(lambda: () -> String, dlambda: () -> String = { lambda }) { +inline fun default0_1(lambda: () -> String, dlambda: () -> String = { lambda }) { lambda() + dlambda() } diff --git a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt index d050d43e045..d5cbb3e3f9b 100644 --- a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt +++ b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt @@ -34,7 +34,7 @@ fun main() { } A.baz { - x -> x.hashCode() + x -> x.hashCode() } val block: (String) -> Any? = { diff --git a/compiler/testData/diagnostics/tests/kt310.kt b/compiler/testData/diagnostics/tests/kt310.kt index d6418045280..a1670061adf 100644 --- a/compiler/testData/diagnostics/tests/kt310.kt +++ b/compiler/testData/diagnostics/tests/kt310.kt @@ -1,5 +1,5 @@ // !WITH_NEW_INFERENCE fun f(c: LongRange): Int { - return c.start() + return c.start() } diff --git a/compiler/testData/diagnostics/tests/library/Collections.kt b/compiler/testData/diagnostics/tests/library/Collections.kt index 1592e16bab7..0cd0c7e695e 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.kt @@ -8,7 +8,7 @@ fun testCollection(c: Collection, t: T) { val iterator: Iterator = c.iterator() c.containsAll(c) - val mutableIterator: MutableIterator = c.iterator() + val mutableIterator: MutableIterator = c.iterator() c.add(t) c.remove(1) c.addAll(c) @@ -45,9 +45,9 @@ fun testList(l: List, t: T) { val value: T = l.set(1, t) l.add(1, t) l.remove(1) - val mutableListIterator: MutableListIterator = l.listIterator() - val mutableListIterator1: MutableListIterator = l.listIterator(1) - val mutableList: MutableList = l.subList(1, 2) + val mutableListIterator: MutableListIterator = l.listIterator() + val mutableListIterator1: MutableListIterator = l.listIterator(1) + val mutableList: MutableList = l.subList(1, 2) } fun testMutableList(l: MutableList, t: T) { @@ -66,7 +66,7 @@ fun testSet(s: Set, t: T) { val iterator: Iterator = s.iterator() s.containsAll(s) - val mutableIterator: MutableIterator = s.iterator() + val mutableIterator: MutableIterator = s.iterator() s.add(t) s.remove(1) s.addAll(s) @@ -97,9 +97,9 @@ fun testMap(m: Map) { val collection: Collection = m.values val set1: Set> = m.entries - val mutableSet: MutableSet = m.keys - val mutableCollection: MutableCollection = m.values - val mutableSet1: MutableSet> = m.entries + val mutableSet: MutableSet = m.keys + val mutableCollection: MutableCollection = m.values + val mutableSet1: MutableSet> = m.entries } fun testMutableMap(m: MutableMap) { diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/sameClassNameDifferentPackages.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/sameClassNameDifferentPackages.kt index 6222bdb2084..bbbfcb18a17 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/sameClassNameDifferentPackages.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/sameClassNameDifferentPackages.kt @@ -18,5 +18,5 @@ import p.* class A fun test() { - val a: A = B().a + val a: A = B().a } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt5527.kt b/compiler/testData/diagnostics/tests/objects/kt5527.kt index 7a91f73e041..0a8853e73f2 100644 --- a/compiler/testData/diagnostics/tests/objects/kt5527.kt +++ b/compiler/testData/diagnostics/tests/objects/kt5527.kt @@ -7,13 +7,13 @@ class A { } fun foo() { - val i1: Int = Boo - val i2: Int = A.Boo + val i1: Int = Boo + val i2: Int = A.Boo useInt(Boo) useInt(A.Boo) } fun bar() { - val i1: Int = Unit + val i1: Int = Unit useInt(Unit) } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/assignToVar.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/assignToVar.kt index af8ca09962a..bcc125ee286 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/assignToVar.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/assignToVar.kt @@ -18,7 +18,7 @@ var n: J? = J() fun test() { v = J.staticNN - v = J.staticN + v = J.staticN v = J.staticJ n = J.staticNN diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.kt index f85f0a4ab7d..cda8720e916 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.kt @@ -23,23 +23,23 @@ fun test() { val platformJ = J.staticJ if (platformNN) {} - if (platformN) {} + if (platformN) {} if (platformJ) {} while (platformNN) {} - while (platformN) {} + while (platformN) {} while (platformJ) {} do {} while (platformNN) - do {} while (platformN) + do {} while (platformN) do {} while (platformJ) platformNN && false - platformN && false + platformN && false platformJ && false platformNN || false - platformN || false + platformN || false platformJ || false !platformNN diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/dataFlowInfo.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/dataFlowInfo.kt index 95185820c8c..8af77c1813a 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/dataFlowInfo.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/dataFlowInfo.kt @@ -16,14 +16,14 @@ public class J { fun test() { val n = J.staticN foo(n) - J.staticNN = n + J.staticNN = n if (n != null) { foo(n) J.staticNN = n } val x: J? = null - J.staticNN = x + J.staticNN = x if (x != null) { J.staticNN = x } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/defaultParameters.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/defaultParameters.kt index 4fcd0a226e3..6d74135a4b6 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/defaultParameters.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/defaultParameters.kt @@ -22,7 +22,7 @@ fun test() { // platform type with no annotation val platformJ = J.staticJ - fun foo(p: J = platformNN, p1: J = platformN, p2: J = platformJ) {} + fun foo(p: J = platformNN, p1: J = platformN, p2: J = platformJ) {} fun foo1(p: J? = platformNN, p1: J? = platformN, p2: J? = platformJ) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegation.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegation.kt index 9d1d64943ff..6b878d86363 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegation.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegation.kt @@ -15,5 +15,5 @@ public class J { // FILE: k.kt class A : List by J.staticNN -class B : List by J.staticN +class B : List by J.staticN class C : List by J.staticJ \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/passToJava.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/passToJava.kt index f24b25d06b2..c2367edb4df 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/passToJava.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/passToJava.kt @@ -34,8 +34,8 @@ fun test(n: J?, nn: J) { // platform type with no annotation val platformJ = J.staticJ - J.staticNN = n - J.staticNN = platformN + J.staticNN = n + J.staticNN = platformN J.staticNN = nn J.staticNN = platformNN J.staticNN = platformJ @@ -58,8 +58,8 @@ fun test(n: J?, nn: J) { J.staticSet(platformN, platformN, platformN) J.staticSet(platformJ, platformJ, platformJ) - J().nn = n - J().nn = platformN + J().nn = n + J().nn = platformN J().nn = nn J().nn = platformNN J().nn = platformJ diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/throw.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/throw.kt index 3c9cf3d9fb7..87f626a5219 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/throw.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/throw.kt @@ -18,7 +18,7 @@ fun test() { } fun test1() { - throw J.staticN + throw J.staticN } fun test2() { diff --git a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt index ec127c52f8a..147fb077a67 100644 --- a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt +++ b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt @@ -2,7 +2,7 @@ fun main() { val a : Int? = null; var v = 1 - val b : String = v; + val b : String = v; val f : String = a!!; val g : String = v++; val g1 : String = ++v; diff --git a/compiler/testData/diagnostics/tests/regressions/kt251.kt b/compiler/testData/diagnostics/tests/regressions/kt251.kt index 9d871865dbe..fb980b2f916 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt251.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt251.kt @@ -3,7 +3,7 @@ class A() { var x: Int = 0 get() = "s" set(value: String) { - field = value + field = value } val y: Int get(): String = "s" @@ -28,7 +28,7 @@ class A() { } val e = 1 get(): String { - return field + return field } } diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/originalExamples.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/originalExamples.kt index cd9609d816e..1123643b69f 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/originalExamples.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/originalExamples.kt @@ -8,7 +8,7 @@ fun overloadedFun1(c: Any = "", b: String = "", f: Any = "") = Right fun overloadedFun1(b: Any = "", c: Any = "", e: String = "") = Wrong val test1: Right = overloadedFun1(b = "") -val test1a: Wrong = overloadedFun1(b = "") +val test1a: Wrong = overloadedFun1(b = "") fun overloadedFun2(a: String, b: Any = "") = Right fun overloadedFun2(a: Any, b: String = "") = Wrong diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt index a4ebd9f766e..e969432d437 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt @@ -20,7 +20,7 @@ fun test() { class B: A() { init { - val a: Int = foo() // todo + val a: Int = foo() // todo } } } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt index 52b535bcf50..44224abe785 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt @@ -12,14 +12,14 @@ open class A : J() { init { foo() bar() - val a: Int = baz() + val a: Int = baz() val b: T = baz() } fun test1() { foo() bar() - val a: Int = baz() + val a: Int = baz() val b: T = baz() } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt index c14253fe0de..fa1f16a60f9 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt @@ -12,14 +12,14 @@ open class A : J() { init { foo() bar() - val a: Int = baz() + val a: Int = baz() val b: T = baz() } fun test1() { foo() bar() - val a: Int = baz() + val a: Int = baz() val b: T = baz() } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt index 69dc5a99286..912bd91a5c3 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt @@ -21,7 +21,7 @@ fun test() { class B: A() { init { - val a: Int = foo() // todo + val a: Int = foo() // todo } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts index f2f56b93dbb..7852cf28d9f 100644 --- a/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts +++ b/compiler/testData/diagnostics/tests/script/destructuringDeclarationsScript.kts @@ -1,6 +1,6 @@ // !WITH_NEW_INFERENCE val (a1, a2) = A() -val (b1: Int, b2: Int) = A() +val (b1: Int, b2: Int) = A() val (c1) = unresolved private val (d1) = A() diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt index e1dd6ba90cf..28315408a5a 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt @@ -10,7 +10,7 @@ class A { return 1 } return - return foo() + return foo() } fun foo(): Int = 1 diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisExprNotNull.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisExprNotNull.kt index bb233920b03..64769d9391d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisExprNotNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvisExprNotNull.kt @@ -33,5 +33,5 @@ fun baz(s: String?, r: String?): String { fun withNull(s: String?): String { val t = s ?: null // Error: nullable - return t + return t } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/explicitDefaultGetter.kt b/compiler/testData/diagnostics/tests/smartCasts/explicitDefaultGetter.kt index 5ea8a1752dd..30710c6791b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/explicitDefaultGetter.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/explicitDefaultGetter.kt @@ -5,7 +5,7 @@ class ExplicitAccessorForAnnotation { fun foo(): String { if (tt is String) { - return tt + return tt } return "" } diff --git a/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt index 88c4bcc346d..412d720a42b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/propertyToNotNull.kt @@ -8,7 +8,7 @@ class Immutable(val x: String?) { class Mutable(var y: String?) { fun foo(): String { - if (y != null) return y + if (y != null) return y return "" } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/anotherVal.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/anotherVal.kt index 53fe4471413..a8da3729430 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/anotherVal.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/anotherVal.kt @@ -3,6 +3,6 @@ fun calc(x: List?, y: Int?): Int { x?.get(y!! - 1) // y!! above should not provide smart cast here - val yy: Int = y + val yy: Int = y return yy + (x?.size ?: 0) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/falseSecondArgument.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/falseSecondArgument.kt index be5976f2ac4..3a975a23af6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/falseSecondArgument.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/falseSecondArgument.kt @@ -3,5 +3,5 @@ fun calc(x: List?, y: Int?): Int { x?.subList(y!! - 1, y) // y!! above should not provide smart cast here - return y + return y } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt index 977c7d5dffb..7adff29007f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/receiverAndChainFalse.kt @@ -6,5 +6,5 @@ fun calc(x: String?, y: Int?): Int { // Smart cast because of x!! in receiver foo(x!!)?.subSequence(y!!, x.length)?.length // No smart cast possible - return y + return y } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEach.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEach.kt index f94434b040c..3506cfcb632 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEach.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEach.kt @@ -13,5 +13,5 @@ fun list(start: SomeObject): SomeObject { e = e.next() } // Smart cast is not possible here due to next() - return e + return e } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithBreak.kt index 632cf602232..7516bcd91d0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithBreak.kt @@ -14,5 +14,5 @@ fun list(start: SomeObject): SomeObject { e.doSomething() e = e.next() } - return e + return e } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithContinue.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithContinue.kt index 8d5bd026ddf..2a779baae76 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithContinue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/forEachWithContinue.kt @@ -14,5 +14,5 @@ fun list(start: SomeObject): SomeObject { e.doSomething() e = e.next() } - return e + return e } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varIntNull.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varIntNull.kt index 4d9e5236463..ad110456f2f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varIntNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varIntNull.kt @@ -2,5 +2,5 @@ fun foo(): Int { var i: Int? = 42 i = null - return i + 1 + return i + 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/localClasses.kt b/compiler/testData/diagnostics/tests/subtyping/localClasses.kt index 7f974b0e2fb..8f116ad0686 100644 --- a/compiler/testData/diagnostics/tests/subtyping/localClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/localClasses.kt @@ -15,5 +15,5 @@ private fun foo() = run { fun test() { var x = foo(1) - x = foo() + x = foo() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt index 2dd74687951..53d549c771c 100644 --- a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt @@ -19,5 +19,5 @@ private fun foo() = run { fun test() { var x = foo(1) - x = foo() + x = foo() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt b/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt index 4d89c4c30ae..ec238c908a8 100644 --- a/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt @@ -19,5 +19,5 @@ private fun foo() = run { fun test() { var x = foo(1) - x = foo() + x = foo() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt index d31957c8eb0..680412ce5dd 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/InnerClassInGeneric.kt @@ -2,7 +2,7 @@ // FILE: KotlinFile.kt fun foo(javaClass: JavaClass): Int { val inner = javaClass.createInner() - return inner.doSomething(1, "") { } + return inner.doSomething(1, "") { } } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/when/BranchBypassVal.kt b/compiler/testData/diagnostics/tests/when/BranchBypassVal.kt index 9b78d51b028..7268250c185 100644 --- a/compiler/testData/diagnostics/tests/when/BranchBypassVal.kt +++ b/compiler/testData/diagnostics/tests/when/BranchBypassVal.kt @@ -8,5 +8,5 @@ fun test(a: Any): String { is A -> q!! } // When is not exhaustive - return q + return q } diff --git a/compiler/testData/diagnostics/tests/when/BranchBypassVar.kt b/compiler/testData/diagnostics/tests/when/BranchBypassVar.kt index 0dd59cbab82..df496b12bfe 100644 --- a/compiler/testData/diagnostics/tests/when/BranchBypassVar.kt +++ b/compiler/testData/diagnostics/tests/when/BranchBypassVar.kt @@ -8,5 +8,5 @@ fun test(a: Any) { is A -> q = "1" } // When is not exhaustive - return q + return q }