diff --git a/compiler/testData/diagnostics/tests/Abstract.kt b/compiler/testData/diagnostics/tests/Abstract.kt index 0ee38a01e5d..fbe72bb0332 100644 --- a/compiler/testData/diagnostics/tests/Abstract.kt +++ b/compiler/testData/diagnostics/tests/Abstract.kt @@ -40,7 +40,7 @@ package MyPackage var l: Int abstract get abstract set var l1: Int = 0; abstract get abstract set - var n: Int abstract get abstract set(v: Int) {} + var n: Int abstract get abstract set(v: Int) {} // FILE: c.kt //creating an instance @@ -52,10 +52,10 @@ abstract class B1( class B2() : B1(1, "r") {} -abstract class B3(i: Int) { +abstract class B3(i: Int) { } -fun foo(c: B3) { - val a = B3(1) - val b = B1(2, "s") -} \ No newline at end of file +fun foo(c: B3) { + val a = B3(1) + val b = B1(2, "s") +} diff --git a/compiler/testData/diagnostics/tests/AbstractInAbstractClass.kt b/compiler/testData/diagnostics/tests/AbstractInAbstractClass.kt index 5d5136f582e..9479f3e9eaa 100644 --- a/compiler/testData/diagnostics/tests/AbstractInAbstractClass.kt +++ b/compiler/testData/diagnostics/tests/AbstractInAbstractClass.kt @@ -41,5 +41,5 @@ abstract class MyAbstractClass() { var l: Int abstract get abstract set var l1: Int = 0; abstract get abstract set - var n: Int abstract get abstract set(v: Int) {} -} \ No newline at end of file + var n: Int abstract get abstract set(v: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/AbstractInClass.kt b/compiler/testData/diagnostics/tests/AbstractInClass.kt index 5d68fab5364..f15ebca5d74 100644 --- a/compiler/testData/diagnostics/tests/AbstractInClass.kt +++ b/compiler/testData/diagnostics/tests/AbstractInClass.kt @@ -41,5 +41,5 @@ class MyClass() { var l: Int abstract get abstract set var l1: Int = 0; abstract get abstract set - var n: Int abstract get abstract set(v: Int) {} -} \ No newline at end of file + var n: Int abstract get abstract set(v: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/AbstractInTrait.kt b/compiler/testData/diagnostics/tests/AbstractInTrait.kt index e905dedc7f0..574bd41ba71 100644 --- a/compiler/testData/diagnostics/tests/AbstractInTrait.kt +++ b/compiler/testData/diagnostics/tests/AbstractInTrait.kt @@ -41,5 +41,5 @@ interface MyTrait { var l: Int abstract get abstract set var l1: Int = 0; abstract get abstract set - var n: Int abstract get abstract set(v: Int) {} -} \ No newline at end of file + var n: Int abstract get abstract set(v: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt index 71247bc67bf..5b30445d0d3 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt @@ -13,14 +13,14 @@ interface NoC { class WithC() { val x : Int = 1 init { - val b = x + val b = x } val a : Int get() = 1 init { - val z = b - val zz = x + val z = b + val zz = x } } diff --git a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt index 98887c13f9e..881d52f82f1 100644 --- a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt +++ b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt @@ -3,9 +3,9 @@ fun text() { "direct:a" to "mock:a" "direct:a" on {it.body == ""} to "mock:a" "direct:a" on {it -> it.body == ""} to "mock:a" - bar {1} - bar {it + 1} - bar {it, it1 -> it} + bar {1} + bar {it + 1} + bar {it, it1 -> it} bar1 {1} bar1 {it + 1} @@ -13,21 +13,21 @@ fun text() { bar2 {} bar2 {1} bar2 {it} - bar2 {it -> it} + bar2 {it -> it} } -fun bar(f : (Int, Int) -> Int) {} -fun bar1(f : (Int) -> Int) {} -fun bar2(f : () -> Int) {} +fun bar(f : (Int, Int) -> Int) {} +fun bar1(f : (Int) -> Int) {} +fun bar2(f : () -> Int) {} -infix fun String.to(dest : String) { +infix fun String.to(dest : String) { } -infix fun String.on(predicate : (s : URI) -> Boolean) : URI { +infix fun String.on(predicate : (s : URI) -> Boolean) : URI { return URI(this) } class URI(val body : Any) { - infix fun to(dest : String) {} + infix fun to(dest : String) {} } diff --git a/compiler/testData/diagnostics/tests/Basic.kt b/compiler/testData/diagnostics/tests/Basic.kt index c12c76e6811..dcd68b62155 100644 --- a/compiler/testData/diagnostics/tests/Basic.kt +++ b/compiler/testData/diagnostics/tests/Basic.kt @@ -1,9 +1,9 @@ // !WITH_NEW_INFERENCE -fun foo(u : Unit) : Int = 1 +fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : () -> Unit = { + val a : () -> Unit = { foo(1) } return 1 - "1" diff --git a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt index 7dd7bc2a849..24cc9eb00f7 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 } diff --git a/compiler/testData/diagnostics/tests/BreakContinue.kt b/compiler/testData/diagnostics/tests/BreakContinue.kt index 1916021cae2..2f27ffbb3e0 100644 --- a/compiler/testData/diagnostics/tests/BreakContinue.kt +++ b/compiler/testData/diagnostics/tests/BreakContinue.kt @@ -1,6 +1,6 @@ class C { - fun f (a : Boolean, b : Boolean) { + fun f (a : Boolean, b : Boolean) { b@ while (true) a@ { break@f @@ -25,7 +25,7 @@ class C { break@f } - fun containsBreak(a: String?, b: String?) { + fun containsBreak(a: String?, b: String?) { while (a == null) { break; } diff --git a/compiler/testData/diagnostics/tests/Casts.kt b/compiler/testData/diagnostics/tests/Casts.kt index 96c2679a163..4c2b4a990f0 100644 --- a/compiler/testData/diagnostics/tests/Casts.kt +++ b/compiler/testData/diagnostics/tests/Casts.kt @@ -15,7 +15,7 @@ fun test() : Unit { checkSubtype(x as? Int?) checkSubtype(y as? Int?) - val s = "" as Any + val s = "" as Any ("" as String?)?.length (data@("" as String?))?.length (@MustBeDocumented()( "" as String?))?.length diff --git a/compiler/testData/diagnostics/tests/CharacterLiterals.kt b/compiler/testData/diagnostics/tests/CharacterLiterals.kt index 53c03f47311..ea9f0a218e4 100644 --- a/compiler/testData/diagnostics/tests/CharacterLiterals.kt +++ b/compiler/testData/diagnostics/tests/CharacterLiterals.kt @@ -1,4 +1,4 @@ -fun test(c : Char) { +fun test(c : Char) { test('') test('a') test('aa') diff --git a/compiler/testData/diagnostics/tests/Constants.fir.kt b/compiler/testData/diagnostics/tests/Constants.fir.kt index fd7b1e0f60c..8570c374394 100644 --- a/compiler/testData/diagnostics/tests/Constants.fir.kt +++ b/compiler/testData/diagnostics/tests/Constants.fir.kt @@ -31,11 +31,11 @@ fun test() { checkSubtype(1) checkSubtype(1) - + 1 as Byte 1 as Int 0xff as Long - + 1.1 as Int checkSubtype(1.1) @@ -50,4 +50,4 @@ fun test() { testFun(1.0) testFun(1.0.toFloat()) testFun(1.0.toFloat()) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/Constants.kt b/compiler/testData/diagnostics/tests/Constants.kt index ee10f8ba03e..e8559b7187d 100644 --- a/compiler/testData/diagnostics/tests/Constants.kt +++ b/compiler/testData/diagnostics/tests/Constants.kt @@ -12,7 +12,7 @@ fun varargFloat(vararg v: Float) = v fun varargDouble(vararg v: Double) = v -fun testFun(p: T) {} +fun testFun(p: T) {} fun test() { checkSubtype(1) @@ -31,11 +31,11 @@ fun test() { checkSubtype(1) checkSubtype(1) - + 1 as Byte 1 as Int 0xff as Long - + 1.1 as Int checkSubtype(1.1) @@ -50,4 +50,4 @@ fun test() { testFun(1.0) testFun(1.0.toFloat()) testFun(1.0.toFloat()) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/Constructors.kt b/compiler/testData/diagnostics/tests/Constructors.kt index 82a73dbb743..e46efd381a9 100644 --- a/compiler/testData/diagnostics/tests/Constructors.kt +++ b/compiler/testData/diagnostics/tests/Constructors.kt @@ -10,7 +10,7 @@ class WithC2() : WithC1 class WithPC0() { } -class WithPC1(a : Int) { +class WithPC1(a : Int) { } @@ -18,7 +18,7 @@ class Foo() : WithPC0, x : Int) { +class WithCPI_Dup(x : Int) { var x : Int } @@ -31,5 +31,5 @@ class NoCPI { val a = 1 var ab = 1 get() = 1 - set(v) {} -} \ No newline at end of file + set(v) {} +} diff --git a/compiler/testData/diagnostics/tests/DefaultValuesCheckWithoutBody.kt b/compiler/testData/diagnostics/tests/DefaultValuesCheckWithoutBody.kt index 217b1790e5d..2f90e0a8ee7 100644 --- a/compiler/testData/diagnostics/tests/DefaultValuesCheckWithoutBody.kt +++ b/compiler/testData/diagnostics/tests/DefaultValuesCheckWithoutBody.kt @@ -6,4 +6,4 @@ abstract class Abst { abstract fun foo(x: Int = y, y: Int = x) } -fun extraDiagnostics(x: Int = y, y: Int) +fun extraDiagnostics(x: Int = y, y: Int) diff --git a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt index 1d53a3591c7..be2442c7a76 100644 --- a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt +++ b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt @@ -1,16 +1,16 @@ // !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 -fun foo(x: Int = y, y: Int = x, i : Int = z): Int = x + y +fun foo(x: Int = y, y: Int = x, i : Int = z): Int = x + y diff --git a/compiler/testData/diagnostics/tests/DiamondProperty.fir.kt b/compiler/testData/diagnostics/tests/DiamondProperty.fir.kt deleted file mode 100644 index 5a93ad88daa..00000000000 --- a/compiler/testData/diagnostics/tests/DiamondProperty.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface Base { - var v : Int - get() = 1 - set(v) {} -} - -open class Left() : Base - -interface Right : Base - -class Diamond() : Left(), Right diff --git a/compiler/testData/diagnostics/tests/DiamondProperty.kt b/compiler/testData/diagnostics/tests/DiamondProperty.kt index c7051ff00bf..eb36666c835 100644 --- a/compiler/testData/diagnostics/tests/DiamondProperty.kt +++ b/compiler/testData/diagnostics/tests/DiamondProperty.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL interface Base { var v : Int get() = 1 - set(v) {} + set(v) {} } - + open class Left() : Base interface Right : Base diff --git a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt index 412e92c6ce0..22b2715d38f 100644 --- a/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt +++ b/compiler/testData/diagnostics/tests/FreeFunctionCalledAsExtension.kt @@ -1,4 +1,4 @@ -fun foo(a: (String) -> Unit) { +fun foo(a: (String) -> Unit) { "".a() } @@ -6,7 +6,7 @@ fun foo(a: (String) -> Unit) { interface A : (String) -> Unit {} -fun foo(a: @ExtensionFunctionType A) { +fun foo(a: @ExtensionFunctionType A) { // @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic. // Only kotlin.Function{n} type annotated with @Extension should "".a() diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt index 2e58eb19980..5851eae342b 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt @@ -40,8 +40,8 @@ fun main(args : Array) { foo2()({}) foo2(){} (foo2()){} - (foo2()){x -> } - foo2()({x -> }) + (foo2()){x -> } + foo2()({x -> }) val a = fooT1(1)() checkSubtype(a) @@ -76,7 +76,7 @@ fun main1() { } fun test() { - {x : Int -> 1}(); + {x : Int -> 1}(); (fun Int.() = 1)() "sd".(fun Int.() = 1)() val i : Int? = null diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index 47a87c24b32..464d2d06ac5 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -19,7 +19,7 @@ fun bbb() { return 1 } -fun foo(expr: StringBuilder): Int { +fun foo(expr: StringBuilder): Int { val c = 'a' when(c) { 0.toChar() -> throw Exception("zero") @@ -37,7 +37,7 @@ fun intShortInfer() = 1 fun intShort() : Int = 1 //fun intBlockInfer() {1} fun intBlock() : Int {return 1} -fun intBlock1() : Int {1} +fun intBlock1() : Int {1} fun intString(): Int = "s" fun intFunctionLiteral(): Int = { 10 } @@ -48,7 +48,7 @@ fun blockReturnValueTypeMatch() : Int {return 1} fun blockReturnValueTypeMismatchUnit() : Int {return Unit} fun blockAndAndMismatch() : Int { - true && false + true && false } fun blockAndAndMismatch1() : Int { return true && false @@ -58,7 +58,7 @@ fun blockAndAndMismatch2() : Int { } fun blockAndAndMismatch3() : Int { - true || false + true || false } fun blockAndAndMismatch4() : Int { return true || false @@ -92,18 +92,18 @@ fun blockReturnValueTypeMatch6() : Int { } fun blockReturnValueTypeMatch7() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 } fun blockReturnValueTypeMatch8() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 return 1 } fun blockReturnValueTypeMatch9() : Int { if (1 > 2) - 1.0 + 1.0 } fun blockReturnValueTypeMatch10() : Int { return if (1 > 2) @@ -111,7 +111,7 @@ fun blockReturnValueTypeMatch10() : Int { } fun blockReturnValueTypeMatch11() : Int { if (1 > 2) - else 1.0 + else 1.0 } fun blockReturnValueTypeMatch12() : Int { if (1 > 2) @@ -119,7 +119,7 @@ fun blockReturnValueTypeMatch12() : Int { else return 1.0 } fun blockNoReturnIfValDeclaration(): Int { - val x = 1 + val x = 1 } fun blockNoReturnIfEmptyIf(): Int { if (1 < 2) {} else {} @@ -171,37 +171,37 @@ class B() { } fun testFunctionLiterals() { - val endsWithVarDeclaration : () -> Boolean = { - val x = 2 + val endsWithVarDeclaration : () -> Boolean = { + val x = 2 } - val endsWithAssignment: () -> Int = { + val endsWithAssignment: () -> Int = { var x = 1 - x = 333 + x = 333 } - val endsWithReAssignment: () -> Int = { + val endsWithReAssignment: () -> Int = { var x = 1 x += 333 } - val endsWithFunDeclaration : () -> String = { + val endsWithFunDeclaration : () -> String = { var x = 1 - x = 333 + x = 333 fun meow() : Unit {} } - val endsWithObjectDeclaration : () -> Int = { + val endsWithObjectDeclaration : () -> Int = { var x = 1 - x = 333 + x = 333 object A {} } - val expectedUnitReturnType1: () -> Unit = { - val x = 1 + val expectedUnitReturnType1: () -> Unit = { + val x = 1 } - val expectedUnitReturnType2: () -> Unit = { + val expectedUnitReturnType2: () -> Unit = { fun meow() : Unit {} object A {} } diff --git a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.fir.kt b/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.fir.kt deleted file mode 100644 index 67150ef3926..00000000000 --- a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// !CHECK_TYPE - -// A generic funciton is always less specific than a non-generic one -fun foo(t : T) : Unit {} -fun foo(i : Int) : Int = 1 - -fun test() { - checkSubtype(foo(1)) - checkSubtype(foo("s")) -} diff --git a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt b/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt index d0487f06f96..a6fd664e0ec 100644 --- a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt +++ b/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt @@ -1,8 +1,9 @@ +// FIR_IDENTICAL // !CHECK_TYPE // A generic funciton is always less specific than a non-generic one -fun foo(t : T) : Unit {} -fun foo(i : Int) : Int = 1 +fun foo(t : T) : Unit {} +fun foo(i : Int) : Int = 1 fun test() { checkSubtype(foo(1)) diff --git a/compiler/testData/diagnostics/tests/IncDec.kt b/compiler/testData/diagnostics/tests/IncDec.kt index 614a3b2320f..16e4ec01f1e 100644 --- a/compiler/testData/diagnostics/tests/IncDec.kt +++ b/compiler/testData/diagnostics/tests/IncDec.kt @@ -9,10 +9,10 @@ fun testIncDec() { ++x x-- --x - x = x++ - x = x-- + x = x++ + x = x-- x = ++x - x = --x + x = --x } class WrongIncDec() { @@ -39,8 +39,8 @@ fun testUnitIncDec() { ++x x-- --x - x = x++ - x = x-- + x = x++ + x = x-- x = ++x - x = --x + x = --x } diff --git a/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.kt b/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.kt index ebc5d2d4a0d..715915e6c2a 100644 --- a/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.kt +++ b/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.kt @@ -2,36 +2,36 @@ // KT-451 Incorrect character literals cause assertion failures fun ff() { - val b = '' - val c = '23' - val d = 'a - val e = 'ab - val f = '\' + val b = '' + val c = '23' + val d = 'a + val e = 'ab + val f = '\' } fun test() { - 'a' - '\n' - '\t' - '\b' - '\r' - '\"' - '\'' - '\\' - '\$' - '\x' - '\123' - '\ra' - '\000' - '\000' - '\u0000' - '\u000a' - '\u000A' - '\u' - '\u0' - '\u00' - '\u000' - '\u000z' - '\\u000' - '\' + 'a' + '\n' + '\t' + '\b' + '\r' + '\"' + '\'' + '\\' + '\$' + '\x' + '\123' + '\ra' + '\000' + '\000' + '\u0000' + '\u000a' + '\u000A' + '\u' + '\u0' + '\u00' + '\u000' + '\u000z' + '\\u000' + '\' } diff --git a/compiler/testData/diagnostics/tests/InferNullabilityInThenBlock.kt b/compiler/testData/diagnostics/tests/InferNullabilityInThenBlock.kt index 09ba036f01c..959407e6e12 100644 --- a/compiler/testData/diagnostics/tests/InferNullabilityInThenBlock.kt +++ b/compiler/testData/diagnostics/tests/InferNullabilityInThenBlock.kt @@ -1,4 +1,4 @@ -fun ff(a: String) = 1 +fun ff(a: String) = 1 fun gg() { val a: String? = "" diff --git a/compiler/testData/diagnostics/tests/Infix.kt b/compiler/testData/diagnostics/tests/Infix.kt index 5515bcc08f0..b703f762427 100644 --- a/compiler/testData/diagnostics/tests/Infix.kt +++ b/compiler/testData/diagnostics/tests/Infix.kt @@ -8,11 +8,11 @@ class Example { infix fun Example.toExt(other: Example) = Pair(this, other) fun Example.toExtNonInfix(other: Example) = Pair(this, other) -infix fun Example.toExtWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) -fun Example.toExtNonInfixWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) +infix fun Example.toExtWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) +fun Example.toExtNonInfixWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) -infix fun Example.toExtDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) -fun Example.toExtNonInfixDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) +infix fun Example.toExtDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) +fun Example.toExtNonInfixDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) fun Example.withLambda(f: () -> Unit) = Pair(this, f) diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.kt b/compiler/testData/diagnostics/tests/LValueAssignment.kt index 30b9d9a4ecf..9d3260345bb 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.kt @@ -7,7 +7,7 @@ open class B() { class C() : B() { var x = 4 - fun foo(c: C) { + fun foo(c: C) { this.x = 34 this.b = 123 super.b = 23 @@ -17,7 +17,7 @@ class C() : B() { getInt() = 12 } - fun foo1(c: C) { + fun foo1(c: C) { super.c = 34 } @@ -51,18 +51,18 @@ fun cannotBe() { 5 = 34 } -fun canBe(i0: Int, j: Int) { +fun canBe(i0: Int, j: Int) { var i = i0 - (label@ i) = 34 + (label@ i) = 34 - (label@ j) = 34 //repeat for j + (label@ j) = 34 //repeat for j val a = A() (l@ a.a) = 3894 } -fun canBe2(j: Int) { - (label@ j) = 34 +fun canBe2(j: Int) { + (label@ j) = 34 } class A() { @@ -107,7 +107,7 @@ class Test() { a++ (l@ a)++ - (a)++ + (a)++ } fun testVariables1() { diff --git a/compiler/testData/diagnostics/tests/OperatorChecks.kt b/compiler/testData/diagnostics/tests/OperatorChecks.kt index 01cbaefd66b..b3b8f45bd69 100644 --- a/compiler/testData/diagnostics/tests/OperatorChecks.kt +++ b/compiler/testData/diagnostics/tests/OperatorChecks.kt @@ -98,122 +98,122 @@ interface Example3 { -operator fun Example.plus(o: Any): Example {} -operator fun Example.div(o: Example): Example {} -operator fun Example.plus(o: Example, s: String = ""): Example {} -operator fun Example.minus(vararg o: Example): Example {} +operator fun Example.plus(o: Any): Example {} +operator fun Example.div(o: Example): Example {} +operator fun Example.plus(o: Example, s: String = ""): Example {} +operator fun Example.minus(vararg o: Example): Example {} operator fun Example.plus(): Example {} operator fun Example.minus(): Example {} operator fun Example.unaryPlus(): Example {} operator fun Example.unaryMinus(): Example {} -operator fun Example.unaryPlus(s: String = ""): Example {} -operator fun Example.unaryMinus(o: Example) {} +operator fun Example.unaryPlus(s: String = ""): Example {} +operator fun Example.unaryMinus(o: Example) {} operator fun Example.inc(): Example {} operator fun Example.dec(): Example? {} -operator fun Example.plusAssign(n: Int) {} -operator fun Example.minusAssign(n: Int): String {} -operator fun Example.divAssign(n: Int, a: String = "") {} -operator fun Example.modAssign(vararg n: Int) {} +operator fun Example.plusAssign(n: Int) {} +operator fun Example.minusAssign(n: Int): String {} +operator fun Example.divAssign(n: Int, a: String = "") {} +operator fun Example.modAssign(vararg n: Int) {} -operator fun Example.compareTo(other: Example): Int {} +operator fun Example.compareTo(other: Example): Int {} -operator fun Example.equals(a: String): Boolean {} +operator fun Example.equals(a: String): Boolean {} -operator fun Example.contains(n: Int): Boolean {} -operator fun Example.contains(n: Int, s: String = ""): Boolean {} +operator fun Example.contains(n: Int): Boolean {} +operator fun Example.contains(n: Int, s: String = ""): Boolean {} operator fun Example.invoke() {} -operator fun Example.get(n: Int) {} -operator fun Example.get(n: Int, n2: Int) {} +operator fun Example.get(n: Int) {} +operator fun Example.get(n: Int, n2: Int) {} operator fun Example.get() {} -operator fun Example.set(n: Int, v: Int) {} -operator fun Example.set(n: Int, n2: Int, v: Int) {} -operator fun Example.set(v: Int) {} +operator fun Example.set(n: Int, v: Int) {} +operator fun Example.set(n: Int, n2: Int, v: Int) {} +operator fun Example.set(v: Int) {} -operator fun Example.rangeTo(o: Int) {} -operator fun Example.rangeTo(o: Int, o2: Int) {} -operator fun Example.rangeTo(vararg o: String) {} +operator fun Example.rangeTo(o: Int) {} +operator fun Example.rangeTo(o: Int, o2: Int) {} +operator fun Example.rangeTo(vararg o: String) {} operator fun Example.component1(): Int {} -operator fun Example.component1(n: Int): Int {} +operator fun Example.component1(n: Int): Int {} operator fun Example.componentN(): Int {} operator fun Example.iterator(): String {} -operator fun Example.iterator(n: Int): String {} +operator fun Example.iterator(n: Int): String {} operator fun Example.next(): String {} -operator fun Example.next(n: Int): String {} +operator fun Example.next(n: Int): String {} operator fun Example.hasNext(): Boolean {} -operator fun Example.hasNext(n: Int): String {} +operator fun Example.hasNext(n: Int): String {} -infix fun Example.i1(n: Int) {} -infix fun Example.i1(n: Int, n2: Int) {} -infix fun Example.i1(vararg n: Int) {} +infix fun Example.i1(n: Int) {} +infix fun Example.i1(n: Int, n2: Int) {} +infix fun Example.i1(vararg n: Int) {} -operator fun plus(o: String): Example {} -operator fun div(o: Example): Example {} -operator fun plus(o: Example, s: String = ""): Example {} -operator fun minus(vararg o: Example): Example {} +operator fun plus(o: String): Example {} +operator fun div(o: Example): Example {} +operator fun plus(o: Example, s: String = ""): Example {} +operator fun minus(vararg o: Example): Example {} operator fun unaryPlus(): Example {} operator fun unaryMinus(): Example {} -operator fun unaryPlus(s: String = ""): Example {} -operator fun unaryMinus(o: Example) {} +operator fun unaryPlus(s: String = ""): Example {} +operator fun unaryMinus(o: Example) {} operator fun inc(): Example {} operator fun dec(): Example? {} -operator fun plusAssign(n: Int) {} -operator fun minusAssign(n: Int): String {} -operator fun divAssign(n: Int, a: String = "") {} -operator fun modAssign(vararg n: Int) {} +operator fun plusAssign(n: Int) {} +operator fun minusAssign(n: Int): String {} +operator fun divAssign(n: Int, a: String = "") {} +operator fun modAssign(vararg n: Int) {} -operator fun compareTo(other: Example): Int {} +operator fun compareTo(other: Example): Int {} -operator fun equals(a: String): Boolean {} +operator fun equals(a: String): Boolean {} -operator fun contains(n: Int): Boolean {} -operator fun contains(n: Int, s: String = ""): Boolean {} +operator fun contains(n: Int): Boolean {} +operator fun contains(n: Int, s: String = ""): Boolean {} operator fun invoke() {} -operator fun get(n: Int) {} -operator fun get(n: Int, n2: Int) {} +operator fun get(n: Int) {} +operator fun get(n: Int, n2: Int) {} operator fun get() {} -operator fun set(n: Int, v: Int) {} -operator fun set(n: Int, n2: Int, v: Int) {} -operator fun set(v: Int) {} +operator fun set(n: Int, v: Int) {} +operator fun set(n: Int, n2: Int, v: Int) {} +operator fun set(v: Int) {} -operator fun rangeTo(o: Int) {} -operator fun rangeTo(o: Int, o2: Int) {} -operator fun rangeTo(vararg o: String) {} +operator fun rangeTo(o: Int) {} +operator fun rangeTo(o: Int, o2: Int) {} +operator fun rangeTo(vararg o: String) {} operator fun component1(): Int {} -operator fun component1(n: Int): Int {} +operator fun component1(n: Int): Int {} operator fun componentN(): Int {} operator fun iterator(): String {} -operator fun iterator(n: Int): String {} +operator fun iterator(n: Int): String {} operator fun next(): String {} -operator fun next(n: Int): String {} +operator fun next(n: Int): String {} operator fun hasNext(): Boolean {} -operator fun hasNext(n: Int): String {} +operator fun hasNext(n: Int): String {} -infix fun i1(n: Int) {} -infix fun i1(n: Int, n2: Int) {} -infix fun i1(vararg n: Int) {} +infix fun i1(n: Int) {} +infix fun i1(n: Int, n2: Int) {} +infix fun i1(vararg n: Int) {} diff --git a/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt index a08eab20170..b0faa7dcb3d 100644 --- a/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt +++ b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt @@ -1,23 +1,23 @@ public interface ITest { public var prop : Int get() = 12 - set(value) {} + set(value) {} } abstract class ATest { protected open var prop2 : Int get() = 13 - set(value) {} + set(value) {} } class Test: ATest(), ITest { override var prop : Int get() = 12 - private set(value) {} + private set(value) {} override var prop2 : Int get() = 14 - internal set(value) {} + internal set(value) {} } fun main() { diff --git a/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.kt b/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.kt index 9ab2d228bb4..6340deb2b13 100644 --- a/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.kt +++ b/compiler/testData/diagnostics/tests/PrivateSetterForOverridden.kt @@ -62,9 +62,9 @@ interface E : A { override var a: Int get() = 0 // Errors here and below - private set(arg) {} + private set(arg) {} override var b: Int get() = 0 - private set(arg) {} -} \ No newline at end of file + private set(arg) {} +} diff --git a/compiler/testData/diagnostics/tests/Properties.kt b/compiler/testData/diagnostics/tests/Properties.kt index 6cc7c124be0..3b7d0fd3e92 100644 --- a/compiler/testData/diagnostics/tests/Properties.kt +++ b/compiler/testData/diagnostics/tests/Properties.kt @@ -7,7 +7,7 @@ var x : Int = 1 + x val xx : Int = 1 + x get() : Int = 1 - set(value : Long) {} + set(value : Long) {} val p : Int = 1 get() = 1 @@ -19,4 +19,4 @@ class Test() { set(x) {a = x; field = x} public val i = 1 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/QualifiedExpressions.kt b/compiler/testData/diagnostics/tests/QualifiedExpressions.kt index c53e08c580b..899bd895035 100644 --- a/compiler/testData/diagnostics/tests/QualifiedExpressions.kt +++ b/compiler/testData/diagnostics/tests/QualifiedExpressions.kt @@ -2,13 +2,13 @@ package qualified_expressions fun test(s: IntRange?) { - val a: Int = s?.start + val a: Int = s?.start val b: Int? = s?.start - val c: Int = s?.start ?: -11 - val d: Int = s?.start ?: "empty" + val c: Int = s?.start ?: -11 + val d: Int = s?.start ?: "empty" val e: String = s?.start ?: "empty" - val f: Int = s?.endInclusive ?: b ?: 1 - val g: Boolean? = e.startsWith("s")//?.length + val f: Int = s?.endInclusive ?: b ?: 1 + val g: Boolean? = e.startsWith("s")//?.length } -fun String.startsWith(s: String): Boolean = true +fun String.startsWith(s: String): Boolean = true diff --git a/compiler/testData/diagnostics/tests/RecursiveResolve.kt b/compiler/testData/diagnostics/tests/RecursiveResolve.kt index b3a3c968c78..8f4ec4db0b6 100644 --- a/compiler/testData/diagnostics/tests/RecursiveResolve.kt +++ b/compiler/testData/diagnostics/tests/RecursiveResolve.kt @@ -8,9 +8,9 @@ class Test(foo: Any?, bar: Any?) { private fun bas2(): Int = null!! fun bar() = bar(1) - fun bar(i: Int) = 2 + fun bar(i: Int) = 2 private fun bar2() = bar2(1) - private fun bar2(i: Int) = 2 + private fun bar2(i: Int) = 2 } // KT-6413 Typechecker recursive problem when class have non-invariant generic parameters @@ -24,9 +24,9 @@ class Test2(foo: Any?, bar: Any?) { private fun bas2(): Int = null!! fun bar() = bar(1) - fun bar(i: Int) = 2 + fun bar(i: Int) = 2 private fun bar2() = bar2(1) - private fun bar2(i: Int) = 2 + private fun bar2(i: Int) = 2 } class Test3(foo: Any?, bar: Any?) { @@ -39,9 +39,9 @@ class Test3(foo: Any?, bar: Any?) { private fun bas2(): Int = null!! fun bar() = bar(1) - fun bar(i: Int) = 2 + fun bar(i: Int) = 2 private fun bar2() = bar2(1) - private fun bar2(i: Int) = 2 + private fun bar2(i: Int) = 2 } class Test4(foo: Any?, bar: Any?) { @@ -54,9 +54,9 @@ class Test4(foo: Any?, bar: Any?) { private fun bas2(): Int = null!! fun bar() = bar(1) - fun bar(i: Int) = 2 + fun bar(i: Int) = 2 private fun bar2() = bar2(1) - private fun bar2(i: Int) = 2 + private fun bar2(i: Int) = 2 } class Test5(foo: Any?, bar: Any?) { @@ -69,7 +69,7 @@ class Test5(foo: Any?, bar: Any?) { private fun bas2(): Int = null!! fun bar() = bar(1) - fun bar(i: Int) = 2 + fun bar(i: Int) = 2 private fun bar2(): Int = bar2(1) - private fun bar2(i: Int) = 2 -} \ No newline at end of file + private fun bar2(i: Int) = 2 +} diff --git a/compiler/testData/diagnostics/tests/ResolveOfJavaGenerics.kt b/compiler/testData/diagnostics/tests/ResolveOfJavaGenerics.kt index e374a2a284d..dc63117b808 100644 --- a/compiler/testData/diagnostics/tests/ResolveOfJavaGenerics.kt +++ b/compiler/testData/diagnostics/tests/ResolveOfJavaGenerics.kt @@ -1,22 +1,22 @@ // !WITH_NEW_INFERENCE // Fixpoint generic in Java: Enum> -fun test(a : java.lang.annotation.RetentionPolicy) { +fun test(a : java.lang.annotation.RetentionPolicy) { } fun test() { java.util.Collections.emptyList() - val a : Collection? = java.util.Collections.emptyList() + val a : Collection? = java.util.Collections.emptyList() } -fun test(a : java.lang.Comparable) { +fun test(a : java.lang.Comparable) { } -fun test(a : java.util.ArrayList) { +fun test(a : java.util.ArrayList) { } -fun test(a : java.lang.Class) { +fun test(a : java.lang.Class) { } diff --git a/compiler/testData/diagnostics/tests/ResolveToJava.kt b/compiler/testData/diagnostics/tests/ResolveToJava.kt index fcdad46c454..a4c7a166462 100644 --- a/compiler/testData/diagnostics/tests/ResolveToJava.kt +++ b/compiler/testData/diagnostics/tests/ResolveToJava.kt @@ -14,13 +14,13 @@ import java.lang.Comparable as Com val l : MutableList = ArrayList() -fun test(l : java.util.List) { - val x : java.List - val y : java.util.List - val b : java.lang.Object - val z : java.utils.List +fun test(l : java.util.List) { + val x : java.List + val y : java.util.List + val b : java.lang.Object + val z : java.utils.List - val f : java.io.File? = null + val f : java.io.File? = null Collections.emptyList Collections.emptyList @@ -33,7 +33,7 @@ fun test(l : java.util List - val o = "sdf" as Object + val o = "sdf" as Object try { // ... diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt index 204d3b7facf..5157eb39277 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt @@ -2,5 +2,5 @@ fun ff() { val i: Int = 1 - val a: Int = i?.plus(2) + val a: Int = i?.plus(2) } diff --git a/compiler/testData/diagnostics/tests/SafeCallUnknownType.kt b/compiler/testData/diagnostics/tests/SafeCallUnknownType.kt index 5bec3fc2fb1..2bb6f28c781 100644 --- a/compiler/testData/diagnostics/tests/SafeCallUnknownType.kt +++ b/compiler/testData/diagnostics/tests/SafeCallUnknownType.kt @@ -3,5 +3,5 @@ import com.unknownunknown() - val b = a?.plus(42) -} \ No newline at end of file + val b = a?.plus(42) +} diff --git a/compiler/testData/diagnostics/tests/Serializable.kt b/compiler/testData/diagnostics/tests/Serializable.kt index f87f135da6d..7589839e601 100644 --- a/compiler/testData/diagnostics/tests/Serializable.kt +++ b/compiler/testData/diagnostics/tests/Serializable.kt @@ -1,8 +1,8 @@ -fun use(s: java.io.Serializable) { +fun use(s: java.io.Serializable) { } -fun useList(s: List) { +fun useList(s: List) { } diff --git a/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt b/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt index fc0f7385426..da6c5b5ac38 100644 --- a/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt +++ b/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt @@ -2,8 +2,8 @@ fun getT() {} fun getTT() {} -fun getTTT(x : Any) {} -fun foo(a : Any?) {} +fun getTTT(x : Any) {} +fun foo(a : Any?) {} public fun main() { getT<*>() diff --git a/compiler/testData/diagnostics/tests/StringTemplates.kt b/compiler/testData/diagnostics/tests/StringTemplates.kt index 9ad14cef8e1..a9e74ee2f28 100644 --- a/compiler/testData/diagnostics/tests/StringTemplates.kt +++ b/compiler/testData/diagnostics/tests/StringTemplates.kt @@ -3,20 +3,20 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : () -> Any?) : Int = 1 - fun buzz(f : () -> Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; - "$abc" - "$" - "$.$.asdf$\t" - "asd\$" - "asd$a\x" + "$abc" + "$" + "$.$.asdf$\t" + "asd\$" + "asd$a\x" "asd$a$asd$ $xxx" "fosdfasdo${1 + bar + 100}}sdsdfgdsfsdf" "foo${bar + map {foo}}sdfsdf" "foo${bar + map { "foo" }}sdfsdf" "foo${bar + map { "foo$sdf${ buzz{}}" }}sdfsdf" - "a\u \u0 \u00 \u000 \u0000 \u0AaA \u0AAz.length( ) + \u0022b" -} \ No newline at end of file + "a\u \u0 \u00 \u000 \u0000 \u0AaA \u0AAz.length( ) + \u0022b" +} diff --git a/compiler/testData/diagnostics/tests/TraitWithConstructor.kt b/compiler/testData/diagnostics/tests/TraitWithConstructor.kt index 9b85c1b14da..5b380da0daa 100644 --- a/compiler/testData/diagnostics/tests/TraitWithConstructor.kt +++ b/compiler/testData/diagnostics/tests/TraitWithConstructor.kt @@ -6,13 +6,13 @@ interface T1(val x: String) {} interface T2 constructor() {} -interface T3 private constructor(a: Int) {} +interface T3 private constructor(a: Int) {} interface T4 { - constructor(a: Int) { - val b: Int = 1 + constructor(a: Int) { + val b: Int = 1 } } interface T5 private () : T4 {} -interface T6 private : T5 {} \ No newline at end of file +interface T6 private : T5 {} diff --git a/compiler/testData/diagnostics/tests/TypeInference.kt b/compiler/testData/diagnostics/tests/TypeInference.kt index 9411d3f47c6..147fe6fa2cc 100644 --- a/compiler/testData/diagnostics/tests/TypeInference.kt +++ b/compiler/testData/diagnostics/tests/TypeInference.kt @@ -3,17 +3,17 @@ class C() { fun foo() : T {} } -fun foo(c: C) {} +fun foo(c: C) {} fun bar() : C {} fun main() { - val a : C = C(); - val x : C = C() - val y : C = C() - val z : C<*> = C() + val a : C = C(); + val x : C = C() + val y : C = C() + val z : C<*> = C() - val ba : C = bar(); - val bx : C = bar() - val by : C = bar() - val bz : C<*> = bar() + val ba : C = bar(); + val bx : C = bar() + val by : C = bar() + val bz : C<*> = bar() } diff --git a/compiler/testData/diagnostics/tests/Underscore.kt b/compiler/testData/diagnostics/tests/Underscore.kt index a67f76ab0e7..e9fbee38a68 100644 --- a/compiler/testData/diagnostics/tests/Underscore.kt +++ b/compiler/testData/diagnostics/tests/Underscore.kt @@ -8,13 +8,13 @@ class _<________> val ______ = _() fun __(___: Int, y: _?): Int { - val (_, z) = Pair(___ - 1, 42) + val (_, z) = Pair(___ - 1, 42) val (x, __________) = Pair(___ - 1, 42) val ____ = x // in backquotes: allowed val `_` = __________ - val q = fun(_: Int, __: Int) {} + val q = fun(_: Int, __: Int) {} q(1, 2) val _ = 56 diff --git a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.fir.kt b/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.fir.kt deleted file mode 100644 index bf866f26c3e..00000000000 --- a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun foo(f : () -> Unit) { - val x : Unit = f() -} diff --git a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.kt b/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.kt index da3b32b3c25..5ed8433ba0b 100644 --- a/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.kt +++ b/compiler/testData/diagnostics/tests/UnitByDefaultForFunctionTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun foo(f : () -> Unit) { - val x : Unit = f() + val x : Unit = f() } diff --git a/compiler/testData/diagnostics/tests/Unresolved.kt b/compiler/testData/diagnostics/tests/Unresolved.kt index efbfe2799ad..a2a9ba06fe2 100644 --- a/compiler/testData/diagnostics/tests/Unresolved.kt +++ b/compiler/testData/diagnostics/tests/Unresolved.kt @@ -3,13 +3,13 @@ package unresolved class Pair(val a: A, val b: B) fun testGenericArgumentsCount() { - val p1: Pair = Pair(2, 2) - val p2: Pair = Pair(2, 2) + val p1: Pair = Pair(2, 2) + val p2: Pair = Pair(2, 2) } fun testUnresolved() { if (a is String) { - val s = a + val s = a } foo(a) val s = "s" @@ -29,4 +29,4 @@ fun testUnresolved() { } } -fun foo1(i: Int) {} \ No newline at end of file +fun foo1(i: Int) {} diff --git a/compiler/testData/diagnostics/tests/UnusedInDestructuring.fir.kt b/compiler/testData/diagnostics/tests/UnusedInDestructuring.fir.kt index ddf1ff5a0fa..5a63457bf2f 100644 --- a/compiler/testData/diagnostics/tests/UnusedInDestructuring.fir.kt +++ b/compiler/testData/diagnostics/tests/UnusedInDestructuring.fir.kt @@ -1,3 +1,5 @@ +// !DIAGNOSTICS: +UNUSED_VARIABLE + data class D(val x: Int, val y: Int, val z: Int) fun foo(): Int { val (x, y, z) = D(1, 2, 3) diff --git a/compiler/testData/diagnostics/tests/UnusedInDestructuring.kt b/compiler/testData/diagnostics/tests/UnusedInDestructuring.kt index 720d3b1eef3..56e354953ad 100644 --- a/compiler/testData/diagnostics/tests/UnusedInDestructuring.kt +++ b/compiler/testData/diagnostics/tests/UnusedInDestructuring.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_VARIABLE +// !DIAGNOSTICS: +UNUSED_VARIABLE data class D(val x: Int, val y: Int, val z: Int) fun foo(): Int { diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt b/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt deleted file mode 100644 index 17eed4370af..00000000000 --- a/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -import kotlin.reflect.KProperty - -class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f: String) { - init { - a + a - } - - val g = b - - init { - c + c - } -} - -fun f(a: Int, b: Int, c: Int = b) { - a + a -} - -fun Any.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" -fun Any.setValue(thisRef: Any?, prop: KProperty<*>, value: String) { -} - -fun Any.provideDelegate(thisRef: Any?, prop: KProperty<*>) { -} - -operator fun Int.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" - -operator fun Int.setValue(thisRef: Any?, prop: KProperty<*>, value: String) { -} - -operator fun Int.provideDelegate(thisRef: Any?, prop: KProperty<*>) { -} - - -fun get(p: Any) { -} - -fun set(p: Any) { -} - -fun foo(s: String) { - s.xxx = 1 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.kt b/compiler/testData/diagnostics/tests/UnusedParameters.kt index 40a91f87c52..a78a5534a4b 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.kt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL import kotlin.reflect.KProperty -class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f: String) { +class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f: String) { init { a + a } @@ -12,15 +13,15 @@ class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f } } -fun f(a: Int, b: Int, c: Int = b) { +fun f(a: Int, b: Int, c: Int = b) { a + a } -fun Any.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" -fun Any.setValue(thisRef: Any?, prop: KProperty<*>, value: String) { +fun Any.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" +fun Any.setValue(thisRef: Any?, prop: KProperty<*>, value: String) { } -fun Any.provideDelegate(thisRef: Any?, prop: KProperty<*>) { +fun Any.provideDelegate(thisRef: Any?, prop: KProperty<*>) { } operator fun Int.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" @@ -32,12 +33,12 @@ operator fun Int.provideDelegate(thisRef: Any?, prop: KProperty<*>) { } -fun get(p: Any) { +fun get(p: Any) { } -fun set(p: Any) { +fun set(p: Any) { } fun foo(s: String) { s.xxx = 1 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt b/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt index 70f2c6d91cc..e85563ff10a 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt +++ b/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt @@ -1,3 +1,5 @@ +// !DIAGNOSTICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, +UNUSED_VARIABLE + package unused_variables fun testSimpleCases() { diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.kt b/compiler/testData/diagnostics/tests/UnusedVariables.kt index bbfaeee655c..7e9de849969 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.kt +++ b/compiler/testData/diagnostics/tests/UnusedVariables.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, UNUSED_VARIABLE +// !DIAGNOSTICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, +UNUSED_VARIABLE package unused_variables diff --git a/compiler/testData/diagnostics/tests/Varargs.kt b/compiler/testData/diagnostics/tests/Varargs.kt index 7e20e4f40be..d9a7c9a5659 100644 --- a/compiler/testData/diagnostics/tests/Varargs.kt +++ b/compiler/testData/diagnostics/tests/Varargs.kt @@ -1,5 +1,5 @@ -fun v(x : Int, y : String, vararg f : Long) {} -fun v1(vararg f : (Int) -> Unit) {} +fun v(x : Int, y : String, vararg f : Long) {} +fun v1(vararg f : (Int) -> Unit) {} fun test() { v(1, "") @@ -11,7 +11,7 @@ fun test() { v1({}) v1({}, {}) v1({}, 1, {}) - v1({}, {}, {it}) + v1({}, {}, {it}) v1({}) {} v1 {} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/Variance.kt b/compiler/testData/diagnostics/tests/Variance.kt index 4de5b052a5d..5df6ddb09b7 100644 --- a/compiler/testData/diagnostics/tests/Variance.kt +++ b/compiler/testData/diagnostics/tests/Variance.kt @@ -9,28 +9,28 @@ abstract class Usual {} fun foo(c: Consumer, p: Producer, u: Usual) { val c1: Consumer = c - val c2: Consumer = c1 + 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 u2: Usual = u1 } //Arrays copy example class Array(val length : Int, val t : T) { - fun get(index : Int) : T { return t } - fun set(index : Int, value : T) { /* ... */ } + fun get(index : Int) : T { return t } + fun set(index : Int, value : T) { /* ... */ } } -fun copy1(from : Array, to : Array) {} +fun copy1(from : Array, to : Array) {} -fun copy2(from : Array, to : Array) {} +fun copy2(from : Array, to : Array) {} -fun copy3(from : Array, to : Array) {} +fun copy3(from : Array, to : Array) {} -fun copy4(from : Array, to : Array) {} +fun copy4(from : Array, to : Array) {} fun f(ints: Array, any: Array, numbers: Array) { copy1(ints, any) @@ -38,4 +38,4 @@ fun f(ints: Array, any: Array, numbers: Array) { copy2(ints, numbers) copy3(ints, numbers) copy4(ints, numbers) //ok -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt index 6a9e6fb163e..d953b1c418b 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt @@ -9,6 +9,6 @@ class SomeClass { val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> T.field: Int get() = 12 fun foo() { - val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> localVal = 12 + val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> localVal = 12 } } diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt index f6f673b2631..cb2f5c0017e 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt @@ -14,7 +14,7 @@ annotation class Ann4(val value: String) fun foo() { Ann() - val a = Ann() + val a = Ann() Ann1() Ann1(1) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.fir.kt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.fir.kt deleted file mode 100644 index fb0c2cf59db..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -annotation class Ann(vararg val i: Boolean) -fun foo() { - val bool1 = true - - @Ann(bool1) val a = bool1 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.kt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.kt index d3e55b46283..06e535f4c22 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/booleanLocalVal.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL annotation class Ann(vararg val i: Boolean) fun foo() { val bool1 = true - @Ann(bool1) val a = bool1 -} \ No newline at end of file + @Ann(bool1) val a = bool1 +} diff --git a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt index 760c984e59a..e9ce6a8f807 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt @@ -13,7 +13,7 @@ annotation class Ann fun <@Ann R : @Ann Any> f3(a: Array<@Ann R>): Array<@Ann R?> = null!! fun test2(a: @Ann Array) { - val r: Array = f3(a) + val r: Array = f3(a) } @@ -23,4 +23,4 @@ var test3: Int = 0 fun f4(fn: (@Ann Int, @Ann Int) -> Unit) {} -val test4 = f4 Unit; (Int) -> Unit")!>{ single -> } +val test4 = f4 Unit; (Int) -> Unit")!>{ single -> } diff --git a/compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt b/compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt index c1884e0f9aa..a8982449481 100644 --- a/compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt +++ b/compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt @@ -33,7 +33,7 @@ fun foo(y: IntArray) { @Ann1 y[0] - @Ann1 { x: Int -> x } + @Ann1 { x: Int -> x } @Ann1 { x: Int -> x }(1) @Ann1 object { fun foo() = 1 } @Ann1 object { fun foo() = 1 }.foo() diff --git a/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.kt b/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.kt index 3fe61957748..f221b845569 100644 --- a/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.kt +++ b/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.kt @@ -8,7 +8,7 @@ fun foo() { for (@Ann(1) i in 1..100) {} for (@Ann(2) i in 1..100) {} - for (@Ann(3) (x, @Ann(4) y) in bar()) {} + for (@Ann(3) (x, @Ann(4) y) in bar()) {} - for (@Err() (x,y) in bar()) {} + for (@Err() (x,y) in bar()) {} } diff --git a/compiler/testData/diagnostics/tests/annotations/functionalTypes/nonParenthesizedAnnotationsWithError.kt b/compiler/testData/diagnostics/tests/annotations/functionalTypes/nonParenthesizedAnnotationsWithError.kt index 50965b8bf06..7c66e4bf424 100644 --- a/compiler/testData/diagnostics/tests/annotations/functionalTypes/nonParenthesizedAnnotationsWithError.kt +++ b/compiler/testData/diagnostics/tests/annotations/functionalTypes/nonParenthesizedAnnotationsWithError.kt @@ -30,7 +30,7 @@ fun foo7() { val x: @Foo (@Foo () -> Unit) -> Unit = { x: @Foo () -> Unit -> } } -fun foo8(x: Any?) { +fun foo8(x: Any?) { val x: (@Foo () -> Unit)? = {} } diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt index 1ed9b7850c1..10b6ba00a27 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt @@ -1,10 +1,10 @@ // !WITH_NEW_INFERENCE -fun foo(@varargs f : Int) {} +fun foo(@varargs f : Int) {} var bar : Int = 1 - set(@varargs v) {} + set(@varargs v) {} val x : (Int) -> Int = {@varargs x : Int -> x} -class Hello(@varargs args: Any) { +class Hello(@varargs args: Any) { } diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt index 3b5cde4b8d8..66565a9af09 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt @@ -3,12 +3,12 @@ @Retention(AnnotationRetention.SOURCE) annotation class test -fun foo(@test f : Int) {} +fun foo(@test f : Int) {} var bar : Int = 1 - set(@test v) {} + set(@test v) {} val x : (Int) -> Int = {@test x : Int -> x} // todo fix parser annotation on lambda parameter -class Hello(@test args: Any) { +class Hello(@test args: Any) { } diff --git a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt index 24fb2eadb87..dac8f1ed1c5 100644 --- a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt @@ -16,7 +16,7 @@ annotation class Foo { } - constructor(s: Int) {} + constructor(s: Int) {} init {} fun function() {} val property get() = Unit diff --git a/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.fir.kt b/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.fir.kt deleted file mode 100644 index f0b2fcb1e1c..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -annotation class ann - -fun test(@ann p: Int) { - -} - -val bar = fun(@ann g: Int) {} diff --git a/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.kt b/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.kt index 3cab4db96aa..e2ab5716ca4 100644 --- a/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.kt +++ b/compiler/testData/diagnostics/tests/annotations/onFunctionParameter.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL annotation class ann -fun test(@ann p: Int) { +fun test(@ann p: Int) { } -val bar = fun(@ann g: Int) {} +val bar = fun(@ann g: Int) {} diff --git a/compiler/testData/diagnostics/tests/annotations/options/setterParam.kt b/compiler/testData/diagnostics/tests/annotations/options/setterParam.kt index a3086d0027c..f077438ec73 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/setterParam.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/setterParam.kt @@ -5,4 +5,4 @@ annotation class Ann var x: Int get() = 1 - set(@Ann private x) { } \ No newline at end of file + set(@Ann private x) { } diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/typeParams.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/typeParams.kt index 3f435d0d25c..0283eaf32e3 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/typeParams.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/typeParams.kt @@ -27,7 +27,7 @@ class Class2 { @A fun foo() {} @A class D fun foo(i: @A Int) { - @A val i = 1 + @A val i = 1 } fun test(t: @A T): T = t @@ -35,4 +35,4 @@ fun test(t: @A T): T = t @Target(AnnotationTarget.TYPE) internal annotation class C -fun <@C T> test2(t: T): T = t \ No newline at end of file +fun <@C T> test2(t: T): T = t diff --git a/compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt b/compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt index 899c7ee199f..5894bcfa7e2 100644 --- a/compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt +++ b/compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt @@ -12,5 +12,5 @@ class C { } fun test(a: C) { - "), OI{OI}!>a[1] = 25 + ")!>a[1] = 25 } diff --git a/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt b/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt index ee51112f1e8..6cc078e1704 100644 --- a/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt +++ b/compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt @@ -14,5 +14,5 @@ class C { class Out fun test(a: C, y: Out) { - a + "{OI}, "Out"{OI}, "public{OI}, :{OI}, C"{OI}, C{OI}, CharSequence>"{OI}, NI{OI}, Out{OI}, TYPE_MISMATCH("Out; Out"), TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS{OI}, defined{OI}, final{OI}, fun{OI}, in{OI}, operator{OI}, plus{OI}, x:{OI}!>y + a + ; Out"), TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS{OI}!>y } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt index 5bccfc5e716..633f183e0bd 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt @@ -26,9 +26,9 @@ class SomeClass { get() = 5 @field:Ann - fun anotherFun(@field:Ann s: String) { + fun anotherFun(@field:Ann s: String) { @field:Ann - val localVariable = 5 + val localVariable = 5 } } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt index 5fceaa5dc2b..9510423cb9e 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt @@ -33,7 +33,7 @@ class SomeClass { fun anotherFun() { @get:Ann - val localVariable = 5 + val localVariable = 5 } } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ParamAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ParamAnnotations.kt index be3a2eced72..b26997ddc8b 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ParamAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ParamAnnotations.kt @@ -5,7 +5,7 @@ annotation class Second class SomeClass { @param:Ann - constructor(@param:Ann a: String) + constructor(@param:Ann a: String) @param:Ann protected val simpleProperty: String = "text" @@ -13,12 +13,12 @@ class SomeClass { @param:Ann fun anotherFun() { @param:Ann - val localVariable = 5 + val localVariable = 5 } } class PrimaryConstructorClass( - @param:Ann a: String, -@param:[Ann Second] b: String, -@param:Ann val c: String) \ No newline at end of file + @param:Ann a: String, +@param:[Ann Second] b: String, +@param:Ann val c: String) diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt index 74ef525409e..aa5989a5fda 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt @@ -11,7 +11,7 @@ class CustomDelegate { class SomeClass { @property:Ann - constructor(s: String) + constructor(s: String) @property:Ann protected val p1: String = "" @@ -28,12 +28,12 @@ class SomeClass { @property:Ann var propertyWithCustomSetter: Int get() = 5 - set(v) {} + set(v) {} @property:Ann fun anotherFun() { @property:Ann - val localVariable = 5 + val localVariable = 5 } } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt index e1bc69caa75..6e049fa9e65 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt @@ -4,7 +4,7 @@ annotation class Ann class SomeClass { @receiver:Ann - constructor(@receiver:Ann a: String) + constructor(@receiver:Ann a: String) @receiver:Ann protected val simpleProperty: String = "text" @@ -12,7 +12,7 @@ class SomeClass { @receiver:Ann fun anotherFun() { @receiver:Ann - val localVariable = 5 + val localVariable = 5 } val @receiver:Ann String.extensionProperty2: String @@ -22,4 +22,4 @@ class SomeClass { fun @receiver:Ann String.length2() = length val @receiver:Ann String.extensionProperty: String - get() = "A" \ No newline at end of file + get() = "A" diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt index 5931ea566a0..6c3bcd699b5 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt @@ -25,14 +25,14 @@ class SomeClass { @set:Ann var propertyWithCustomSetter: Int get() = 5 - set(v) {} + set(v) {} @set:Ann fun annotationOnFunction(a: Int) = a + 5 fun anotherFun() { @set:Ann - val localVariable = 5 + val localVariable = 5 } } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt index faa96fb2439..bb7d1fc45ff 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt @@ -28,12 +28,12 @@ class SomeClass { @setparam:Ann var propertyWithCustomSetter: Int get() = 5 - set(v) {} + set(v) {} @setparam:Ann fun anotherFun() { @setparam:Ann - val localVariable = 5 + val localVariable = 5 } } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt index 4f58911af9c..f287fc92fba 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt @@ -55,5 +55,5 @@ public class B(@param:fieldOrPro var w: Int @getSetAndParamAnn @get:getSetAndParamAnn get() = 0 // See KT-15470: fake INAPPLICABLE_TARGET_ON_PROPERTY - @getSetAndParamAnn @set:getSetAndParamAnn set(arg) {} -} \ No newline at end of file + @getSetAndParamAnn @set:getSetAndParamAnn set(arg) {} +} diff --git a/compiler/testData/diagnostics/tests/backingField/FieldAsParam.kt b/compiler/testData/diagnostics/tests/backingField/FieldAsParam.kt index 96dcdd452c2..d193ca46cbf 100644 --- a/compiler/testData/diagnostics/tests/backingField/FieldAsParam.kt +++ b/compiler/testData/diagnostics/tests/backingField/FieldAsParam.kt @@ -3,6 +3,6 @@ var y: Int = 1 // No backing field! var x: Int get() = y - set(field) { + set(field) { y = field - } \ No newline at end of file + } diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.fir.kt index e5ef472e29b..4a776b94919 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.fir.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_EXPRESSION +// !DIAGNOSTICS: +UNUSED_EXPRESSION fun unusedExpression(s: String) { s::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.kt b/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.kt index 66c2a1367fa..2fb5a5c4614 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_EXPRESSION +// !DIAGNOSTICS: +UNUSED_EXPRESSION fun unusedExpression(s: String) { s::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.kt b/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.kt index d9293696fa8..ae13db9322d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.kt +++ b/compiler/testData/diagnostics/tests/callableReference/ea81649_errorPropertyLHS.kt @@ -5,7 +5,7 @@ // MODULE: m1 // FILE: bar.kt -fun bar(ff: Err.() -> Unit) { +fun bar(ff: Err.() -> Unit) { } // MODULE: m2(m1) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.fir.kt index e7b263890b0..c5bbfb426ce 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.fir.kt @@ -4,6 +4,6 @@ fun foo(x: Any, y: Int) = y fun main() { ::foo - + val fooRef: (Int, Any) -> Unit = ::foo } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.kt index 55bd278f232..81cd4f5d02b 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/ambiguityTopLevelVsTopLevel.kt @@ -1,9 +1,9 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -fun foo(x: Int, y: Any) = x -fun foo(x: Any, y: Int) = y +fun foo(x: Int, y: Any) = x +fun foo(x: Any, y: Int) = y fun main() { ::foo - + val fooRef: (Int, Any) -> Unit = ::foo } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/constructorOfNestedClassInObject.kt b/compiler/testData/diagnostics/tests/callableReference/function/constructorOfNestedClassInObject.kt index 2a69aeccb5d..60b261d02dd 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/constructorOfNestedClassInObject.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/constructorOfNestedClassInObject.kt @@ -16,6 +16,6 @@ fun test() { Outer.Companion::Wrapper (Outer.Companion)::Wrapper - Outer::Wrapper + Outer::Wrapper (Outer)::Wrapper } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.fir.kt deleted file mode 100644 index 073282b9ab2..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.fir.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !CHECK_TYPE -// FILE: a.kt - -package first - -import checkSubtype - -class A { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" -} - -// FILE: b.kt - -package other - -import kotlin.reflect.* -import checkSubtype -import first.A - -fun main() { - val x = first.A::foo - val y = first.A::bar - val z = A::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.kt index 6202b9f2179..f08393f106a 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: a.kt @@ -7,7 +8,7 @@ import checkSubtype class A { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.fir.kt deleted file mode 100644 index c9a4ed9b01a..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.fir.kt +++ /dev/null @@ -1,31 +0,0 @@ -// !CHECK_TYPE -// FILE: a.kt - -package first - -import checkSubtype - -fun foo() {} -fun bar(x: Int) {} -fun baz() = "OK" - -// FILE: b.kt - -package other - -import kotlin.reflect.* - -import first.foo -import first.bar -import first.baz -import checkSubtype - -fun main() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.kt index 63d9bcbbfb4..ac05cb8fc22 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageTopLevel.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: a.kt @@ -6,7 +7,7 @@ package first import checkSubtype fun foo() {} -fun bar(x: Int) {} +fun bar(x: Int) {} fun baz() = "OK" // FILE: b.kt diff --git a/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.fir.kt deleted file mode 100644 index 67b2957ffb7..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A - -fun A.foo() {} -fun A.bar(x: Int) {} -fun A.baz() = "OK" - -fun main() { - val x = A::foo - val y = A::bar - val z = A::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.kt index 3d69d34d670..46a2d56ad3c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/extensionFromTopLevel.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* @@ -5,7 +6,7 @@ import kotlin.reflect.* class A fun A.foo() {} -fun A.bar(x: Int) {} +fun A.bar(x: Int) {} fun A.baz() = "OK" fun main() { diff --git a/compiler/testData/diagnostics/tests/callableReference/function/lhsNotAClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/lhsNotAClass.kt index b5691532799..84cd54098f3 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/lhsNotAClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/lhsNotAClass.kt @@ -16,4 +16,4 @@ fun foo() = T:: bar() = U::toString -fun take(arg: Any) {} +fun take(arg: Any) {} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.fir.kt deleted file mode 100644 index c528b387fb7..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -fun main() { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" - - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.kt index ea909dfafe8..ae5e73606c8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFun.kt @@ -1,16 +1,17 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* fun main() { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" - + val x = ::foo val y = ::bar val z = ::baz - + checkSubtype>(x) checkSubtype>(y) checkSubtype>(z) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.fir.kt deleted file mode 100644 index 066194937bb..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A - -fun main() { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" - - class B { - fun A.ext() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - } - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.kt index 4c75130d2de..356563670ce 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromExtensionInLocalClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* @@ -6,9 +7,9 @@ class A fun main() { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" - + class B { fun A.ext() { val x = ::foo diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.fir.kt deleted file mode 100644 index 87aa5961b1f..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -fun main() { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" - - class A { - val x = ::foo - val y = ::bar - val z = ::baz - - fun main() { - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - } - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.kt index 13b5f74b54c..850b835d73c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalClass.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* fun main() { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" - + class A { val x = ::foo val y = ::bar diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.fir.kt deleted file mode 100644 index d4621ce0203..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A - -fun main() { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" - - fun A.ext() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.kt b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.kt index 2d5c83671ba..935525007e8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/localNamedFunFromLocalExtension.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* @@ -6,9 +7,9 @@ class A fun main() { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" - + fun A.ext() { val x = ::foo val y = ::bar diff --git a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt deleted file mode 100644 index 155c40387b1..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !CHECK_TYPE -// FILE: a.kt - -package a.b.c - -class D { - fun foo(e: E, f: F) = this -} - -// FILE: b.kt - -import kotlin.reflect.KFunction3 - -fun main() { - val x = a.b.c.D::foo - - checkSubtype, String, Int, a.b.c.D>>(x) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.kt b/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.kt index 755f7118aee..47886f8f079 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/longQualifiedNameGeneric.kt @@ -1,10 +1,11 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: a.kt package a.b.c class D { - fun foo(e: E, f: F) = this + fun foo(e: E, f: F) = this } // FILE: b.kt diff --git a/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.fir.kt deleted file mode 100644 index 206170c361c..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A { - fun foo() {} - fun bar(x: Int) {} - fun baz() = "OK" -} - -fun main() { - val x = A::foo - val y = A::bar - val z = A::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.kt index 68705bf7cbf..2568388ac91 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/memberFromTopLevel.kt @@ -1,10 +1,11 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* class A { fun foo() {} - fun bar(x: Int) {} + fun bar(x: Int) {} fun baz() = "OK" } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.fir.kt deleted file mode 100644 index 24d48d3fff5..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.fir.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !CHECK_TYPE -// FILE: a.kt - -package other - -fun foo() {} - -class A { - fun bar() = 42 -} - -fun A.baz(x: String) {} - -// FILE: b.kt - -import kotlin.reflect.* - -import other.foo as foofoo -import other.A as AA -import other.baz as bazbaz - -fun main() { - val x = ::foofoo - val y = AA::bar - val z = AA::bazbaz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.kt b/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.kt index 0d7c73d8a06..06bf3df5b55 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/renameOnImport.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: a.kt @@ -9,7 +10,7 @@ class A { fun bar() = 42 } -fun A.baz(x: String) {} +fun A.baz(x: String) {} // FILE: b.kt diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.fir.kt deleted file mode 100644 index 957ac5d9a57..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -fun foo() {} -fun bar(x: Int) {} -fun baz() = "OK" - -class A { - fun main() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.kt index 6d16da4a859..a99dd0d4945 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromClass.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* fun foo() {} -fun bar(x: Int) {} +fun bar(x: Int) {} fun baz() = "OK" class A { diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.fir.kt deleted file mode 100644 index 6152a3cc17c..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A - -fun foo() {} -fun bar(x: Int) {} -fun baz() = "OK" - -fun A.main() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.kt index 3c624df7123..6d6b550e245 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtension.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* @@ -5,7 +6,7 @@ import kotlin.reflect.* class A fun foo() {} -fun bar(x: Int) {} +fun bar(x: Int) {} fun baz() = "OK" fun A.main() { diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.fir.kt deleted file mode 100644 index 726176d3407..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -class A - -fun foo() {} -fun bar(x: Int) {} -fun baz() = "OK" - -class B { - fun A.main() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.kt index 9890a849f2e..d7e1a3cc384 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromExtensionInClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* @@ -5,7 +6,7 @@ import kotlin.reflect.* class A fun foo() {} -fun bar(x: Int) {} +fun bar(x: Int) {} fun baz() = "OK" class B { diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.fir.kt deleted file mode 100644 index b5a8194bacc..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !CHECK_TYPE - -import kotlin.reflect.* - -fun foo() {} -fun bar(x: Int) {} -fun baz() = "OK" - -fun main() { - val x = ::foo - val y = ::bar - val z = ::baz - - checkSubtype>(x) - checkSubtype>(y) - checkSubtype>(z) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.kt index 42f20e8b517..47b65487427 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/topLevelFromTopLevel.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL // !CHECK_TYPE import kotlin.reflect.* fun foo() {} -fun bar(x: Int) {} +fun bar(x: Int) {} fun baz() = "OK" fun main() { diff --git a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt index 6cbec1318df..571e46a8ca7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt @@ -4,7 +4,7 @@ class A fun test1() { - val foo = ::foo + val foo = ::foo ::bar diff --git a/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt b/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt index 3c1e261a52b..941ac04e3c4 100644 --- a/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt +++ b/compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt @@ -2,10 +2,10 @@ class DTO { val q: Int = 0 - operator fun get(prop: KProperty1<*, Int>): Int = 0 + operator fun get(prop: KProperty1<*, Int>): Int = 0 } -fun foo(intDTO: DTO?, p: KProperty1<*, Int>) { +fun foo(intDTO: DTO?, p: KProperty1<*, Int>) { if (intDTO != null) { intDTO[DTO::q] intDTO.q diff --git a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.fir.kt index de71e04316b..f48a550a72e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.fir.kt @@ -11,7 +11,7 @@ var Int.meaning: Long fun test() { val f = String::countCharacters - + checkSubtype>(f) checkSubtype>(f) checkSubtype(f.get("abc")) diff --git a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt index b05fd05eba3..ea57fb3ff89 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/extensionFromTopLevel.kt @@ -7,11 +7,11 @@ val String.countCharacters: Int var Int.meaning: Long get() = 42L - set(value) {} + set(value) {} fun test() { val f = String::countCharacters - + checkSubtype>(f) checkSubtype>(f) checkSubtype(f.get("abc")) diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.fir.kt deleted file mode 100644 index 4f5d6bf441a..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// KT-12338 Compiler error ERROR: Rewrite at slice LEXICAL_SCOPE key: REFERENCE_EXPRESSION with when and function references - -fun a() { } - -fun test() { - when { - true -> ::a - } -} diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.kt index dba235fe1cf..d4c9e0f2e63 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/kt12338.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL // KT-12338 Compiler error ERROR: Rewrite at slice LEXICAL_SCOPE key: REFERENCE_EXPRESSION with when and function references fun a() { } fun test() { when { - true -> ::a + true -> ::a } } diff --git a/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.kt b/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.kt index 334f29d9a76..cdec100f59e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.kt +++ b/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.kt @@ -6,9 +6,9 @@ class Foo { operator fun getValue(thisRef: Any?, property: KProperty<*>) = 1 } -fun main(x: Int) { +fun main(x: Int) { val f = Foo() val a: Int get() = f.getValue(null, ::x) // no exception after fix print(a) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/callableReference/unused.fir.kt b/compiler/testData/diagnostics/tests/callableReference/unused.fir.kt index 6372d175da6..6d8d0a6ea1d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/unused.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/unused.fir.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_EXPRESSION +// !DIAGNOSTICS: +UNUSED_EXPRESSION fun foo() { } diff --git a/compiler/testData/diagnostics/tests/callableReference/unused.kt b/compiler/testData/diagnostics/tests/callableReference/unused.kt index 3fd96ee645d..9d4323bedba 100644 --- a/compiler/testData/diagnostics/tests/callableReference/unused.kt +++ b/compiler/testData/diagnostics/tests/callableReference/unused.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_EXPRESSION +// !DIAGNOSTICS: +UNUSED_EXPRESSION fun foo() { } diff --git a/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt index 1193a21ebac..aeceae67b99 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.kt @@ -12,7 +12,7 @@ fun main() { join(1, "2", "3") join(*1, "2") join(1, *"2") - join(x = 1, a = "2") + join(x = 1, a = "2") join(x = *1, a = *"2") join(x = 1, a = a) join(x = 1, a = b) @@ -33,7 +33,7 @@ fun main() { joinG(*1, "2") joinG(1, *"2") joinG(x = 1, a = a) - joinG(x = 1, a = "2") + joinG(x = 1, a = "2") joinG(x = *1, a = *"2") joinG(1, *a) joinG(1, *a, "3") @@ -46,7 +46,7 @@ fun main() { joinG(*1, "2") joinG(1, *"2") joinG(x = 1, a = a) - joinG(x = 1, a = "2") + joinG(x = 1, a = "2") joinG(x = *1, a = *"2") joinG(1, *a) joinG(1, *a, "3") @@ -91,6 +91,6 @@ fun joinG(x : Int, vararg a : T) : String { return b.toString() } -fun joinT(x : Int, vararg a : T) : T? { +fun joinT(x : Int, vararg a : T) : T? { return null } diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt index 3e3f5038433..0d2effdee2b 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt @@ -5,7 +5,7 @@ package a fun bar() {} -fun foo(i: Int, s: String) {} +fun foo(i: Int, s: String) {} fun test() { diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt index 8f4a4ce4193..4daa0628c5b 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt @@ -1,9 +1,9 @@ //KT-1940 Exception while repeating named parameters package kt1940 -fun foo(i: Int) {} +fun foo(i: Int) {} fun test() { foo(1, i = 2) //exception foo(i = 1, i = 2) //exception -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt b/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt deleted file mode 100644 index 53b51edd83f..00000000000 --- a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-13110 Strange type mismatch error on class literal with integer receiver expression - -import kotlin.reflect.KClass - -fun f(x: KClass) {} - -fun test() { - f(42::class) - f((40 + 2)::class) - 42::toInt -} diff --git a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt b/compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt index 90d7c450ce7..b4642396c4a 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/integerValueType.kt @@ -1,11 +1,12 @@ +// FIR_IDENTICAL // KT-13110 Strange type mismatch error on class literal with integer receiver expression import kotlin.reflect.KClass -fun f(x: KClass) {} +fun f(x: KClass) {} fun test() { f(42::class) f((40 + 2)::class) - 42::toInt + 42::toInt } diff --git a/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt b/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt index 6c630e252b9..ff433d4d008 100644 --- a/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt +++ b/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt @@ -1,9 +1,9 @@ package test -open class ToResolve(f : (Int) -> Int) -fun testFun(a : Int) = 12 +open class ToResolve(f : (Int) -> Int) +fun testFun(a : Int) = 12 class TestSome

{ companion object : ToResolve<P>({testFun(it)}) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/classObjects/invisibleClassObjects.kt b/compiler/testData/diagnostics/tests/classObjects/invisibleClassObjects.kt index 9e882d8676f..0ff5548191b 100644 --- a/compiler/testData/diagnostics/tests/classObjects/invisibleClassObjects.kt +++ b/compiler/testData/diagnostics/tests/classObjects/invisibleClassObjects.kt @@ -48,4 +48,4 @@ fun test() { a.C.baz() } -fun f(unused: Any) {} +fun f(unused: Any) {} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.kt b/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.kt index a0006c690cd..977712b1360 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.kt @@ -37,5 +37,5 @@ annotation class AnnArray(val a: Array) @AnnArray(*["/"]) fun testArray() {} -@Ann1([""]) +@Ann1([""]) fun testVararg() {} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/noCollectionLiterals.kt b/compiler/testData/diagnostics/tests/collectionLiterals/noCollectionLiterals.kt index c304ad29e5a..81f8fb4128c 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/noCollectionLiterals.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/noCollectionLiterals.kt @@ -6,11 +6,11 @@ fun test(): Array { foo([""]) - val p = [1, 2] + [3, 4] + val p = [1, 2] + [3, 4] return [1, 2] } -fun foo(a: Array = [""]) {} +fun foo(a: Array = [""]) {} class A(val a: Array = []) diff --git a/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.kt b/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.kt index aa884b4de23..c3a4ed842b0 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.kt @@ -1,11 +1,10 @@ - fun foo1() = while (b()) {} -fun foo2() = for (i in 10) {} +fun foo2() = for (i in 10) {} fun foo3() = when (b()) { true -> 1 else -> 0 } -fun b(): Boolean = true \ No newline at end of file +fun b(): Boolean = true diff --git a/compiler/testData/diagnostics/tests/controlStructures/ifToAnyDiscriminatingUsages.kt b/compiler/testData/diagnostics/tests/controlStructures/ifToAnyDiscriminatingUsages.kt index 13910df8e7a..c622c657b29 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ifToAnyDiscriminatingUsages.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ifToAnyDiscriminatingUsages.kt @@ -23,7 +23,7 @@ fun testResultOfAnonFun1() = fun testResultOfAnonFun2() = run(fun () { - if (true) 42 else println() + if (true) 42 else println() }) fun testReturnFromAnonFun() = diff --git a/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt b/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt index 74a3a404a95..ed88ad9c5a4 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ifWhenWithoutElse.kt @@ -27,17 +27,17 @@ val wxx5 = idUnit(when { true -> when { true -> 42 } val wxx7 = "" + when { true -> 42 } -val fn1 = { if (true) 42 } +val fn1 = { if (true) 42 } val fn2 = { if (true) mlist.add() } val fn3 = { if (true) work() } val fn4 = { when { true -> 42 } } val fn5 = { when { true -> mlist.add() } } val fn6 = { when { true -> work() } } -val ufn1: () -> Unit = { if (true) 42 } +val ufn1: () -> Unit = { if (true) 42 } val ufn2: () -> Unit = { if (true) mlist.add() } val ufn3: () -> Unit = { if (true) work() } -val ufn4: () -> Unit = { when { true -> 42 } } +val ufn4: () -> Unit = { when { true -> 42 } } val ufn5: () -> Unit = { when { true -> mlist.add() } } val ufn6: () -> Unit = { when { true -> work() } } @@ -83,4 +83,3 @@ fun foo2() { } } } - diff --git a/compiler/testData/diagnostics/tests/controlStructures/improperElseInExpression.kt b/compiler/testData/diagnostics/tests/controlStructures/improperElseInExpression.kt index 8d2405da327..2642a097384 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/improperElseInExpression.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/improperElseInExpression.kt @@ -10,7 +10,7 @@ fun example() { val f = if (true) true else {} { - if (true) true + if (true) true }(); { diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt b/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt index e7adc4b5300..5ec810f7df0 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt @@ -6,7 +6,7 @@ package kt1075 fun foo(b: String) { if (b in 1..10) {} //type mismatch when (b) { - in 1..10 -> 1 //no type mismatch, but it should be here - else -> 2 + in 1..10 -> 1 //no type mismatch, but it should be here + else -> 2 } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt index 3ea9283f14b..d37750959f5 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt @@ -1,7 +1,7 @@ //KT-657 Semantic checks for when without condition package kt657 -class Pair(a: A, b: B) +class Pair(a: A, b: B) fun foo() = when { 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 f1a587fb3e9..666c51ccf03 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt @@ -27,8 +27,8 @@ fun foo() { z = 34 } } - val f: ()-> Int = r - val g: ()-> Any = r + val f: ()-> Int = r + val g: ()-> Any = r } //KT-735 Statements without braces are prohibited on the right side of when entries. @@ -48,27 +48,27 @@ fun test1() { while(true) {} } fun test2(): Unit { while(true) {} } fun testCoercionToUnit() { - val simple: ()-> Unit = { - 41 + val simple: ()-> Unit = { + 41 } - val withIf: ()-> Unit = { + val withIf: ()-> Unit = { if (true) { - 3 + 3 } else { - 45 + 45 } } val i = 34 - val withWhen : () -> Unit = { + val withWhen : () -> Unit = { when(i) { 1 -> { val d = 34 - "1" + "1" doSmth(d) } - 2 -> '4' - else -> true + 2 -> '4' + else -> true } } @@ -80,54 +80,54 @@ fun testCoercionToUnit() { 45 } } - val f : () -> String = checkType + val f : () -> String = checkType } -fun doSmth(i: Int) {} +fun doSmth(i: Int) {} fun testImplicitCoercion() { val d = 21 var z = 0 - var i = when(d) { + var i = when(d) { 3 -> null - 4 -> { val z = 23 } + 4 -> { val z = 23 } else -> z = 20 } - var u = when(d) { - 3 -> { z = 34 } - else -> z-- + var u = when(d) { + 3 -> { z = 34 } + else -> z-- } - var iff = if (true) { - z = 34 + var iff = if (true) { + z = 34 } - val g = if (true) 4 - val h = if (false) 4 else {} + val g = if (true) 4 + val h = if (false) 4 else {} bar(if (true) { 4 } else { - z = 342 + z = 342 }) } -fun fooWithAnyArg(arg: Any) {} -fun fooWithAnyNullableArg(arg: Any?) {} +fun fooWithAnyArg(arg: Any) {} +fun fooWithAnyNullableArg(arg: Any?) {} fun testCoercionToAny() { val d = 21 - val x1: Any = if (1>2) 1 else 2.0 - val x2: Any? = if (1>2) 1 else 2.0 - val x3: Any? = if (1>2) 1 else (if (1>2) null else 2.0) + val x1: Any = if (1>2) 1 else 2.0 + val x2: Any? = if (1>2) 1 else 2.0 + val x3: Any? = if (1>2) 1 else (if (1>2) null else 2.0) fooWithAnyArg(if (1>2) 1 else 2.0) fooWithAnyNullableArg(if (1>2) 1 else 2.0) fooWithAnyNullableArg(if (1>2) 1 else (if (1>2) null else 2.0)) - val y1: Any = when(d) { 1 -> 1.0 else -> 2.0 } - val y2: Any? = when(d) { 1 -> 1.0 else -> 2.0 } - val y3: Any? = when(d) { 1 -> 1.0; 2 -> null; else -> 2.0 } + val y1: Any = when(d) { 1 -> 1.0 else -> 2.0 } + val y2: Any? = when(d) { 1 -> 1.0 else -> 2.0 } + val y3: Any? = when(d) { 1 -> 1.0; 2 -> null; else -> 2.0 } fooWithAnyArg(when(d) { 1 -> 1.0 else -> 2.0 }) fooWithAnyNullableArg(when(d) { 1 -> 1.0 else -> 2.0 }) @@ -145,16 +145,16 @@ fun fooWithAnuNullableResult(s: String?, name: String, optional: Boolean): Any? } } -fun bar(a: Unit) {} +fun bar(a: Unit) {} fun testStatementInExpressionContext() { var z = 34 - val a1: Unit = z = 334 - val f = for (i in 1..10) {} - if (true) return z = 34 + val a1: Unit = z = 334 + val f = for (i in 1..10) {} + if (true) return z = 34 return while (true) {} } fun testStatementInExpressionContext2() { - val a2: Unit = while(true) {} + val a2: Unit = while(true) {} } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt index 5d8ddba83e9..8fac094ccb0 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt @@ -5,8 +5,8 @@ fun foo() : Int { val d = 2 var z = 0 when(d) { - 5, 3 -> z++ - else -> { z = -1000 } + 5, 3 -> z++ + else -> { z = -1000 } return z -> 34 } } @@ -15,7 +15,7 @@ fun foo() : Int { fun fff(): Int { var d = 3 when(d) { - 4 -> 21 + 4 -> 21 return 2 -> return 47 bar() -> 45 444 -> true @@ -23,4 +23,4 @@ fun fff(): Int { return 34 } -fun bar(): Int = 8 \ No newline at end of file +fun bar(): Int = 8 diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt799.kt b/compiler/testData/diagnostics/tests/controlStructures/kt799.kt index f1aa021f3cb..dc7a73f813d 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt799.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt799.kt @@ -3,9 +3,9 @@ package kt799 fun test() { - val a : Int = if (true) 6 else return // should be allowed + val a : Int = if (true) 6 else return // should be allowed - val b = if (true) 6 else return // should be allowed + val b = if (true) 6 else return // should be allowed doSmth(if (true) 3 else return) @@ -19,7 +19,7 @@ val b = return 1 val c = doSmth(if (true) 3 else return) -fun f(mi: Int = if (true) 0 else return) {} +fun f(mi: Int = if (true) 0 else return) {} -fun doSmth(i: Int) { +fun doSmth(i: Int) { } diff --git a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt index f1af079ad20..56c4ce766e4 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt @@ -11,6 +11,6 @@ fun test() { { } ?: 1 use({ 2 } ?: 1); - 1 ?: { } + 1 ?: { } use(1 ?: { }) } diff --git a/compiler/testData/diagnostics/tests/controlStructures/tryReturnType.kt b/compiler/testData/diagnostics/tests/controlStructures/tryReturnType.kt index 40149769d1b..99b44752f88 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/tryReturnType.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/tryReturnType.kt @@ -21,7 +21,7 @@ fun bar() : Int = "" } finally { - "" + "" } diff --git a/compiler/testData/diagnostics/tests/controlStructures/valVarLoopParameter.kt b/compiler/testData/diagnostics/tests/controlStructures/valVarLoopParameter.kt index be09dd797d7..a1956f7f86d 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/valVarLoopParameter.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/valVarLoopParameter.kt @@ -22,11 +22,11 @@ fun f() { } - for (val (i,j) in Coll()) { + for (val (i,j) in Coll()) { } - for (var (i,j) in Coll()) { + for (var (i,j) in Coll()) { } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt index 313dbe03628..b46d887e1d4 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt @@ -3,7 +3,7 @@ package kt234_kt973 -class Pair(a: A, b: B) +class Pair(a: A, b: B) fun test(t : Pair) : Int { when (t) { @@ -21,7 +21,7 @@ fun test1(t : Pair) : Int { } //more tests -fun t1(x: Int) = when(x) { +fun t1(x: Int) = when(x) { else -> 1 } diff --git a/compiler/testData/diagnostics/tests/cyclicHierarchy/commonSupertypeForCyclicAndUsualTypes.kt b/compiler/testData/diagnostics/tests/cyclicHierarchy/commonSupertypeForCyclicAndUsualTypes.kt index ab2fc7da140..e21856a33a7 100644 --- a/compiler/testData/diagnostics/tests/cyclicHierarchy/commonSupertypeForCyclicAndUsualTypes.kt +++ b/compiler/testData/diagnostics/tests/cyclicHierarchy/commonSupertypeForCyclicAndUsualTypes.kt @@ -4,5 +4,5 @@ open class B : A() fun select(vararg xs: T): T = xs[0] fun foo() { - val x = select(A(), B(), "foo") -} \ No newline at end of file + val x = select(A(), B(), "foo") +} diff --git a/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.fir.kt b/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.fir.kt deleted file mode 100644 index e9a4216042c..00000000000 --- a/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -data class My(val x: Int, vararg val y: String) - -data class Your(vararg z: String) diff --git a/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.kt b/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.kt index 46bf53f6f40..c4ada415980 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/dataClassVarargParam.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL data class My(val x: Int, vararg val y: String) -data class Your(vararg z: String) \ No newline at end of file +data class Your(vararg z: String) diff --git a/compiler/testData/diagnostics/tests/dataFlow/IsExpression.kt b/compiler/testData/diagnostics/tests/dataFlow/IsExpression.kt index 2b33b708e80..17dbc80e501 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/IsExpression.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/IsExpression.kt @@ -1,4 +1,4 @@ -fun f(a: Boolean, b: Int) {} +fun f(a: Boolean, b: Int) {} fun foo(a: Any) { f(a is Int, a) diff --git a/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt b/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt index e6cd7eab473..4650a6f833f 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt @@ -4,7 +4,7 @@ class BinOp(val operator : String) : Expr fun test(e : Expr) { if (e is BinOp) { when (e.operator) { - else -> 0 + else -> 0 } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt index 566e118a22c..522b57dc8bb 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt @@ -1,4 +1,4 @@ -open class Base(x: String, y: Int) +open class Base(x: String, y: Int) fun test(x: Any, y: Int?) { if (x !is String) return @@ -7,4 +7,3 @@ fun test(x: Any, y: Int?) { class Local: Base(x, y) { } } - diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt index a4fdfcf6e8c..617e7a0f018 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt @@ -1,8 +1,7 @@ fun test(x: Any) { if (x !is String) return - class Local(s: String = x) { + class Local(s: String = x) { fun foo(s: String = x): String = s } } - diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt index 9be2ebf0d6d..80c466738f6 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt @@ -13,4 +13,4 @@ fun f(a: Any?) { interface B { fun foo() {} } -open class X(b: B) +open class X(b: B) diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt index ff9561985a0..827ad8ffb0c 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt @@ -6,4 +6,4 @@ fun foo(x: Any?) { } } -open class Base(s: String) \ No newline at end of file +open class Base(s: String) diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt index 8d07b8b532a..560341e80a4 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt @@ -1,6 +1,6 @@ // !CHECK_TYPE -infix fun Int.compareTo(o: Int) = 0 +infix fun Int.compareTo(o: Int) = 0 fun foo(a: Number): Int { val result = (a as Int) compareTo a @@ -12,4 +12,4 @@ fun bar(a: Number): Int { val result = 42 compareTo (a as Int) checkSubtype(a) return result -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ObjectExpression.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ObjectExpression.kt index a17c535d1b8..a3a056d3dff 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ObjectExpression.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ObjectExpression.kt @@ -5,7 +5,7 @@ fun bar(x: Int): Int = x + 1 fun foo() { val x: Int? = null - val a = object { + val a = object { fun baz() = bar(if (x == null) 0 else x) fun quux(): Int = if (x == null) x else x } diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt index 6748f092965..424f806cbff 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt @@ -2,10 +2,10 @@ fun foo(s: String?) { when { - s == null -> 1 - s.foo() -> 2 - else -> 3 + s == null -> 1 + s.foo() -> 2 + else -> 3 } } -fun String.foo() = true \ No newline at end of file +fun String.foo() = true diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt index fe2cb6fae30..67b7e87d9ae 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt @@ -20,34 +20,34 @@ class AClass() { val x : Any? = 1 -fun Any?.vars(a: Any?) : Int { +fun Any?.vars(a: Any?) : Int { var b: Int = 0 if (example.ns.y is Int) { - b = y + b = y } if (example.ns.y is Int) { - b = example.ns.y + b = example.ns.y } if (Obj.y is Int) { - b = Obj.y + b = Obj.y } if (example.Obj.y is Int) { - b = Obj.y + b = Obj.y } if (AClass.y is Int) { - b = AClass.y + b = AClass.y } if (example.AClass.y is Int) { - b = AClass.y + b = AClass.y } if (x is Int) { - b = x + b = x } if (example.x is Int) { - b = x + b = x } if (example.x is Int) { - b = example.x + b = example.x } return 1 } @@ -71,16 +71,16 @@ open class C { fun foo() { var t : T? = null if (this is T) { - t = this + t = this } if (this is T) { - t = this@C + t = this@C } if (this@C is T) { - t = this + t = this } if (this@C is T) { - t = this@C + t = this@C } } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt b/compiler/testData/diagnostics/tests/declarationChecks/ComponentFunctionReturnTypeMismatch.kt index 71e9390c6d3..d06ff5a7dfa 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/ConflictingAndRedundantProjections.kt b/compiler/testData/diagnostics/tests/declarationChecks/ConflictingAndRedundantProjections.kt index 062569c59cf..746da40db8c 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/ConflictingAndRedundantProjections.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/ConflictingAndRedundantProjections.kt @@ -3,18 +3,18 @@ class Out class Inv class X -fun f1(p: In<in X>) {} -fun f2(p: In<out X>) {} -fun f3(p: In) {} +fun f1(p: In<in X>) {} +fun f2(p: In<out X>) {} +fun f3(p: In) {} -fun f4(p: Out<out X>) {} -fun f5(p: Out<in X>) {} -fun f6(p: Out) {} +fun f4(p: Out<out X>) {} +fun f5(p: Out<in X>) {} +fun f6(p: Out) {} -fun f6(p: Inv) {} -fun f7(p: Inv) {} -fun f8(p: Inv) {} +fun f6(p: Inv) {} +fun f7(p: Inv) {} +fun f8(p: Inv) {} -fun f9(p: In<*>) {} -fun f10(p: Out<*>) {} -fun f11(p: Inv<*>) {} +fun f9(p: In<*>) {} +fun f10(p: Out<*>) {} +fun f11(p: Inv<*>) {} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt index 0911d17433c..4e185172718 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt @@ -8,8 +8,8 @@ class A { } fun foo(list: List) { - for (var (c1, c2, c3) in list) { - c1 = 1 + for (var (c1, c2, c3) in list) { + c1 = 1 c3 + 1 } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInfoInMultiDecl.kt b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInfoInMultiDecl.kt index 09a8ff45cd5..69ba3e89ef4 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInfoInMultiDecl.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInfoInMultiDecl.kt @@ -5,10 +5,10 @@ class A { fun a(aa : A?, b : Any) { if (aa != null) { - val (a1, b1) = aa; + val (a1, b1) = aa; } if (b is A) { - val (a1, b1) = b; + val (a1, b1) = b; } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/FunctionWithMissingNames.kt b/compiler/testData/diagnostics/tests/declarationChecks/FunctionWithMissingNames.kt index 2e3778aa182..b474cebe8e0 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/FunctionWithMissingNames.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/FunctionWithMissingNames.kt @@ -18,9 +18,9 @@ class Outer { } fun outerFun() { - fun () {} - fun B.() {} + fun () {} + fun B.() {} - @a fun () {} - fun @a A.() {} -} \ No newline at end of file + @a fun () {} + fun @a A.() {} +} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/LocalVariableWithNoTypeInformation.kt b/compiler/testData/diagnostics/tests/declarationChecks/LocalVariableWithNoTypeInformation.kt index 50c309fa4d6..809877f2071 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/LocalVariableWithNoTypeInformation.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/LocalVariableWithNoTypeInformation.kt @@ -1,3 +1,3 @@ fun test() { - val a + val a } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt index c754b55d98d..03abb77df1b 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.kt @@ -2,7 +2,7 @@ package a class MyClass { - fun component1(i: Int) {} + fun component1(i: Int) {} } class MyClass2 {} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/RedeclarationsInMultiDecl.kt b/compiler/testData/diagnostics/tests/declarationChecks/RedeclarationsInMultiDecl.kt index a23f77ad672..d42ff82a8a5 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/RedeclarationsInMultiDecl.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/RedeclarationsInMultiDecl.kt @@ -4,11 +4,11 @@ class A { } fun a() { - val (a, a) = A() - val (x, y) = A(); + val (a, a) = A() + val (x, y) = A(); val b = 1 use(b) - val (b, y) = A(); + val (b, y) = A(); } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.fir.kt deleted file mode 100644 index 6a1d156f778..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE -// !CHECK_TYPE -fun foo(block: () -> (() -> Int)) {} - -fun test() { - foo { fun(): Int {return 1} } - foo({ fun() = 1 }) - - val x1 = - if (1 == 1) - fun(): Int {return 1} - else - fun() = 1 - - val x2 = - if (1 == 1) { - fun(): Int { - return 1 - } - } - else - fun() = 1 - - val x3 = when (1) { - 0 -> fun(): Int {return 1} - else -> fun() = 1 - } - - val x31 = when (1) { - 0 -> { - fun(): Int {return 1} - } - else -> fun() = 1 - } - - val x4 = { - y: Int -> fun(): Int {return 1} - } - - x4 checkType { _>>() } - - { y: Int -> fun(): Int {return 1} } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.kt b/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.kt index 899fa130d4c..b8d2bea075f 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/anonymousFunAsLastExpressionInBlock.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE // !CHECK_TYPE fun foo(block: () -> (() -> Int)) {} @@ -39,5 +40,5 @@ fun test() { x4 checkType { _>>() } - { y: Int -> fun(): Int {return 1} } + { y: Int -> fun(): Int {return 1} } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.fir.kt deleted file mode 100644 index 065d6ac7c48..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 1 -} - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x, y) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.kt index 96b28fde3b1..680b28abdce 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/DoubleDeclForLoop.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { operator fun component1() = 1 operator fun component2() = 1 @@ -8,7 +9,7 @@ class C { } fun test() { - for ((x, y) in C()) { + for ((x, y) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/FolLoopTypeComponentTypeMismatch.kt index cc370383f35..c42675247ef 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/ForLoopComponentFunctionAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.fir.kt deleted file mode 100644 index fddfd72aaca..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component1() = 1 - operator fun component2() = 1 -} - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x, y) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.kt index 5d418ef3edd..b4c5b3fe393 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionAmbiguity.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { operator fun component1() = 1 operator fun component1() = 1 @@ -9,7 +10,7 @@ class C { } fun test() { - for ((x, y) in C()) { + for ((x, y) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.fir.kt deleted file mode 100644 index 95924e4c839..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - operator fun component1() = 1 -} - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x, y) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.kt index 083e33365a7..4c05300d011 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopComponentFunctionMissing.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { operator fun component1() = 1 } @@ -7,7 +8,7 @@ class C { } fun test() { - for ((x, y) in C()) { + for ((x, y) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt index 9b5dba7c613..ddeec533c23 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt @@ -1,13 +1,13 @@ // !WITH_NEW_INFERENCE fun useDeclaredVariables() { for ((a, b)) { - a - b + a + b } } fun checkersShouldRun() { - for ((@A a, _)) { + for ((@A a, _)) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.fir.kt deleted file mode 100644 index 30fca7424e3..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { -} -operator fun A.component1() = 1 -operator fun A.component2() = 1 - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x, y) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.kt index 3d40eb655de..1976afeddb2 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopWithExtensions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { } operator fun A.component1() = 1 @@ -8,7 +9,7 @@ class C { } fun test() { - for ((x, y) in C()) { + for ((x, y) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.fir.kt deleted file mode 100644 index 3e97d2fc5ff..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -class A { - operator fun component1() = 1 - operator fun component2() = 1.0 -} - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x: Int, y: Double) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.kt index be8c7dfa707..6f6ebdd5b6f 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForWithExplicitTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { operator fun component1() = 1 operator fun component2() = 1.0 @@ -8,7 +9,7 @@ class C { } fun test() { - for ((x: Int, y: Double) in C()) { + for ((x: Int, y: Double) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/RedeclarationInForLoop.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/RedeclarationInForLoop.kt index 315d51f0812..2d273316d4a 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/RedeclarationInForLoop.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/RedeclarationInForLoop.kt @@ -8,7 +8,7 @@ class C { } fun test() { - for ((x, x) in C()) { + for ((x, x) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.fir.kt deleted file mode 100644 index 660bec07ada..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -class A { - operator fun component1() = 1 -} - -class C { - operator fun iterator(): Iterator = null!! -} - -fun test() { - for ((x) in C()) { - - } -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.kt index 36f1248cb9e..24269ebf2f8 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { operator fun component1() = 1 } @@ -7,7 +8,7 @@ class C { } fun test() { - for ((x) in C()) { + for ((x) in C()) { } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt index c19fbf84ee8..fdccefac0a1 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt @@ -1,11 +1,11 @@ fun useDeclaredVariables() { val (a, b) = unresolved - a - b + a + b } fun checkersShouldRun() { - val (@A a, _) = unresolved + val (@A a, _) = unresolved } annotation class A diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt index 6de91aca333..000d605d584 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt @@ -1,11 +1,11 @@ fun useDeclaredVariables() { val (a, b) - a - b + a + b } fun checkersShouldRun() { - val (@A a, _) + val (@A a, _) } annotation class A diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt index 8725abe00de..420d72a8858 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt @@ -45,7 +45,7 @@ fun test() { foo(_, y) - val (unused, _) = A() + val (unused, _) = A() } -fun foo(x: Int, y: String) {} +fun foo(x: Int, y: String) {} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt1141.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt1141.fir.kt deleted file mode 100644 index af4f585547f..00000000000 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt1141.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -//KT-1141 No check that object in 'object expression' implements all abstract members of supertype - -package kt1141 - -public interface SomeTrait { - fun foo() -} - -fun foo() { - val x = object : SomeTrait { - } - x.foo() -} - -object Rr : SomeTrait {} - -class C : SomeTrait {} - -fun foo2() { - val r = object : Runnable {} //no error -} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt1141.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt1141.kt index 8ff4388f74e..675ec61f967 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt1141.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt1141.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-1141 No check that object in 'object expression' implements all abstract members of supertype package kt1141 @@ -17,5 +18,5 @@ fun foo() { class C : SomeTrait {} fun foo2() { - val r = object : Runnable {} //no error + val r = object : Runnable {} //no error } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt index dbd6261ea55..db0a87549c2 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt @@ -7,21 +7,21 @@ class C { } fun test1(c: C) { - val (a, b) = c + val (a, b) = c } fun test2(c: C) { - val (a, b) = c + val (a, b) = c a + 3 } fun test3(c: C) { - var (a, b) = c - a = 3 + var (a, b) = c + a = 3 } fun test4(c: C) { - var (a, b) = c + var (a, b) = c a = 3 a + 1 } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/localDeclarationModifiers.kt b/compiler/testData/diagnostics/tests/declarationChecks/localDeclarationModifiers.kt index 7cd5681ab25..af45dc6b115 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/localDeclarationModifiers.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/localDeclarationModifiers.kt @@ -5,8 +5,8 @@ class T { } fun foo() { - public val i = 11 - abstract val j + public val i = 11 + abstract val j override fun T.baz() = 2 private fun bar() = 2 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.kt b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.kt index baff5fa8bbd..8e5080bde90 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.kt @@ -44,7 +44,7 @@ fun test() { x4 checkType { _>() } - { y: Int -> fun named14(): Int {return 1} } + { y: Int -> fun named14(): Int {return 1} } val b = (fun named15(): Boolean { return true })() baz(fun named16(){}) diff --git a/compiler/testData/diagnostics/tests/declarationChecks/propertyInPackageHasNoInheritVisibility.kt b/compiler/testData/diagnostics/tests/declarationChecks/propertyInPackageHasNoInheritVisibility.kt index 9f37883789e..b086dbaaaa0 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/propertyInPackageHasNoInheritVisibility.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/propertyInPackageHasNoInheritVisibility.kt @@ -7,4 +7,4 @@ fun test() { } var g: Int = 1 - protected set(i: Int) {} \ No newline at end of file + protected set(i: Int) {} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt index ec70b1aa791..9b320bd7f82 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt @@ -3,5 +3,5 @@ import kotlin.reflect.KProperty0 val a: Int by A() class A { - fun getValue(t: Any?, p: KProperty0<*>): Int = 1 + fun getValue(t: Any?, p: KProperty0<*>): Int = 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt index a7b588e8532..7ece8e9274a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt @@ -16,7 +16,7 @@ class A(outer: Outer) { var f: String by foo(getMyProperty()) - 1 } -fun foo(a: Any?) = MyProperty() +fun foo(a: Any?) = MyProperty() fun getMyProperty() = MyProperty() @@ -35,7 +35,7 @@ class MyProperty { } operator fun MyProperty.unaryPlus() = MyProperty() -operator fun MyProperty.minus(i: Int) = MyProperty() +operator fun MyProperty.minus(i: Int) = MyProperty() object O { fun getMyProperty() = MyProperty() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt index 5d01b27f7c9..6fc1c5db6be 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt @@ -24,8 +24,8 @@ class MyProperty1 { // ----------------- class B { - var a5: String by MyProperty2() - var b5: String by getMyProperty2() + var a5: String by MyProperty2() + var b5: String by getMyProperty2() } fun getMyProperty2() = MyProperty2() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/setValue.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/setValue.kt index 414d14999a2..424554c9c73 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/setValue.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/setValue.kt @@ -11,7 +11,7 @@ operator fun String.provideDelegate(receiver: Any?, p: Any) = Delegate() var test1: String by Delegate() var test2: String by Delegate() -var test3: String by "OK" +var test3: String by "OK" var test4: String by "OK".provideDelegate(null, "") var test5: String by "OK".provideDelegate(null, "") diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt b/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt index 1868a537585..fa2cb73381f 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt @@ -5,7 +5,7 @@ interface T { val v : Int } -open class Br(t : T) : T { +open class Br(t : T) : T { } @@ -35,4 +35,4 @@ open class GC1(g : G) : G by g { open class GC2(g : G) : GC1(g) { -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt b/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt index f077deba150..b10c1052c0d 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationExpectedType.kt @@ -23,4 +23,4 @@ fun boo(t: T): A = AImpl() class E : A by boo("") -class F : A by AImpl() +class F : A by AImpl() diff --git a/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/delegationToSubTypeWithOverrideProperty.kt b/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/delegationToSubTypeWithOverrideProperty.kt index e246e0a18a6..a9a8bea5f54 100644 --- a/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/delegationToSubTypeWithOverrideProperty.kt +++ b/compiler/testData/diagnostics/tests/delegation/memberHidesSupertypeOverride/delegationToSubTypeWithOverrideProperty.kt @@ -1,14 +1,14 @@ public interface Base { var test: String get() = "OK" - set(s: String) { + set(s: String) { } } public interface Base2 : Base { override var test: String get() = "OK2" - set(value) {} + set(value) {} } class Delegate : Base2 { diff --git a/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt index 1d6225b7bc2..57058c267aa 100644 --- a/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt +++ b/compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt @@ -1,3 +1,3 @@ fun test() { - (d@ val bar = 2) -} \ No newline at end of file + (d@ val bar = 2) +} diff --git a/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.fir.kt b/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.fir.kt index 2937d8e871a..b622087a287 100644 --- a/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.fir.kt +++ b/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.fir.kt @@ -23,7 +23,7 @@ fun test(i: Int?) { foo(("")) foo(checkSubtype("")) foo(checkSubtype("")) - + use(a, b, c, d) } diff --git a/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt b/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt index e27eeeae382..1e27c20a5e9 100644 --- a/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt +++ b/compiler/testData/diagnostics/tests/deparenthesize/checkDeparenthesizedType.kt @@ -16,14 +16,14 @@ fun test(i: Int?) { val a: Int = l4@ "" val b: Int = ("") val c: Int = checkSubtype("") - val d: Int = checkSubtype("") + val d: Int = checkSubtype("") foo(l4@ "") foo(("")) foo(checkSubtype("")) foo(checkSubtype("")) - + use(a, b, c, d) } diff --git a/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt index 2ad875d30b7..c9f6cd54537 100644 --- a/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt @@ -13,8 +13,8 @@ fun first() { } fun useCompanion() { - val d = Another - val x = Another.Companion + val d = Another + val x = Another.Companion Another.Companion.use() Another.use() } diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedPropertyInheritance.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedPropertyInheritance.kt index b65caffbbe5..c84e382ac12 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedPropertyInheritance.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedPropertyInheritance.kt @@ -33,48 +33,48 @@ open class SetterDeprecated { class WD: WarningDeprecated() { override var p: Int get() = 3 - set(value) {} + set(value) {} } class ED: ErrorDeprecated() { override var p: Int get() = 3 - set(value) { + set(value) { } } class GD: GetterDeprecated() { override var p: Int get() = 3 - set(value) { + set(value) { } } class SD: SetterDeprecated() { override var p: Int get() = 3 - set(value) { + set(value) { } } class SDH: SetterDeprecated(), HiddenDeprecated { override var p: Int get() = 3 - set(value) { + set(value) { } } class EDH: ErrorDeprecated(), HiddenDeprecated { override var p: Int get() = 3 - set(value) { + set(value) { } } class NED: ErrorDeprecated(), NoDeprecation { override var p: Int get() = 3 - set(value) { + set(value) { } } @@ -82,7 +82,7 @@ class Diff { @Deprecated("", level = DeprecationLevel.WARNING) var p: Int @Deprecated("", level = DeprecationLevel.ERROR) get() = 3 - @Deprecated("", level = DeprecationLevel.HIDDEN) set(value) { + @Deprecated("", level = DeprecationLevel.HIDDEN) set(value) { } } @@ -132,4 +132,4 @@ fun use( diff.p diff.p = 1 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/deprecated/hiddenPropertyAccessors.kt b/compiler/testData/diagnostics/tests/deprecated/hiddenPropertyAccessors.kt index 903e5d330ae..a47332edf1c 100644 --- a/compiler/testData/diagnostics/tests/deprecated/hiddenPropertyAccessors.kt +++ b/compiler/testData/diagnostics/tests/deprecated/hiddenPropertyAccessors.kt @@ -8,23 +8,23 @@ val v2 = "" var v3: String @Deprecated("", level = DeprecationLevel.HIDDEN) get() = "" - set(value) {} + set(value) {} var v4: String get() = "" @Deprecated("", level = DeprecationLevel.HIDDEN) - set(value) {} + set(value) {} var v5: String @Deprecated("", level = DeprecationLevel.HIDDEN) get() = "" @Deprecated("", level = DeprecationLevel.HIDDEN) - set(value) {} + set(value) {} @Deprecated("", level = DeprecationLevel.HIDDEN) var v6: String get() = "" - set(value) {} + set(value) {} fun test() { v1 diff --git a/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt b/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt index 775fc3c01f6..d3b9c5612f6 100644 --- a/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/nestedTypesUsage.kt @@ -12,7 +12,7 @@ class TopLevel { } fun useNested() { - val d = TopLevel.Nested.use() + val d = TopLevel.Nested.use() TopLevel.Nested.Nested2() TopLevel.Nested.CompanionNested2() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt index 108f1f56c9f..1a9d59c6b3f 100644 --- a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt @@ -5,5 +5,5 @@ object Obsolete { fun useObject() { Obsolete.use() - val x = Obsolete + val x = Obsolete } diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt index b2eaf47dcb3..ae9233a2f37 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt @@ -52,11 +52,11 @@ fun fn() { PropertyHolder().test4 PropertyHolder().test4 = "" - val a = PropertyHolder().x - val b = PropertyHolder().name + val a = PropertyHolder().x + val b = PropertyHolder().name PropertyHolder().name = "value" - val d = PropertyHolder().valDelegate + val d = PropertyHolder().valDelegate PropertyHolder().varDelegate = 1 } diff --git a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt index 23f313932f4..d8bd041ade2 100644 --- a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt @@ -24,7 +24,7 @@ class Properties { var n : Obsolete get() = Obsolete() - set(value) {} + set(value) {} } fun param(param: Obsolete) { param.use() } diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt index a6bc8ff3831..2b639869044 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt @@ -58,11 +58,10 @@ class Outer { } fun outerFun() { - fun () { + fun () { - } - fun () { + } + fun () { - } + } } - diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/vararg.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/vararg.kt index 878fc256fa9..1acdc531a68 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/vararg.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/vararg.kt @@ -1,8 +1,8 @@ -fun foo(vararg x: Int) {} -fun foo(x: IntArray) {} +fun foo(vararg x: Int) {} +fun foo(x: IntArray) {} -fun foo(vararg x: Int?) {} -fun foo(x: Array) {} +fun foo(vararg x: Int?) {} +fun foo(x: Array) {} -fun foo(vararg nn: Number) {} -fun foo(nn: Array) {} +fun foo(vararg nn: Number) {} +fun foo(nn: Array) {} diff --git a/compiler/testData/diagnostics/tests/enum/AbstractInEnum.kt b/compiler/testData/diagnostics/tests/enum/AbstractInEnum.kt index 8f485c5e278..c4b52f3c437 100644 --- a/compiler/testData/diagnostics/tests/enum/AbstractInEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/AbstractInEnum.kt @@ -43,5 +43,5 @@ enum class MyEnum() { var l: Int abstract get abstract set var l1: Int = 0; abstract get abstract set - var n: Int abstract get abstract set(v: Int) {} -} \ No newline at end of file + var n: Int abstract get abstract set(v: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt index ad23ed115be..275ee96b3ed 100644 --- a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt +++ b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt @@ -5,5 +5,5 @@ enum class E { fun foo() { var e = E.E1 - e = E.E2 -} \ No newline at end of file + e = E.E2 +} diff --git a/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.fir.kt b/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.fir.kt deleted file mode 100644 index 67de39f40e7..00000000000 --- a/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FILE: A.java -public enum A { - ENTRY, - ANOTHER; - - public String ENTRY = ""; -} - -// FILE: test.kt - -fun main() { - val c: A = A.ENTRY - val c2: String? = c.ENTRY - val c3: String? = A.ANOTHER.ENTRY -} diff --git a/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.kt b/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.kt index 6ed6d35855d..8dba037afd6 100644 --- a/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.kt +++ b/compiler/testData/diagnostics/tests/enum/javaEnumWithNameClashing.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java public enum A { ENTRY, @@ -10,6 +11,6 @@ public enum A { fun main() { val c: A = A.ENTRY - val c2: String? = c.ENTRY - val c3: String? = A.ANOTHER.ENTRY + val c2: String? = c.ENTRY + val c3: String? = A.ANOTHER.ENTRY } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index a50ae0c9328..daedeee3e63 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -5,7 +5,7 @@ package outer fun Int?.optint() : Unit {} val Int?.optval : Unit get() = Unit -fun T.foo(x : E, y : A) : T { +fun T.foo(x : E, y : A) : T { y.plus(1) y plus 1 y + 1.0 @@ -17,22 +17,22 @@ fun T.foo(x : E, y : A) : T { class A -infix operator fun A.plus(a : Any) { +infix operator fun A.plus(a : Any) { 1.foo() true.foo() - 1 + 1 } -operator fun A.plus(a : Int) { - 1 +operator fun A.plus(a : Int) { + 1 } -operator fun T.minus(t : T) : Int = 1 +operator fun T.minus(t : T) : Int = 1 fun test() { - val y = 1.abs + val y = 1.abs } val Int.abs : Int get() = if (this > 0) this else -this; @@ -46,15 +46,15 @@ package null_safety import outer.* - fun parse(cmd: String): Command? { return null } + fun parse(cmd: String): Command? { return null } class Command() { // fun equals(other : Any?) : Boolean val foo : Int = 0 } - fun Any.equals(other : Any?) : Boolean = true - fun Any?.equals1(other : Any?) : Boolean = true - fun Any.equals2(other : Any?) : Boolean = true + fun Any.equals(other : Any?) : Boolean = true + fun Any?.equals1(other : Any?) : Boolean = true + fun Any.equals2(other : Any?) : Boolean = true fun main() { @@ -72,5 +72,5 @@ import outer.* val c = Command() c?.equals2(null) - if (command == null) 1 + if (command == null) 1 } diff --git a/compiler/testData/diagnostics/tests/extensions/kt3563.kt b/compiler/testData/diagnostics/tests/extensions/kt3563.kt index ff7ec890495..45f9b6b8af8 100644 --- a/compiler/testData/diagnostics/tests/extensions/kt3563.kt +++ b/compiler/testData/diagnostics/tests/extensions/kt3563.kt @@ -5,7 +5,7 @@ package bar import java.io.File -class Customer(name1: String) +class Customer(name1: String) fun foo(f: File, c: Customer) { f.name1 @@ -14,4 +14,4 @@ fun foo(f: File, c: Customer) { } val File.name1: String - get() = getName() \ No newline at end of file + get() = getName() diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt index ed920c74b81..ccd38c0d785 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt @@ -4,12 +4,12 @@ package a class A {} fun test(a1: A, a2: A) { - val range = "island".."isle" + val range = "island".."isle" a1..a2 } -public operator fun > T.rangeTo(that: T): ClosedRange { +public operator fun > T.rangeTo(that: T): ClosedRange { throw UnsupportedOperationException() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt b/compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt index 1f455ea24d1..d2f8ac2f1be 100644 --- a/compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt +++ b/compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt @@ -3,10 +3,10 @@ typealias FunAlias = IsolatedFunFace -fun referIsolatedFunFace(iff: IsolatedFunFace) {} +fun referIsolatedFunFace(iff: IsolatedFunFace) {} fun callIsolatedFunFace() { referIsolatedFunFace(IsolatedFunFace {}) referIsolatedFunFace(FunAlias {}) referIsolatedFunFace({}) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt b/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt index 5b37017cfc2..075c00c052f 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/MissingParameterTypes.kt @@ -19,9 +19,9 @@ fun test1(a: (Int) -> Unit) { } fun test2(a: (Int) -> Unit) { - test2(fun (x: String) {}) + test2(fun (x: String) {}) } fun test3(a: (Int, String) -> Unit) { - test3(fun (x: String) {}) + test3(fun (x: String) {}) } diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/ReceiverByExpectedType.kt b/compiler/testData/diagnostics/tests/functionAsExpression/ReceiverByExpectedType.kt index d5123b957fa..7400932c1bb 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/ReceiverByExpectedType.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/ReceiverByExpectedType.kt @@ -1,3 +1,3 @@ // !WITH_NEW_INFERENCE -fun foo(f: String.() -> Int) {} -val test = foo(fun () = length) +fun foo(f: String.() -> Int) {} +val test = foo(fun () = length) diff --git a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt index 39b118e1314..83db001f4fb 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/DeprecatedSyntax.kt @@ -6,20 +6,20 @@ val receiverAndReturnType = { Int.(): Int -> 5 } val receiverAndReturnTypeWithParameter = { Int.(a: Int): Int -> 5 } val returnType = { (): Int -> 5 } -val returnTypeWithParameter = { (b: Int): Int -> 5 } +val returnTypeWithParameter = { (b: Int): Int -> 5 } val receiverWithFunctionType = { ((Int) -> Int).() -> } -val parenthesizedParameters = { (a: Int) -> } -val parenthesizedParameters2 = { (b) -> } +val parenthesizedParameters = { (a: Int) -> } +val parenthesizedParameters2 = { (b) -> } val none = { -> } val parameterWithFunctionType = { a: ((Int) -> Int) -> } // todo fix parser -val newSyntax = { a: Int -> } -val newSyntax1 = { a, b -> } -val newSyntax2 = { a: Int, b: Int -> } -val newSyntax3 = { a, b: Int -> } -val newSyntax4 = { a: Int, b -> } +val newSyntax = { a: Int -> } +val newSyntax1 = { a, b -> } +val newSyntax2 = { a: Int, b: Int -> } +val newSyntax3 = { a, b: Int -> } +val newSyntax4 = { a: Int, b -> } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParameterTypeMismatchVariance.kt b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParameterTypeMismatchVariance.kt index 89294444aab..256b22d7c7d 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParameterTypeMismatchVariance.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParameterTypeMismatchVariance.kt @@ -16,6 +16,6 @@ fun test(s: Sub) { t: Trait -> s } - foo(fun(t: Sub) = s) + foo(fun(t: Sub) = s) foo(fun(t): Super = s) } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt index d86531c5941..15723a1b453 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/ExpectedParametersTypesMismatch.kt @@ -10,36 +10,36 @@ fun test1() { "" } foo0 { - s: String-> "" + s: String-> "" } foo0 { - x, y -> "" + x, y -> "" } foo1 { "" } foo1 { - s: String -> "" + s: String -> "" } foo1 { - x, y -> "" + x, y -> "" } foo1 { - -> 42 + -> 42 } - foo2 { + foo2 { "" } foo2 { - s: String -> "" + s: String -> "" } foo2 { - x -> "" + x -> "" } foo2 { - -> 42 + -> 42 } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt index 2d2440d2ffa..4ebaa121fed 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt @@ -6,8 +6,8 @@ interface A interface B interface C: A, B -fun foo(a: A, f: () -> T): T = f() -fun foo(b: B, f: () -> T): T = f() +fun foo(a: A, f: () -> T): T = f() +fun foo(b: B, f: () -> T): T = f() fun test(c: C) { foo(c) f@ { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.kt b/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.kt index b1fb7adeecf..af0f5107fb5 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/assignmentOperationInLambdaWithExpectedType.kt @@ -2,15 +2,15 @@ fun test(bal: Array) { var bar = 4 - val a: () -> Unit = { bar += 4 } + val a: () -> Unit = { bar += 4 } - val b: () -> Int = { bar = 4 } + val b: () -> Int = { bar = 4 } - val c: () -> UNRESOLVED = { bal[2] = 3 } + val c: () -> UNRESOLVED = { bal[2] = 3 } - val d: () -> Int = { bar += 4 } + val d: () -> Int = { bar += 4 } - val e: Unit = run { bar += 4 } + val e: Unit = run { bar += 4 } - val f: Int = run { bar += 4 } + val f: Int = run { bar += 4 } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.kt index b6936a6d809..45cd30a41b2 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.kt @@ -7,12 +7,12 @@ data class B(val u: Double, val w: Short) fun foo(block: (A, B) -> Unit) { } fun bar() { - foo { (a, a), b -> + foo { (a, a), b -> a checkType { _() } b checkType { _() } } - foo { (a, b), a -> + foo { (a, b), a -> a checkType { _() } b checkType { _() } } @@ -22,7 +22,7 @@ fun bar() { b checkType { _() } } - foo { (a, b), (c, b) -> + foo { (a, b), (c, b) -> a checkType { _() } b checkType { _() } c checkType { _() } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt index a786272443d..862932686bf 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt @@ -47,7 +47,7 @@ fun bar() { _ checkType { _() } } - foo { (`_`, `_`) -> + foo { (`_`, `_`) -> _ checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.kt index 62581e87574..c307b2c5706 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.kt @@ -7,36 +7,36 @@ fun foo(block: (A) -> Unit) { } fun foobar(block: (A, B) -> Unit) { } fun bar() { - foo { (a, b) -> + foo { (a, b) -> a checkType { _() } } - foo { (a, b) -> + foo { (a, b) -> b checkType { _() } } - foo { (a: Int, b: String) -> + foo { (a: Int, b: String) -> a checkType { _() } } - foo { (a: Int, b: String) -> + foo { (a: Int, b: String) -> b checkType { _() } } - foobar { (a, b), c -> + foobar { (a, b), c -> a checkType { _() } } - foobar { a, (b, c) -> + foobar { a, (b, c) -> c checkType { _() } } - foobar { (a, b), (c, d) -> + foobar { (a, b), (c, d) -> a checkType { _() } d checkType { _() } } - foobar { (a, b), (c, d) -> + foobar { (a, b), (c, d) -> b checkType { _() } c checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.fir.kt deleted file mode 100644 index 2becbe62950..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -class Log - -data class CalculatedVariable( - val idString: String, - val presentableName: String, - val units: String, - val function: (Log) -> ((TimeIndex) -> Any?)?, - val converter: (Any) -> Double -) { - constructor(idString: String, presentableName: String, units: String, function: (Log) -> ((TimeIndex) -> Double?)?) - : this(idString, presentableName, units, function, { it as Double }) -} - -object CalculatedVariables { - val x = CalculatedVariable( - "A", - "B", - "C", - fun(log: Log): ((TimeIndex) -> Double?)? { - return { 0.0 } - } - ) -} - -class TimeIndex \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.kt b/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.kt index f9c35bd04d1..c6dcbbc1c6e 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/functionLiteralAsArgumentForFunction.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class Log data class CalculatedVariable( @@ -16,10 +17,10 @@ object CalculatedVariables { "A", "B", "C", - fun(log: Log): ((TimeIndex) -> Double?)? { + fun(log: Log): ((TimeIndex) -> Double?)? { return { 0.0 } } ) } -class TimeIndex \ No newline at end of file +class TimeIndex diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt11733.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt11733.fir.kt deleted file mode 100644 index 12b0dc6b6b4..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt11733.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !CHECK_TYPE - -interface Predicate - -fun Predicate(x: (T?) -> Boolean): Predicate = null!! - -fun foo() { - process(Predicate { - x -> x checkType { _() } - - true - }) -} - -fun process(x: Predicate) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt11733.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt11733.kt index 53a4742dbe5..c94a6ca2b42 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt11733.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt11733.kt @@ -1,8 +1,9 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface Predicate -fun Predicate(x: (T?) -> Boolean): Predicate = null!! +fun Predicate(x: (T?) -> Boolean): Predicate = null!! fun foo() { process(Predicate { @@ -12,4 +13,4 @@ fun foo() { }) } -fun process(x: Predicate) {} \ No newline at end of file +fun process(x: Predicate) {} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.fir.kt deleted file mode 100644 index 76a64dd2123..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// !CHECK_TYPE - -// FILE: Predicate.java -import org.jetbrains.annotations.NotNull; - -public interface Predicate { - // Same effect with @Nullable here - boolean invoke(@NotNull T t); -} -// FILE: Main.kt -fun process(x: Predicate) {} -fun main() { - process(Predicate { x -> x checkType { _() } - true - }) -} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.kt index 2bd119d8607..c5e89a98efa 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: Predicate.java @@ -8,7 +9,7 @@ public interface Predicate { boolean invoke(@NotNull T t); } // FILE: Main.kt -fun process(x: Predicate) {} +fun process(x: Predicate) {} fun main() { process(Predicate { x -> x checkType { _() } true diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt16016.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt16016.kt index 5dca17550b6..4971280e127 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt16016.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt16016.kt @@ -1,6 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -val la = { a -> } -val las = { a: Int -> } +val la = { a -> } +val las = { a: Int -> } -val larg = { a -> }(123) -val twoarg = { a, b: String, c -> }(123, "asdf", 123) \ No newline at end of file +val larg = { a -> }(123) +val twoarg = { a, b: String, c -> }(123, "asdf", 123) diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt3343.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt3343.fir.kt deleted file mode 100644 index 8ed60159149..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt3343.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// KT-3343 Type mismatch when function literal consists of try-catch with Int returning call, and Unit is expected - -fun main() { - "hello world".prt{ - try{ - print(it) - log("we are printing") - } - catch(e : Exception){ - log("Exception") - } - } -} - -fun log(str : String) : Int{ - print("logging $str") - return 0 -} - -fun print(obj: Any) {} - - -fun String.prt(action : (String) -> Unit){ - action(this) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt3343.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt3343.kt index 66937144aab..264d6c5e094 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt3343.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt3343.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-3343 Type mismatch when function literal consists of try-catch with Int returning call, and Unit is expected fun main() { @@ -17,9 +18,9 @@ fun log(str : String) : Int{ return 0 } -fun print(obj: Any) {} +fun print(obj: Any) {} fun String.prt(action : (String) -> Unit){ action(this) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt6869.fir.kt deleted file mode 100644 index 3e504a8e29c..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun main() { - var list = listOf(1) - - val a: Int? = 2 - - a?.let { list += it } -} - -operator fun Iterable.plus(element: T): List = null!! -fun listOf(vararg values: T): List = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt index 06a30527764..9b6fbd19220 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun main() { var list = listOf(1) @@ -6,5 +7,5 @@ fun main() { a?.let { list += it } } -operator fun Iterable.plus(element: T): List = null!! -fun listOf(vararg values: T): List = null!! \ No newline at end of file +operator fun Iterable.plus(element: T): List = null!! +fun listOf(vararg values: T): List = null!! diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabels.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabels.kt index 000b6e20083..382f5b62891 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabels.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabels.kt @@ -18,5 +18,4 @@ fun f() { } } -fun foo(a: Any) {} - +fun foo(a: Any) {} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt index 9bbc015cc52..10c61dc4e87 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt @@ -7,5 +7,5 @@ fun f() { } } -fun foo(a: Any) {} -fun bar(a: Any) {} \ No newline at end of file +fun foo(a: Any) {} +fun bar(a: Any) {} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElse.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElse.kt index 79750663a38..5b4d03537b5 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElse.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElse.kt @@ -11,5 +11,5 @@ val b/*: () -> Int */ = l@ { } val c/*: () -> Unit */ = l@ { - if (flag) 4 -} \ No newline at end of file + if (flag) 4 +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElseWithExplicitType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElseWithExplicitType.kt index a300099a0c0..360aae39999 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElseWithExplicitType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/IfWithoutElseWithExplicitType.kt @@ -18,5 +18,5 @@ val d: () -> Int = l@ { } val e: () -> Int = l@ { - if (flag) 4 -} \ No newline at end of file + if (flag) 4 +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt index 66e060c468e..e9e8cec06aa 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt @@ -10,7 +10,7 @@ val a = run { // () -> Unit // Unit val b = run { if (flag) return@run - 5 + 5 } // Unit @@ -18,4 +18,4 @@ val c = run { if (flag) return@run return@run 4 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.fir.kt deleted file mode 100644 index ca7f7434a65..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! - -val flag = true - -val a: () -> List = l@ { - if (flag) return@l listOf() - listOf(5) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt index 9d84af7b318..a9cc3f577bf 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! +fun listOf(vararg values: T): List = null!! val flag = true val a: () -> List = l@ { if (flag) return@l listOf() listOf(5) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt index dd114afd6b4..b5d5d185409 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt @@ -1,10 +1,10 @@ // !WITH_NEW_INFERENCE fun test(a: Int) { runf@{ - if (a > 0) return@f "" + if (a > 0) return@f "" return@f 1 } - run{ "" } + run{ "" } run{ 1 } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt index a415838ef30..9a4a49e8bb7 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt @@ -1,7 +1,7 @@ // !WITH_NEW_INFERENCE -fun Iterable.map(transform: (T) -> R): List = null!! +fun Iterable.map(transform: (T) -> R): List = null!! fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! +fun listOf(vararg values: T): List = null!! fun commonSystemFailed(a: List) { a.map { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.fir.kt index 428aa4895de..f0b428ce65b 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.fir.kt @@ -1,6 +1,6 @@ // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -// KT-6822 Smart cast doesn't work inside local returned expression in lambda +// KT-6822 Smart cast doesn't work inside local returned expression in lambda val a /* :(Int?) -> Int? */ = l@ { it: Int? -> // but must be (Int?) -> Int if (it != null) return@l it diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.kt index 3b988552a87..5b87f4a6639 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCast.kt @@ -1,13 +1,13 @@ // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -// KT-6822 Smart cast doesn't work inside local returned expression in lambda +// KT-6822 Smart cast doesn't work inside local returned expression in lambda val a /* :(Int?) -> Int? */ = l@ { it: Int? -> // but must be (Int?) -> Int if (it != null) return@l it 5 } -fun let(f: (Int?) -> R): R = null!! +fun let(f: (Int?) -> R): R = null!! val b /*: Int? */ = let { // but must be Int if (it != null) return@let it diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCastWithExplicitType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCastWithExplicitType.kt index c11fe4c9891..f8935ea4518 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCastWithExplicitType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/SmartCastWithExplicitType.kt @@ -5,7 +5,7 @@ val a : (Int?) -> Int = l@ { 5 } -fun let(f: (Int?) -> R): R = null!! +fun let(f: (Int?) -> R): R = null!! val b: Int = let { if (it != null) return@let it diff --git a/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt index 036724b737c..1caf01028c9 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt @@ -1,7 +1,7 @@ // !CHECK_TYPE -fun foo(block: (Int, String) -> Unit) { } -fun foobar(block: (Double) -> Unit) { } +fun foo(block: (Int, String) -> Unit) { } +fun foobar(block: (Double) -> Unit) { } fun bar() { foo { _, b -> @@ -40,9 +40,9 @@ fun bar() { _ checkType { _() } } - foo { `_`, `_` -> + foo { `_`, `_` -> _ checkType { _() } } - foo(fun(x: Int, _: String) {}) + foo(fun(x: Int, _: String) {}) } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt index 1cc8477b6fd..b4ae7290024 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.fir.kt @@ -1,3 +1,5 @@ +// !DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION, +UNUSED_VARIABLE + fun unusedLiteral(){ { -> val i = 1 @@ -9,4 +11,4 @@ fun unusedLiteralInDoWhile(){ do{ -> val i = 1 } while(false) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt index 95d2636da95..ff593d7a335 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION, +UNUSED_VARIABLE +// !DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION, +UNUSED_VARIABLE fun unusedLiteral(){ { -> diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt index 61f6aa580ee..b104b38f177 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.fir.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION +// !DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION fun main() { "".run { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt index f3c152843ec..99b81e80656 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt @@ -1,4 +1,4 @@ -// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION +// !DIAGNOSTICS: +UNUSED_LAMBDA_EXPRESSION fun main() { "".run { diff --git a/compiler/testData/diagnostics/tests/generics/Projections.kt b/compiler/testData/diagnostics/tests/generics/Projections.kt index 820d719ae62..fbcfe3ec6bc 100644 --- a/compiler/testData/diagnostics/tests/generics/Projections.kt +++ b/compiler/testData/diagnostics/tests/generics/Projections.kt @@ -2,9 +2,9 @@ // !CHECK_TYPE class In() { - fun f(t : T) : Unit {} - fun f(t : Int) : Int = 1 - fun f1(t : T) : Unit {} + fun f(t : T) : Unit {} + fun f(t : Int) : Int = 1 + fun f1(t : T) : Unit {} } class Out() { @@ -14,7 +14,7 @@ class Out() { class Inv() { fun f(t : T) : T = t - fun inf(t : T) : Unit {} + fun inf(t : T) : Unit {} fun outf() : T {throw IllegalStateException()} } diff --git a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.kt b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.kt index e62b26b7934..70fa7717961 100644 --- a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.kt +++ b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.kt @@ -1,4 +1,4 @@ -public fun foo(a: Any, b: Map) { +public fun foo(a: Any, b: Map) { when (a) { is Map -> {} is Map -> {} @@ -10,4 +10,4 @@ public fun foo(a: Any, b: {} else -> {} } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/generics/genericsInType.kt b/compiler/testData/diagnostics/tests/generics/genericsInType.kt index 6b619b9fe4d..bc6a9fa8688 100644 --- a/compiler/testData/diagnostics/tests/generics/genericsInType.kt +++ b/compiler/testData/diagnostics/tests/generics/genericsInType.kt @@ -32,5 +32,5 @@ fun test() { fun Bar>> x() {} fun Foo.Bar.ext() {} -fun ex1(a: Foo.Bar): Foo.Bar { -} \ No newline at end of file +fun ex1(a: Foo.Bar): Foo.Bar { +} diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt index b47238bcf09..0e1bdb17869 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt @@ -45,7 +45,7 @@ fun test() { x().foo().a() checkType { _>() } x().bar() checkType { _>() } - x = foobar() + x = foobar() var y = noParameters() y = noParameters() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt index 0dde5e49efa..41446fbcbad 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt @@ -46,7 +46,7 @@ class Outer { x().foo().a() checkType { _>() } x().bar() checkType { _>() } - x = foobar() + x = foobar() x = z.foobar() var y = noParameters() diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt index 96d0f0e7574..97c468ee2ea 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt @@ -32,7 +32,7 @@ fun main() { checkSubtype.Inner<*>>(outer.Inner()) checkSubtype.Inner>(outer.bar()) - checkSubtype.Inner>(outer.Inner()) + checkSubtype.Inner>(outer.Inner()) outer.set(outer.bar()) outer.set(outer.Inner()) diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt index 2fc1b3659f2..55b57fdfd0c 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/typeMismatchInLambda.kt @@ -14,14 +14,14 @@ class A { fun test(a: A, z: Out) { a.foo { val x: String = 1 // Should be no TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS - "" + "" } - a.bar { 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 "") - "" + z.foobar(if (1 > 2) return@foo "" else "") + "" } } diff --git a/compiler/testData/diagnostics/tests/generics/tpAsReified/InConstructor.kt b/compiler/testData/diagnostics/tests/generics/tpAsReified/InConstructor.kt index 75fc67d093b..c8c5d88f04f 100644 --- a/compiler/testData/diagnostics/tests/generics/tpAsReified/InConstructor.kt +++ b/compiler/testData/diagnostics/tests/generics/tpAsReified/InConstructor.kt @@ -6,10 +6,10 @@ fun id(p: T): T = p fun main() { C() - val a: C = C() + val a: C = C() C<A>() - val b: C = C() + val b: C = C() C() // TODO svtk, uncomment when extensions are called for nested calls! diff --git a/compiler/testData/diagnostics/tests/generics/tpAsReified/InFunction.kt b/compiler/testData/diagnostics/tests/generics/tpAsReified/InFunction.kt index 624c7012a32..5fa0d3563d6 100644 --- a/compiler/testData/diagnostics/tests/generics/tpAsReified/InFunction.kt +++ b/compiler/testData/diagnostics/tests/generics/tpAsReified/InFunction.kt @@ -12,11 +12,11 @@ fun id(p: T): T = p fun main() { f() - val a: A = f() + val a: A = f() f<A>() - val b: Int = f() + val b: Int = f() f() - val с: A = id(f()) + val с: A = id(f()) } diff --git a/compiler/testData/diagnostics/tests/generics/tpAsReified/InType.kt b/compiler/testData/diagnostics/tests/generics/tpAsReified/InType.kt index 9fc73d5ca1d..b6e2755b8da 100644 --- a/compiler/testData/diagnostics/tests/generics/tpAsReified/InType.kt +++ b/compiler/testData/diagnostics/tests/generics/tpAsReified/InType.kt @@ -1,4 +1,4 @@ class C<reified T> -fun main(p1: C, p2: C) { -} \ No newline at end of file +fun main(p1: C, p2: C) { +} diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.fir.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.fir.kt deleted file mode 100644 index 612031454d1..00000000000 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNREACHABLE_CODE -interface Tr { - var v: T -} - -class C { - operator fun plusAssign(c: C) {} -} - -fun test(t: Tr) { - // No error because no real assignment happens - t.v += null!! -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.kt index 74acaec0119..9f0da204bca 100644 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.kt +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutPlusAssignDefined.kt @@ -1,13 +1,14 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE interface Tr { var v: T } class C { - operator fun plusAssign(c: C) {} + operator fun plusAssign(c: C) {} } fun test(t: Tr) { // No error because no real assignment happens t.v += null!! -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/implicitNothing.fir.kt b/compiler/testData/diagnostics/tests/implicitNothing.fir.kt index 782f4576e60..c11e3e59082 100644 --- a/compiler/testData/diagnostics/tests/implicitNothing.fir.kt +++ b/compiler/testData/diagnostics/tests/implicitNothing.fir.kt @@ -45,8 +45,8 @@ interface Base { class Derived : Base { // Ok for override - + override val x = null!! override fun foo() = null!! -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/implicitNothing.kt b/compiler/testData/diagnostics/tests/implicitNothing.kt index 40a2f07d3b9..adb0a7cc7f4 100644 --- a/compiler/testData/diagnostics/tests/implicitNothing.kt +++ b/compiler/testData/diagnostics/tests/implicitNothing.kt @@ -14,7 +14,7 @@ fun check() { // Error: KT-10449 fun local() = bar() // Unreachable / unused, but not implicit Nothing - val x = null!! + val x = null!! } fun nonLocalReturn() = run { return } @@ -33,7 +33,7 @@ class Klass { fun foo() { fun local() = bar() - val x = y + val x = y } } @@ -45,8 +45,8 @@ interface Base { class Derived : Base { // Ok for override - + override val x = null!! override fun foo() = null!! -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.fir.kt b/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.fir.kt deleted file mode 100644 index 6c9eb99bb8f..00000000000 --- a/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: a.kt -package a - -fun X(p: Int) {} - -// FILE: b.kt -package b - -fun X(): Int = 1 - -// FILE: c.kt -package c - -import b.* -import a.X - -fun foo() { - val v: Int = X() -} diff --git a/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.kt b/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.kt index bd1386f665b..2597ff97326 100644 --- a/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.kt +++ b/compiler/testData/diagnostics/tests/imports/AllUnderImportsSamePriorityForFunction.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL // FILE: a.kt package a -fun X(p: Int) {} +fun X(p: Int) {} // FILE: b.kt package b @@ -15,5 +16,5 @@ import b.* import a.X fun foo() { - val v: Int = X() + val v: Int = X() } diff --git a/compiler/testData/diagnostics/tests/imports/DefaultImportsPriority.kt b/compiler/testData/diagnostics/tests/imports/DefaultImportsPriority.kt index 29a2c010174..6a93d38c601 100644 --- a/compiler/testData/diagnostics/tests/imports/DefaultImportsPriority.kt +++ b/compiler/testData/diagnostics/tests/imports/DefaultImportsPriority.kt @@ -2,5 +2,5 @@ import java.lang.reflect.* import java.util.List fun foo( - p1: Array /* should be resolved to kotlin.Array */, - p2: List /* should be resolved to java.util.List */) { } \ No newline at end of file + p1: Array /* should be resolved to kotlin.Array */, + p2: List /* should be resolved to java.util.List */) { } diff --git a/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.fir.kt b/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.fir.kt deleted file mode 100644 index 35903947784..00000000000 --- a/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: a.kt -package a - -fun X(p: Int) {} - -// FILE: b.kt -package b - -fun X(): Int = 1 - -// FILE: c.kt -package c - -import b.X -import a.X - -fun foo() { - val v: Int = X() -} diff --git a/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.kt b/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.kt index e7a5ea76530..bf68d2f6cd4 100644 --- a/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.kt +++ b/compiler/testData/diagnostics/tests/imports/ExplicitImportsUnambiguityForFunction.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL // FILE: a.kt package a -fun X(p: Int) {} +fun X(p: Int) {} // FILE: b.kt package b @@ -15,5 +16,5 @@ import b.X import a.X fun foo() { - val v: Int = X() + val v: Int = X() } diff --git a/compiler/testData/diagnostics/tests/imports/ImportFromCompanionObject.kt b/compiler/testData/diagnostics/tests/imports/ImportFromCompanionObject.kt index 931aeab36e4..ac71ede68c5 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportFromCompanionObject.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportFromCompanionObject.kt @@ -16,20 +16,20 @@ class C2 { val prop: String = "" - fun o(s: String) = Unit - fun o(i: Int) = Unit + fun o(s: String) = Unit + fun o(i: Int) = Unit fun Int.ext() = Unit var String.ext: Int get() = 3 - set(i) { + set(i) { } - fun A(c: Int) = A() + fun A(c: Int) = A() class A() - fun genericFun(t: T, t2: T): T = t + fun genericFun(t: T, t2: T): T = t } } @@ -37,7 +37,7 @@ open class Base { fun f() { } - fun g(t: T) { + fun g(t: T) { } val p = 1 @@ -84,18 +84,18 @@ fun testImportFromObjectByName() { o(3) 3.ext() "".ext = 3 - val c: Int = "".ext + val c: Int = "".ext 3.extRenamed() "".extRenamed = 3 - val c2: Int = "".extRenamed + val c2: Int = "".extRenamed A() A(3) - val a: Int = genericFun(3, 3) - val s: String = genericFun("A", "b") - val b: Boolean = genericFun(true, false) + val a: Int = genericFun(3, 3) + val s: String = genericFun("A", "b") + val b: Boolean = genericFun(true, false) } fun t(t: T): T { @@ -135,4 +135,4 @@ fun testMembersFromSupertypes() { genericFromI("a") own -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/imports/ImportFromObject.kt b/compiler/testData/diagnostics/tests/imports/ImportFromObject.kt index 6ef2930ce1f..7894e6daeac 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportFromObject.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportFromObject.kt @@ -13,27 +13,27 @@ object S { val prop: String = "" - fun o(s: String) = Unit - fun o(i: Int) = Unit + fun o(s: String) = Unit + fun o(i: Int) = Unit fun Int.ext() = Unit var String.ext: Int get() = 3 - set(i) { + set(i) { } - fun A(c: Int) = A() + fun A(c: Int) = A() class A() - fun genericFun(t: T, t2: T): T = t + fun genericFun(t: T, t2: T): T = t } open class Base { fun f() { } - fun g(t: T) { + fun g(t: T) { } val p = 1 @@ -78,18 +78,18 @@ fun testImportFromObjectByName() { o(3) 3.ext() "".ext = 3 - val c: Int = "".ext + val c: Int = "".ext 3.extRenamed() "".extRenamed = 3 - val c2: Int = "".extRenamed + val c2: Int = "".extRenamed A() A(3) - val a: Int = genericFun(3, 3) - val s: String = genericFun("A", "b") - val b: Boolean = genericFun(true, false) + val a: Int = genericFun(3, 3) + val s: String = genericFun("A", "b") + val b: Boolean = genericFun(true, false) } fun t(t: T): T { @@ -129,4 +129,4 @@ fun testMembersFromSupertypes() { genericFromI("a") own -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt index 92699d335b9..41f37f30a24 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt @@ -6,7 +6,7 @@ import java.util.Comparator fun foo() { - val c: Comparator = comparator { date1, date2 -> + val c: Comparator = comparator { date1, date2 -> if (date1 != null && date2 != null) { date1.compareTo(date2) * -11 } else { @@ -17,8 +17,8 @@ fun foo() { fun bar(i: Int, a: U) { val r = if (true) i else a - val b: Any = r + val b: Any = r } //from standard library -public inline fun comparator(fn: (T,T) -> Int): Comparator {} \ No newline at end of file +public inline fun comparator(fn: (T,T) -> Int): Comparator {} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt index 30fb9691a7b..25ead5a9f34 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt @@ -4,13 +4,13 @@ package d interface A -fun infer(a: A) : T {} +fun infer(a: A) : T {} fun test(nothing: Nothing?) { - val i = infer(nothing) + val i = infer(nothing) } -fun sum(a : IntArray) : Int { +fun sum(a : IntArray) : Int { for (n return "?" } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.fir.kt deleted file mode 100644 index e169c711d74..00000000000 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun test(a: Any) { - when (a) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt index 79c3cde1c46..fa44970e6a7 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun test(a: Any) { - when (a) -} \ No newline at end of file + when (a) +} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.kt index 1ee4851ed31..ab24263880b 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.kt @@ -1,11 +1,10 @@ // !WITH_NEW_INFERENCE package b -fun foo(map: Map) : R = throw Exception() +fun foo(map: Map) : R = throw Exception() fun getMap() : Map = throw Exception() fun bar123() { foo(getMap( } - diff --git a/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.fir.kt deleted file mode 100644 index 9144e6fee12..00000000000 --- a/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -fun test1() { - try { - - } catch () -} - -fun test2() { - try { } -} - -fun test3() { - try { - } catch ({}) {} -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.kt b/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.kt index d16b6fb28e9..c6c820c7c33 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/incompleteTryCatchBlock.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun test1() { try { @@ -10,5 +11,5 @@ fun test2() { fun test3() { try { - } catch ({}) {} -} \ No newline at end of file + } catch ({}) {} +} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/kt1955.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/kt1955.fir.kt deleted file mode 100644 index b7aff9093fd..00000000000 --- a/compiler/testData/diagnostics/tests/incompleteCode/kt1955.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -//KT-1955 Half a file is red on incomplete code - -package b - -fun foo() { - val a = 1 - - diff --git a/compiler/testData/diagnostics/tests/incompleteCode/kt1955.kt b/compiler/testData/diagnostics/tests/incompleteCode/kt1955.kt index e0821228b58..3e7c483c971 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/kt1955.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/kt1955.kt @@ -1,8 +1,7 @@ +// FIR_IDENTICAL //KT-1955 Half a file is red on incomplete code package b fun foo() { - val a = 1 - - + val a = 1 diff --git a/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt b/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt index 93bb360e871..b105484b0ea 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt @@ -2,7 +2,7 @@ package b fun foo() { for (i in collection) { - { + { break - } + } } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.fir.kt deleted file mode 100644 index fdd9b6d8b09..00000000000 --- a/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.fir.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun foo(s: String) { - s. - val b = 42 -} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.kt b/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.kt index 22dedae5092..5b747299cb5 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.kt @@ -1,4 +1,5 @@ +// FIR_IDENTICAL fun foo(s: String) { s. - val b = 42 + val b = 42 } diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt index 52279435645..cac79451b19 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt @@ -1,9 +1,9 @@ // !WITH_NEW_INFERENCE package f -fun g(i: Int, a: Any): List {throw Exception()} -fun g(a: Any, i: Int): Collection {throw Exception()} +fun g(i: Int, a: Any): List {throw Exception()} +fun g(a: Any, i: Int): Collection {throw Exception()} fun test() { - val c: List = g(1, 1) + val c: List = g(1, 1) } diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt index aacfd90bf3c..24ff15ec54c 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt @@ -1,7 +1,7 @@ // !WITH_NEW_INFERENCE package f -fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 -fun h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1 +fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 +fun h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1 -fun test() = h(1, 1, 1, { b -> 42 }) +fun test() = h(1, 1, 1, { b -> 42 }) diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt index ab48eba9767..e4bb38a8de6 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt @@ -1,10 +1,10 @@ // !WITH_NEW_INFERENCE package f -fun f(i: Int, c: Collection): List {throw Exception()} -fun f(a: Any, l: List): Collection {throw Exception()} +fun f(i: Int, c: Collection): List {throw Exception()} +fun f(a: Any, l: List): Collection {throw Exception()} -fun test(l: List) { +fun test(l: List) { f(1, emptyList()) } diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.fir.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.fir.kt deleted file mode 100644 index b31d5a847c2..00000000000 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -package f - -fun f(i: Int, t: T, c: MutableCollection) {} -fun f(a: Any, t: T, l: MutableList) {} - -fun test(l: List) { - f(1, "", l) -} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt index f9ea211bb5d..1d571e5ff69 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL package f -fun f(i: Int, t: T, c: MutableCollection) {} -fun f(a: Any, t: T, l: MutableList) {} +fun f(i: Int, t: T, c: MutableCollection) {} +fun f(a: Any, t: T, l: MutableList) {} fun test(l: List) { f(1, "", l) diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt index db059c80eb6..50c932000f4 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt @@ -2,10 +2,9 @@ // !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS package f -fun h(f: (Boolean) -> R) = 1 -fun h(f: (String) -> R) = 2 +fun h(f: (Boolean) -> R) = 1 +fun h(f: (String) -> R) = 2 -fun test() = h{ i -> getAnswer() } +fun test() = h{ i -> getAnswer() } fun getAnswer() = 42 - diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateBeforeFixation.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateBeforeFixation.kt index 997b4345b80..5fc841c5053 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateBeforeFixation.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateBeforeFixation.kt @@ -1,8 +1,7 @@ - fun Array.intersect(other: Iterable) { val set = toMutableSet() set.retainAll(other) } fun Array.toMutableSet(): MutableSet = TODO() -fun MutableCollection.retainAll(elements: Iterable) {} \ No newline at end of file +fun MutableCollection.retainAll(elements: Iterable) {} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.fir.kt deleted file mode 100644 index 6af1a91db5f..00000000000 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun > mapKeysTo(destination: M): Inv3 { - val foo = associateByTo(destination) - - return foo -} - -fun < Y, Z, T : MutableMap> associateByTo(destination: T): Inv3 = TODO() - -interface Inv3 diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.kt index f5cb4510ff3..04f9565047d 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromSubtyping.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL fun > mapKeysTo(destination: M): Inv3 { val foo = associateByTo(destination) return foo } -fun < Y, Z, T : MutableMap> associateByTo(destination: T): Inv3 = TODO() +fun < Y, Z, T : MutableMap> associateByTo(destination: T): Inv3 = TODO() interface Inv3 diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromTypeParameterUpperBound.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromTypeParameterUpperBound.kt index d7ddb904184..df2833eb45b 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromTypeParameterUpperBound.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromTypeParameterUpperBound.kt @@ -8,4 +8,4 @@ fun > foo(x: X, y: Y) { rY.length } -fun bar(l: Inv): Y = TODO() +fun bar(l: Inv): Y = TODO() diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt index 6876c77decb..d20e3d6a4ee 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureTypeOnlyOnTopLevel.kt @@ -6,5 +6,5 @@ fun foo(array: Array>): Array> = array fun test(array: Array>) { foo(array) - val f: Array> = foo(array) + val f: Array> = foo(array) } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt index 056d3472cc6..29a517371a5 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.kt @@ -19,7 +19,7 @@ fun foo(): String? { if (true) return@run else - if (true) 42 + if (true) 42 } run { @@ -39,4 +39,4 @@ fun foo(): String? { } return "" -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.fir.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.fir.kt deleted file mode 100644 index 1c0978422ce..00000000000 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// SKIP_TXT -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !LANGUAGE: +NewInference - -fun foo(f: () -> Unit) {} -fun bar(): Int = 42 -fun test() { - foo { - ::bar // should be fine - } - foo { - { "something" } // should be fine - } -} diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt index 86d1d2ecf3f..6be9c645d8d 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT // !DIAGNOSTICS: -UNUSED_PARAMETER // !LANGUAGE: +NewInference @@ -6,9 +7,9 @@ fun foo(f: () -> Unit) {} fun bar(): Int = 42 fun test() { foo { - ::bar // should be fine + ::bar // should be fine } foo { - { "something" } // should be fine + { "something" } // should be fine } } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt index 80f7da81a83..1eb84b4ea24 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt @@ -29,7 +29,7 @@ fun test(i: Inv, iUnit: Inv) { run { null } } launch { - run { null } + run { null } } launch { run(i) { TODO() } @@ -38,16 +38,16 @@ fun test(i: Inv, iUnit: Inv) { run(A.flexible(i)) { TODO() } } launch { - run(A.flexible(iUnit)) { 42 } + run(A.flexible(iUnit)) { 42 } } launch { @Suppress("UNSUPPORTED") - run { "" } + run { "" } } if (iUnit is String) { launch { - run(A.flexible(iUnit)) { 42 } + run(A.flexible(iUnit)) { 42 } } } } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt index ee12000834a..9a8d205c222 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt @@ -8,7 +8,7 @@ val a: () -> Unit = l@{ // Expected type here is Unit, but it also implies coercion, // so we can end lambda body with statement - if (true) 42 + if (true) 42 } val b: () -> Unit = l@{ @@ -16,7 +16,7 @@ val b: () -> Unit = l@{ if (true) return@l "hello" // However, this is OK, because here coercion is applied - "hello" + "hello" } val c: () -> Unit = { diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt index 0dc0c387722..541535ac2d9 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt @@ -3,16 +3,16 @@ fun materialize(): T = TODO() fun implicitCoercion() { - val a = { + val a = { // Block is implicitly Unit-coerced, so it is allowed to place statement at the end of lambda - if (true) 42 + if (true) 42 } - val b = l@{ + val b = l@{ return@l } - val c = l@{ + val c = l@{ // Error: block doesn't have an expected type, so call can't be inferred! return@l materialize() } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/indirectCoercionWithExpectedType.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/indirectCoercionWithExpectedType.kt index eb00be09446..e5f58302acb 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/indirectCoercionWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/indirectCoercionWithExpectedType.kt @@ -5,7 +5,7 @@ fun materialize(): T = TODO() fun a(): Unit = run { run { // Ok, block is coerced, because it has (indirectly) Unit-expected type - "hello" + "hello" } } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt index 1b03a5bc33e..964666b4ad1 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/kt30242.kt @@ -48,7 +48,7 @@ fun bar(block: () -> String) {} fun test_5(b: Boolean) { bar { - if (b) { + if (b) { println("meh") } } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/noCoercion.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/noCoercion.kt index 1bd52c393b5..b59b8cd762c 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/noCoercion.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/noCoercion.kt @@ -10,17 +10,17 @@ fun noCoercionLastExpressionUsedAsReturnArgument() { } fun noCoercionBlockHasExplicitType() { - val b: () -> Int = { - if (true) 42 + val b: () -> Int = { + if (true) 42 } } fun noCoercionBlockHasExplicitReturn() { - val c = l@{ + val c = l@{ if (true) return@l 42 if (true) 239 } } -fun noCoercionInExpressionBody(): Unit = "hello" \ No newline at end of file +fun noCoercionInExpressionBody(): Unit = "hello" diff --git a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt index de77530c91f..0c250c622dc 100644 --- a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt +++ b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt @@ -5,11 +5,11 @@ package d import checkSubtype -fun joinT(x: Int, vararg a: T): T? { +fun joinT(x: Int, vararg a: T): T? { return null } -fun joinT(x: Comparable<*>, y: T): T? { +fun joinT(x: Comparable<*>, y: T): T? { return null } diff --git a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt index 319d3edec7b..f31cff91a4e 100644 --- a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt +++ b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt @@ -4,13 +4,13 @@ package conflictingSubstitutions import java.util.* -fun elemAndList(r: R, t: MutableList): R = r -fun R.elemAndListWithReceiver(r: R, t: MutableList): R = r +fun elemAndList(r: R, t: MutableList): R = r +fun R.elemAndListWithReceiver(r: R, t: MutableList): R = r fun test() { - val s = elemAndList(11, list("72")) + val s = elemAndList(11, list("72")) - val u = 11.elemAndListWithReceiver(4, list("7")) + val u = 11.elemAndListWithReceiver(4, list("7")) } fun list(value: T) : ArrayList { diff --git a/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt b/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt index 4d638bb2270..5d86d293f12 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt @@ -4,7 +4,7 @@ class A -class B(foo: A) { +class B(foo: A) { fun test1(a: A) { B(a) val b: B = B(a) @@ -14,7 +14,7 @@ class B(foo: A) { class C -class D(foo: C) { +class D(foo: C) { fun test(a: C) { val d: D = D(a) } diff --git a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.kt b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.kt index 163308f508e..4d40c9a77eb 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToFlexibleRawTypes.kt @@ -28,5 +28,5 @@ abstract class MySettingsListener {} fun test() { val a = MySettings.getSettings() a.getLinkedProjectsSettings() - a.linkedProjectsSettings + a.linkedProjectsSettings } diff --git a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.fir.kt b/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.fir.kt deleted file mode 100644 index d26254bef7c..00000000000 --- a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.fir.kt +++ /dev/null @@ -1,54 +0,0 @@ -// !CHECK_TYPE - -package h -//+JDK -import java.util.* -import checkSubtype - -fun id(t: T) : T = t - -fun id1(t: T) = t - -fun elem(t: List): R = t.get(0) - -fun elemAndList(r: R, t: List): R = t.get(0) - -fun both(t1: T, t2: T) : T = t1 - -fun test1() { - val a = elem(list(2)) - val b = id(elem(list(2))) - val c = id(id1(id(id1(list(33))))) - checkSubtype(a) - checkSubtype(b) - checkSubtype>(c) - - val d : ArrayList = newList() - val e : ArrayList = id(newList()) - val f : ArrayList = id(id1(id(id1(newList())))) - - checkSubtype>(d) - checkSubtype>(e) - checkSubtype>(f) - - val g = elemAndList("", newList()) - val h = elemAndList(1, newList()) - - checkSubtype(g) - checkSubtype(h) - - val i = both(1, "") - val j = both(id(1), id("")) - checkSubtype(i) - checkSubtype(j) -} - -fun list(value: T) : ArrayList { - val list = ArrayList() - list.add(value) - return list -} - -fun newList() : ArrayList { - return ArrayList() -} diff --git a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt b/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt index 2a227938921..04f01bfa639 100644 --- a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE package h @@ -11,9 +12,9 @@ fun id1(t: T) = t fun elem(t: List): R = t.get(0) -fun elemAndList(r: R, t: List): R = t.get(0) +fun elemAndList(r: R, t: List): R = t.get(0) -fun both(t1: T, t2: T) : T = t1 +fun both(t1: T, t2: T) : T = t1 fun test1() { val a = elem(list(2)) diff --git a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt index b621e8df1d8..a47d0b24324 100644 --- a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt +++ b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt @@ -1,15 +1,15 @@ // !WITH_NEW_INFERENCE package a -class MyList(t: T) {} +class MyList(t: T) {} fun getMyList(t: T) : MyList< T> = MyList(t) fun getMyListToWriteTo(t: T) : MyList< in T> = MyList(t) fun getMyListToReadFrom(t: T) : MyList = MyList(t) -fun useMyList (l: MyList< T>, t: T) {} -fun writeToMyList (l: MyList< in T>, t: T) {} -fun readFromMyList(l: MyList, t: T) {} +fun useMyList (l: MyList< T>, t: T) {} +fun writeToMyList (l: MyList< in T>, t: T) {} +fun readFromMyList(l: MyList, t: T) {} fun test1(int: Int, any: Any) { val a0 : MyList = getMyList(int) @@ -25,16 +25,16 @@ fun test1(int: Int, any: Any) { val a5 : MyList = getMyListToWriteTo(any) - val a6 : MyList = getMyList(int) + val a6 : MyList = getMyList(int) val a7 : MyList = getMyList(int) - val a8 : MyList = getMyListToReadFrom(int) + val a8 : MyList = getMyListToReadFrom(int) val a9 : MyList = getMyListToReadFrom(int) - val a10 : MyList = getMyList(any) + val a10 : MyList = getMyList(any) val a11 : MyList = getMyList(any) - val a12 : MyList = getMyListToWriteTo(any) + val a12 : MyList = getMyListToWriteTo(any) val a13 : MyList = getMyListToWriteTo(any) useMyList(getMyList(int), int) diff --git a/compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt b/compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt index e1ff62aaa50..d41dfec9cdb 100644 --- a/compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt +++ b/compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt @@ -5,10 +5,10 @@ import java.util.* import java.util.Collections.* fun foo(list: List) : String { - val w : String = max(list, comparator {o1, o2 -> 1 + val w : String = max(list, comparator {o1, o2 -> 1 }) return w } //from library -fun comparator(fn: (T,T) -> Int): Comparator {} +fun comparator(fn: (T,T) -> Int): Comparator {} diff --git a/compiler/testData/diagnostics/tests/inference/expectedTypeWithGenerics.kt b/compiler/testData/diagnostics/tests/inference/expectedTypeWithGenerics.kt index 1334956aaa4..0c6b97f790f 100644 --- a/compiler/testData/diagnostics/tests/inference/expectedTypeWithGenerics.kt +++ b/compiler/testData/diagnostics/tests/inference/expectedTypeWithGenerics.kt @@ -6,13 +6,13 @@ class X { } fun test(x: X) { - val y = x.foo() as Int + val y = x.foo() as Int } fun g() { fun foo(): T = TODO() - val y = foo() as Int + val y = foo() as Int - val y2 = foo() as D + val y2 = foo() as D } diff --git a/compiler/testData/diagnostics/tests/inference/fixVariableToNothing.kt b/compiler/testData/diagnostics/tests/inference/fixVariableToNothing.kt index 4930e689c7e..470d955e73f 100644 --- a/compiler/testData/diagnostics/tests/inference/fixVariableToNothing.kt +++ b/compiler/testData/diagnostics/tests/inference/fixVariableToNothing.kt @@ -1,15 +1,14 @@ - // completion order here: X, Y, WHEN_VARIABLE fun List.optimizeReadOnlyList() = when (size) { 0 -> emptyList() // here type variable Y will be fixed to Nothing 1 -> listOf(this[0]) else -> this } -fun listOf(element: X): List = TODO() +fun listOf(element: X): List = TODO() fun emptyList(): List = TODO() fun test(l: List): List { val foo = l.optimizeReadOnlyList() return foo -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.fir.kt b/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.fir.kt deleted file mode 100644 index 724d1bebfef..00000000000 --- a/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -class R - -fun f(): R = R() - -operator fun Int.plusAssign(y: R) {} - -fun box() { - 1 += f() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.kt b/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.kt index dc8a1ddf655..5e944051018 100644 --- a/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.kt +++ b/compiler/testData/diagnostics/tests/inference/genericAssignmentOperator.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL class R fun f(): R = R() -operator fun Int.plusAssign(y: R) {} +operator fun Int.plusAssign(y: R) {} fun box() { 1 += f() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt index 3ef2b299319..6ad150321f2 100644 --- a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt @@ -1,8 +1,8 @@ package n -fun foo(t: T, t1: T) {} +fun foo(t: T, t1: T) {} fun test() { //no type inference error foo(aaab, bbb) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.fir.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.fir.kt deleted file mode 100644 index bee6cb003df..00000000000 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -package n - -//+JDK -import java.util.* - -fun expected(t: T, f: () -> T) : T = t - -fun test(arrayList: ArrayList, list: List) { - val t = expected(arrayList, { list.reverse() }) -} - -fun List.reverse() : List = this \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt index 4c0bdb16b4b..be468075cfc 100644 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL package n //+JDK import java.util.* -fun expected(t: T, f: () -> T) : T = t +fun expected(t: T, f: () -> T) : T = t fun test(arrayList: ArrayList, list: List) { - val t = expected(arrayList, { list.reverse() }) + val t = expected(arrayList, { list.reverse() }) } -fun List.reverse() : List = this \ No newline at end of file +fun List.reverse() : List = this diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.fir.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.fir.kt deleted file mode 100644 index c4415224ee0..00000000000 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -package n - -//+JDK -import java.util.* - -fun expected(t: T, f: () -> T) : T = t - -fun test(arrayList: ArrayList, list: List) { - val t = expected(arrayList, l@ {return@l list.reverse() }) -} - -fun List.reverse() : List = this \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt index c878846bb58..d4f6eef1b3f 100644 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt +++ b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL package n //+JDK import java.util.* -fun expected(t: T, f: () -> T) : T = t +fun expected(t: T, f: () -> T) : T = t fun test(arrayList: ArrayList, list: List) { - val t = expected(arrayList, l@ {return@l list.reverse() }) + val t = expected(arrayList, l@ {return@l list.reverse() }) } -fun List.reverse() : List = this \ No newline at end of file +fun List.reverse() : List = this diff --git a/compiler/testData/diagnostics/tests/inference/kt12399.kt b/compiler/testData/diagnostics/tests/inference/kt12399.kt index f49a6b15450..bd8ca312d75 100644 --- a/compiler/testData/diagnostics/tests/inference/kt12399.kt +++ b/compiler/testData/diagnostics/tests/inference/kt12399.kt @@ -1,3 +1,3 @@ -fun foo(a: Any) { - foo({ index -> } { }) -} \ No newline at end of file +fun foo(a: Any) { + foo({ index -> } { }) +} diff --git a/compiler/testData/diagnostics/tests/inference/kt1293.kt b/compiler/testData/diagnostics/tests/inference/kt1293.kt index 9d48301a5cc..87d031e800d 100644 --- a/compiler/testData/diagnostics/tests/inference/kt1293.kt +++ b/compiler/testData/diagnostics/tests/inference/kt1293.kt @@ -5,8 +5,8 @@ package kt1293 fun main() { val intArray = arrayOfNulls(10) - val i : Int = intArray[0] + val i : Int = intArray[0] requiresInt(intArray[0]) } -fun requiresInt(i: Int) {} +fun requiresInt(i: Int) {} diff --git a/compiler/testData/diagnostics/tests/inference/listConstructor.fir.kt b/compiler/testData/diagnostics/tests/inference/listConstructor.fir.kt deleted file mode 100644 index aab8f8b1fbc..00000000000 --- a/compiler/testData/diagnostics/tests/inference/listConstructor.fir.kt +++ /dev/null @@ -1,31 +0,0 @@ -// !CHECK_TYPE - -package a -//+JDK -import java.util.* -import checkSubtype - -fun cons(x: A, xs: List): List = xs - -fun nil(): List = arrayList() - -fun test() { - val xs = cons(1, nil()) - val xs1 = cons("", nil()) - val xs2 = cons(1, nil()) - - checkSubtype>(xs) - checkSubtype>(xs1) - checkSubtype>(xs2) -} - - -// --------------------- -// copy from kotlin util - -fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size)) - -fun > Array.toCollection(result: C) : C { - for (element in this) result.add(element) - return result -} diff --git a/compiler/testData/diagnostics/tests/inference/listConstructor.kt b/compiler/testData/diagnostics/tests/inference/listConstructor.kt index cb496c0591f..891b327d563 100644 --- a/compiler/testData/diagnostics/tests/inference/listConstructor.kt +++ b/compiler/testData/diagnostics/tests/inference/listConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE package a @@ -5,7 +6,7 @@ package a import java.util.* import checkSubtype -fun cons(x: A, xs: List): List = xs +fun cons(x: A, xs: List): List = xs fun nil(): List = arrayList() diff --git a/compiler/testData/diagnostics/tests/inference/mapFunction.kt b/compiler/testData/diagnostics/tests/inference/mapFunction.kt index a87b00b7de4..dcb9faebd63 100644 --- a/compiler/testData/diagnostics/tests/inference/mapFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/mapFunction.kt @@ -31,6 +31,6 @@ fun foo() { @Suppress("UNCHECKED_CAST") fun array(vararg t : T) : Array = t as Array -infix fun Array.map(transform : (T) -> R) : List {} +infix fun Array.map(transform : (T) -> R) : List {} -infix fun Iterable.map(transform : (T) -> R) : List {} +infix fun Iterable.map(transform : (T) -> R) : List {} diff --git a/compiler/testData/diagnostics/tests/inference/mostSpecificAfterInference.kt b/compiler/testData/diagnostics/tests/inference/mostSpecificAfterInference.kt index 7bf485ee7d2..bd87a1cfbbb 100644 --- a/compiler/testData/diagnostics/tests/inference/mostSpecificAfterInference.kt +++ b/compiler/testData/diagnostics/tests/inference/mostSpecificAfterInference.kt @@ -6,8 +6,8 @@ package i import java.util.* import checkSubtype -fun Collection.map1(f : (T) -> R) : List {} -fun java.lang.Iterable.map1(f : (T) -> R) : List {} +fun Collection.map1(f : (T) -> R) : List {} +fun java.lang.Iterable.map1(f : (T) -> R) : List {} fun test(list: List) { val res = list.map1 { it } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.fir.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.fir.kt deleted file mode 100644 index 93fafdcf02d..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -package j - -interface MyFunc {} - -class A(val b: B) { -} - -class B { - operator fun invoke(f: (T) -> T): MyFunc = throw Exception() -} - -fun id(r: R) = r - -fun foo(a: A) { - val r : MyFunc = id (a.b { x -> x + 14 }) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt index c2fc119a18e..f7c37237d10 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package j interface MyFunc {} @@ -6,11 +7,11 @@ class A(val b: B) { } class B { - operator fun invoke(f: (T) -> T): MyFunc = throw Exception() + operator fun invoke(f: (T) -> T): MyFunc = throw Exception() } fun id(r: R) = r fun foo(a: A) { - val r : MyFunc = id (a.b { x -> x + 14 }) -} \ No newline at end of file + val r : MyFunc = id (a.b { x -> x + 14 }) +} diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.fir.kt deleted file mode 100644 index f2f16c4c3b3..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -class A { - fun foo(s: S): S = s - fun bar(s: U): List = null!! - - fun test() = foo(bar("")) -} diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.kt index 194a5363eef..9cef5a26a70 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/externalTypeParameter.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL class A { fun foo(s: S): S = s - fun bar(s: U): List = null!! + fun bar(s: U): List = null!! fun test() = foo(bar("")) } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.fir.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.fir.kt deleted file mode 100644 index 41a96b8a2eb..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.fir.kt +++ /dev/null @@ -1,35 +0,0 @@ -//KT-3395 mapOf function can't be used as literal -package b - -import java.util.ArrayList - -public fun query(t: T, args: Map): List { - return ArrayList() -} - -fun test(pair: Pair) { - val id = "Hello" // variable is marked as unused - - println("Some" + query(0, mapOf(id to 1))) - - println("Some" + query(0, mapOf(pair))) -} - - -//from standard library -fun mapOf(vararg values: Pair): Map { throw Exception() } - -infix fun A.to(that: B): Pair { throw Exception() } - -fun println(message : Any?) { throw Exception() } - -class Pair () {} - -//short example -fun foo(t: T) = t - -fun test(t: String) { - - println("Some" + foo(t)) // t was marked with black square -} - diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt index f0fe0f47d5f..e51f4fa065f 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL //KT-3395 mapOf function can't be used as literal package b import java.util.ArrayList -public fun query(t: T, args: Map): List { +public fun query(t: T, args: Map): List { return ArrayList() } @@ -17,11 +18,11 @@ fun test(pair: Pair) { //from standard library -fun mapOf(vararg values: Pair): Map { throw Exception() } +fun mapOf(vararg values: Pair): Map { throw Exception() } -infix fun A.to(that: B): Pair { throw Exception() } +infix fun A.to(that: B): Pair { throw Exception() } -fun println(message : Any?) { throw Exception() } +fun println(message : Any?) { throw Exception() } class Pair () {} @@ -32,4 +33,3 @@ fun test(t: String) { println("Some" + foo(t)) // t was marked with black square } - diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3461checkTypes.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3461checkTypes.kt index 3138e8998b9..a6173338bce 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3461checkTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3461checkTypes.kt @@ -5,11 +5,11 @@ class F { fun p(): String? = null } -fun foo(s: String) {} +fun foo(s: String) {} fun r(): Int? = null fun test() { foo(F().p()) foo(r()) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.fir.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.fir.kt deleted file mode 100644 index 8ca1f233a12..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -package a - -fun foo(l: List): Int = l.get(0) - -fun emptyList(): List = throw Exception() - -fun makeNullable(t: T): T? = null - -fun bar(i: Int) = i -fun bar(a: Any) = a - -fun test(array: Array) { - bar(array[foo(emptyList())]) - - bar(foo(emptyList()) + foo(a.emptyList())) - - bar(makeNullable(foo(emptyList())) ?: 0) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt index 6ffaefd75f3..95b7f2897c2 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt @@ -1,10 +1,11 @@ +// FIR_IDENTICAL package a fun foo(l: List): Int = l.get(0) fun emptyList(): List = throw Exception() -fun makeNullable(t: T): T? = null +fun makeNullable(t: T): T? = null fun bar(i: Int) = i fun bar(a: Any) = a @@ -15,4 +16,4 @@ fun test(array: Array) { bar(foo(emptyList()) + foo(a.emptyList())) bar(makeNullable(foo(emptyList())) ?: 0) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt b/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt index b2f2d163bf9..f171350c8e0 100644 --- a/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt @@ -5,9 +5,9 @@ package noInformationForParameter import java.util.* fun test() { - val n = newList() + val n = newList() - val n1 : List = newList() + val n1 : List = newList() } fun newList() : ArrayList { diff --git a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.kt b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.kt index bea54d8c504..c7f7b8a2b66 100644 --- a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.kt +++ b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.kt @@ -15,7 +15,7 @@ fun testAny() { fun testAnyCall() { callAny { - error -> error() + error -> error() } } @@ -27,10 +27,10 @@ fun testParam() { fun testParamCall() { callParam { - param -> param() + param -> param() } } fun testNoContext() { - { it -> it } + { it -> it } } diff --git a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt b/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt index 8e07c6a6294..89ae085cc5f 100644 --- a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt @@ -6,7 +6,7 @@ fun select3(x: K, y: K, z: K): K = TODO() fun test2(f: ((String) -> Int)?) { val a0: ((Int) -> Int)? = select2({ it -> it }, null) - val b0: ((Nothing) -> Unit)? = select2({ it -> it }, null) + val b0: ((Nothing) -> Unit)? = select2({ it -> it }, null) select3({ it.length }, f, null) } diff --git a/compiler/testData/diagnostics/tests/inference/nullableTypeArgumentWithNotNullUpperBound.kt b/compiler/testData/diagnostics/tests/inference/nullableTypeArgumentWithNotNullUpperBound.kt index c37436aff76..5e17f59a01a 100644 --- a/compiler/testData/diagnostics/tests/inference/nullableTypeArgumentWithNotNullUpperBound.kt +++ b/compiler/testData/diagnostics/tests/inference/nullableTypeArgumentWithNotNullUpperBound.kt @@ -3,7 +3,7 @@ fun foo1(x: Array, y: Array) { val yo = ")!>inANullable(y) var f: Array = xo - f = yo + f = yo } fun foo2(x: Array, y: Array) { @@ -11,7 +11,7 @@ fun foo2(x: Array, y: Array) { val yo = ")!>inA(y) var f: Array = xo - f = yo + f = yo } class A1(x: Array, y: Array) { @@ -24,8 +24,8 @@ class A2(x: Array, y: Array) { val yo = ")!>inA(y) } -fun outANullable(x: Array): Array = TODO() -fun inANullable(x: Array): Array = TODO() +fun outANullable(x: Array): Array = TODO() +fun inANullable(x: Array): Array = TODO() -fun outA(x: Array): Array = TODO() -fun inA(x: Array): Array = TODO() +fun outA(x: Array): Array = TODO() +fun inA(x: Array): Array = TODO() diff --git a/compiler/testData/diagnostics/tests/inference/nullableUpperBound.fir.kt b/compiler/testData/diagnostics/tests/inference/nullableUpperBound.fir.kt deleted file mode 100644 index c5cc05a8612..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nullableUpperBound.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -package o - -fun foo(): String? { - return accept(JV()) -} - -fun accept(v: JV): R? = null - -open class JV() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt b/compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt index 62b9383a669..111db516555 100644 --- a/compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt +++ b/compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL package o fun foo(): String? { return accept(JV()) } -fun accept(v: JV): R? = null +fun accept(v: JV): R? = null -open class JV() \ No newline at end of file +open class JV() diff --git a/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt index 6110eee09a3..0bb672e22d9 100644 --- a/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt +++ b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt @@ -3,12 +3,12 @@ package a import java.util.* -fun g (f: () -> List) : T {} +fun g (f: () -> List) : T {} fun test() { //here possibly can be a cycle on constraints - val x = g { Collections.emptyList() } + val x = g { Collections.emptyList() } - val y = g { Collections.emptyList() } - val z : List = g { Collections.emptyList() } + val y = g { Collections.emptyList() } + val z : List = g { Collections.emptyList() } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/compareBy.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/compareBy.fir.kt deleted file mode 100644 index cb18881e8f2..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/compareBy.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Item(val name: String, val rating: Int): Comparable { - public override fun compareTo(other: Item): Int { - return compareBy(this, other, { rating }, { name }) - } -} - -// from standard library -fun compareBy(a: T?, b: T?, - vararg functions: T.() -> Comparable<*>?): Int = throw Exception() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/compareBy.kt b/compiler/testData/diagnostics/tests/inference/regressions/compareBy.kt index b88b8fda8cc..cc525b3a59f 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/compareBy.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/compareBy.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class Item(val name: String, val rating: Int): Comparable { public override fun compareTo(other: Item): Int { return compareBy(this, other, { rating }, { name }) @@ -5,5 +6,5 @@ class Item(val name: String, val rating: Int): Comparable { } // from standard library -fun compareBy(a: T?, b: T?, - vararg functions: T.() -> Comparable<*>?): Int = throw Exception() \ No newline at end of file +fun compareBy(a: T?, b: T?, + vararg functions: T.() -> Comparable<*>?): Int = throw Exception() diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt index b3f15256803..d659c2191d8 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt @@ -5,10 +5,10 @@ package i import checkSubtype -public fun from(yielder: ()->Iterable) : Iterable { +public fun from(yielder: ()->Iterable) : Iterable { } -public infix fun Iterable.where(predicate : (T)->Boolean) : ()->Iterable { +public infix fun Iterable.where(predicate : (T)->Boolean) : ()->Iterable { } fun a() { diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt index 6eb7c9fb878..bb8ece02b4d 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt @@ -6,10 +6,10 @@ package i import java.util.ArrayList import checkSubtype -public infix fun Iterable.where(predicate : (TItem)->Boolean) : ()->Iterable { +public infix fun Iterable.where(predicate : (TItem)->Boolean) : ()->Iterable { } -public fun select(yielder: ()->Iterable, selector : (TItem)->TResult) : ()->Iterable { +public fun select(yielder: ()->Iterable, selector : (TItem)->TResult) : ()->Iterable { } fun a() { diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1127.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1127.kt index fd661b51400..3b72b90e71a 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1127.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1127.kt @@ -3,8 +3,8 @@ package d -fun asList(t: T) : List? {} +fun asList(t: T) : List? {} fun main() { - val list : List = asList("") + val list : List = asList("") } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1145.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1145.kt index bd015e993c3..f671940e7d0 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1145.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1145.kt @@ -12,6 +12,6 @@ fun test(numbers: Iterable) { } //from library -fun Iterable.map(transform : (T) -> R) : List {} +fun Iterable.map(transform : (T) -> R) : List {} -fun Iterable.fold(initial: T, operation: (T, T) -> T): T {} +fun Iterable.fold(initial: T, operation: (T, T) -> T): T {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt index 3a83b1d871d..ace3591909b 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt @@ -25,4 +25,4 @@ fun test(result: MutableList, collection: MutableCollection, pre } //from library -fun String.startsWith(prefix: String) : Boolean {} +fun String.startsWith(prefix: String) : Boolean {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt index d36c5f1a055..f3114777147 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt @@ -14,5 +14,5 @@ fun test() { } //from library -fun arrayList(vararg values: T) : ArrayList {} -operator fun Iterable.plus(elements: Iterable): List {} +fun arrayList(vararg values: T) : ArrayList {} +operator fun Iterable.plus(elements: Iterable): List {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt index bd5f419506a..ef64b163801 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt @@ -6,8 +6,8 @@ package n import checkSubtype fun main() { - val a = array(array()) - val a0 : Array> = array(array()) + val a = array(array()) + val a0 : Array> = array(array()) val a1 = array(array()) checkSubtype>>(a1) val a2 = array>(array()) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt index d3c758841bd..661f4fe7f84 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt @@ -5,10 +5,10 @@ package a interface Foo -fun Foo.map(f: (A) -> B): Foo = object : Foo {} +fun Foo.map(f: (A) -> B): Foo = object : Foo {} fun foo() { val l: Foo = object : Foo {} - val m: Foo = l.map { ppp -> 1 } + val m: Foo = l.map { ppp -> 1 } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2286.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2286.kt index 7131f595301..b6d6c0ec4e3 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2286.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2286.kt @@ -25,4 +25,4 @@ abstract class Buggy { } //from library -fun Iterable.find(predicate: (T) -> Boolean) : T? {} +fun Iterable.find(predicate: (T) -> Boolean) : T? {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2320.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2320.fir.kt deleted file mode 100644 index b132028c344..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2320.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -//KT-2320 failure of complex case of type inference -package i - -interface NotMap - -interface Entry { - fun getValue(): B -} - - -fun NotMap.mapValuesOriginal(ff: (Entry) -> R): NotMap = throw Exception() - -fun NotMap.mapValuesOnly(f: (B) -> C) = mapValuesOriginal { e -> f(e.getValue()) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2320.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2320.kt index 58fd4574321..1ac6ee756f5 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2320.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2320.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-2320 failure of complex case of type inference package i @@ -8,6 +9,6 @@ interface Entry { } -fun NotMap.mapValuesOriginal(ff: (Entry) -> R): NotMap = throw Exception() +fun NotMap.mapValuesOriginal(ff: (Entry) -> R): NotMap = throw Exception() fun NotMap.mapValuesOnly(f: (B) -> C) = mapValuesOriginal { e -> f(e.getValue()) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2324.fir.kt deleted file mode 100644 index 1cb99c46ae3..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !CHECK_TYPE - -//KT-2324 Can't resolve generic by type of function result -package i - -//+JDK -import java.util.* -import checkSubtype - -fun someFunction(list: List, transform: (T) -> K): List { - val result = arrayList() - for (i in list) { - result.add(transform(i)) - } - return result -} - -fun testSomeFunction() { - val result1 = someFunction(arrayList(1, 2), {checkSubtype(it)}) //type of result1 is List - assertEquals(1, result1.get(0)); //OK - - val result2 = someFunction(arrayList(1, 2), {it}) // type of result2 is List - checkSubtype>(result2) - assertEquals(1, result2.get(0)); //resolved to error element -} - -//--------------------------------- -fun assertEquals(expected: Any?, actual: Any?, message: String = "") { -} - -fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size)) - -fun > Array.toCollection(result: C) : C { - for (element in this) result.add(element) - return result -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt index 2d4bb7f7453..2d2024a9a7a 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE //KT-2324 Can't resolve generic by type of function result @@ -25,7 +26,7 @@ fun testSomeFunction() { } //--------------------------------- -fun assertEquals(expected: Any?, actual: Any?, message: String = "") { +fun assertEquals(expected: Any?, actual: Any?, message: String = "") { } fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size)) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt index 4188db5e35b..8749bb572e6 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt @@ -12,8 +12,8 @@ fun test() { } //from library -fun arrayList(vararg values: T) : ArrayList {} +fun arrayList(vararg values: T) : ArrayList {} -fun Collection.map(transform : (T) -> R) : List {} +fun Collection.map(transform : (T) -> R) : List {} -fun Iterable.fold(initial: T, operation: (T, T) -> T): T {} +fun Iterable.fold(initial: T, operation: (T, T) -> T): T {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt index 888bcd51ccb..22ab737dd00 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt @@ -7,4 +7,4 @@ class B(val x: List) fun f(x: T): B = B(arrayList(x)) // from standard library -fun arrayList(vararg values: T) : ArrayList {} \ No newline at end of file +fun arrayList(vararg values: T) : ArrayList {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt index 8717cf23160..d534930ec52 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt @@ -3,11 +3,11 @@ package a -fun > Iterable._sortBy(f: (T) -> R): List = throw Exception() -fun _arrayList(vararg values: T) : List = throw Exception() +fun > Iterable._sortBy(f: (T) -> R): List = throw Exception() +fun _arrayList(vararg values: T) : List = throw Exception() class _Pair(val a: A) fun test() { - _arrayList(_Pair(1))._sortBy { it -> xxx } + _arrayList(_Pair(1))._sortBy { it -> xxx } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt deleted file mode 100644 index 8fe0c9ffc98..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !WITH_NEW_INFERENCE - -package a - -interface Closeable {} -class C : Closeable {} - -public inline fun T.use1(block: (T)-> R) : R { - return block(this) -} - -fun main() { - C().use1 { - w -> // ERROR here - x - } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt index 5337e371458..e26830d0d32 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE package a @@ -11,7 +12,7 @@ public inline fun T.use1(block: (T)-> R) : R { fun main() { C().use1 { - w -> // ERROR here + w -> // ERROR here x } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.fir.kt index 82db36f9aa0..d6e35203230 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.fir.kt @@ -19,15 +19,15 @@ fun foo(){ fun bar(t: T): T = t fun test() { - + doAction { bar(12) } val u: Unit = bar(11) } fun testWithoutInference(col: MutableCollection) { - + doAction { col.add(2) } - + val u: Unit = col.add(2) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt index 4cd5c6a2764..95efc0688bb 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2883.kt @@ -2,13 +2,13 @@ //KT-2883 Type inference fails due to non-Unit value returned package a -public fun doAction(action : () -> Unit){ +public fun doAction(action : () -> Unit){ } class Y(val itemToString: (TItem) -> String){ } -fun bar(context : Y) : TItem{ +fun bar(context : Y) : TItem{ } fun foo(){ @@ -19,15 +19,15 @@ fun foo(){ fun bar(t: T): T = t fun test() { - + doAction { bar(12) } - val u: Unit = bar(11) + val u: Unit = bar(11) } fun testWithoutInference(col: MutableCollection) { - + doAction { col.add(2) } - - val u: Unit = col.add(2) + + val u: Unit = col.add(2) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt index ec96b685883..a393e8cc33e 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt @@ -8,7 +8,7 @@ enum class SomeEnum { // Doesn't work fun Iterable.some() { - this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> + this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> if (res == SomeEnum.FIRST) SomeEnum.FIRST else SomeEnum.SECOND }) } @@ -19,7 +19,7 @@ fun tempFun() : SomeEnum { // Doesn't work fun Iterable.someSimpleWithFun() { - this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> + this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> tempFun() }) } @@ -27,17 +27,17 @@ fun Iterable.someSimpleWithFun() { // Works fun Iterable.someSimple() { - this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> + this.fold(SomeEnum.FIRST, {res : SomeEnum, value -> SomeEnum.FIRST }) } // Works fun Iterable.someInt() { - this.fold(0, {res : Int, value -> + this.fold(0, {res : Int, value -> if (res == 0) 1 else 0 }) } //from standard library -fun Iterable.fold(initial: R, operation: (R, T) -> R): R {} +fun Iterable.fold(initial: R, operation: (R, T) -> R): R {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3150.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3150.fir.kt deleted file mode 100644 index 64ae0ce8d10..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3150.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -package aa - -class Some - -class SomeTemplate { - fun query(some: Class) = some - - - // Uncomment this to get CANNOT_COMPLETE_RESOLVE error - fun query1(some: Class) = some - fun query1(some: Some) = some -} - -fun SomeTemplate.query(f: (i: Int) -> Unit) = f -fun SomeTemplate.query1(f: (i: Int) -> Unit) = f - -fun test() { - val mapperFunction = { i: Int -> } - SomeTemplate().query(mapperFunction) - - // TYPE_MISMATCH: Required Class<[ERROR: CANT_INFER]>, Found (kotlin.Int) -> Unit - SomeTemplate().query { i: Int -> } - SomeTemplate().query1 { i: Int -> } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3150.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3150.kt index d8f9ec19425..abb61323d72 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3150.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3150.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package aa class Some @@ -15,10 +16,10 @@ fun SomeTemplate.query(f: (i: Int) -> Unit) = f fun SomeTemplate.query1(f: (i: Int) -> Unit) = f fun test() { - val mapperFunction = { i: Int -> } + val mapperFunction = { i: Int -> } SomeTemplate().query(mapperFunction) // TYPE_MISMATCH: Required Class<[ERROR: CANT_INFER]>, Found (kotlin.Int) -> Unit - SomeTemplate().query { i: Int -> } - SomeTemplate().query1 { i: Int -> } + SomeTemplate().query { i: Int -> } + SomeTemplate().query1 { i: Int -> } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt index c02bc58f9ff..03559322857 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt @@ -8,7 +8,7 @@ interface B object CAB : A, B object DAB : A, B -fun m(args : Array) { +fun m(args : Array) { } @@ -17,4 +17,4 @@ fun test122() { } //from library -fun array(vararg t: T): Array {} \ No newline at end of file +fun array(vararg t: T): Array {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3496.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3496.fir.kt deleted file mode 100644 index 9468733e750..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3496.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// KT-3496 Type inference bug on y[""] - -class B { - fun x (y: B>) { - val z: S = y[""] // does not work with [], but works with .get() - } - operator fun get(s : String): S = throw Exception() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3496.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3496.kt index c6099f4c48f..0e245e932af 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3496.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3496.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // KT-3496 Type inference bug on y[""] @@ -5,5 +6,5 @@ class B { fun x (y: B>) { val z: S = y[""] // does not work with [], but works with .get() } - operator fun get(s : String): S = throw Exception() -} \ No newline at end of file + operator fun get(s : String): S = throw Exception() +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.fir.kt deleted file mode 100644 index 1fc2f31cf73..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !CHECK_TYPE -// !DIAGNOSTICS: -UNUSED_VARIABLE - -import java.util.ArrayList - -class F { - fun x (y: F>, w: ArrayList) { - val z: ArrayList = y["", w] - } -} -operator fun Any.get(s: String, w: ArrayList): ArrayList = throw Exception() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.kt index cbd0892f7f6..6b92d0e38f8 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3496_2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_VARIABLE @@ -8,4 +9,4 @@ class F { val z: ArrayList = y["", w] } } -operator fun Any.get(s: String, w: ArrayList): ArrayList = throw Exception() \ No newline at end of file +operator fun Any.get(s: String, w: ArrayList): ArrayList = throw Exception() diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt index 7933a758ce5..c1d5dfa1a36 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt @@ -20,4 +20,4 @@ fun foo(lines: List) { //standard library fun T?.sure() : T = this!! -public inline fun comparator(fn: (T,T) -> Int): Comparator {} +public inline fun comparator(fn: (T,T) -> Int): Comparator {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt9461.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt9461.fir.kt deleted file mode 100644 index 67c205e8bbe..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt9461.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -interface In - -interface B : In - -interface C - -fun In.foo(f: () -> C) {} -fun > Self.foo2(f: () -> C) {} - -class E : B // e <: In <: In - -fun test(c: C, e: E) { - e.foo { c } - e.foo { c } // error here: expected C but must be C - e.foo2 { c } - e.foo2 ({ c }) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt9461.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt9461.kt index dc4eab6618f..b1832ea640b 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt9461.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt9461.kt @@ -1,11 +1,12 @@ +// FIR_IDENTICAL interface In interface B : In interface C -fun In.foo(f: () -> C) {} -fun > Self.foo2(f: () -> C) {} +fun In.foo(f: () -> C) {} +fun > Self.foo2(f: () -> C) {} class E : B // e <: In <: In @@ -14,4 +15,4 @@ fun test(c: C, e: E) { e.foo { c } // error here: expected C but must be C e.foo2 { c } e.foo2 ({ c }) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt948.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt948.kt index 421fb2445e1..908c4b90065 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt948.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt948.kt @@ -12,8 +12,8 @@ fun emptyList() : List? = ArrayList() fun foo() { // type arguments shouldn't be required - val l : List = emptyList()!! - val l1 = emptyList()!! + val l : List = emptyList()!! + val l1 = emptyList()!! checkSubtype>(emptyList()!!) checkSubtype?>(emptyList()) diff --git a/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt b/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt index 27540748926..338de3b205b 100644 --- a/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt +++ b/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt @@ -1,7 +1,7 @@ fun T.map(f: (T) -> U) = f(this) -fun consume(s: String) {} +fun consume(s: String) {} fun test() { consume(1.map(::foo)) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt index 08cb948bf82..e661ccc7191 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/ErrorTypeAsGenericParameter.kt @@ -1,9 +1,8 @@ package a -fun foo(block: (T)-> R, second: (T)-> S) = block +fun foo(block: (T)-> R, second: (T)-> S) = block fun main() { - val fff = { x: Int -> aaa } + val fff = { x: Int -> aaa } foo(fff, { x -> x + 1 }) } - diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt deleted file mode 100644 index ef8f4514c20..00000000000 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !WITH_NEW_INFERENCE - -package a - -interface Closeable {} -class C : Closeable {} - -fun T.foo(block: (T)-> R) = block - -fun T.foo(block: (T, T)-> R) = block - -fun main() { - C().foo { // no ambiguity here - www -> - xs - } -} - diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt index 274c1ba1e68..20f697f6907 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE package a @@ -11,8 +12,7 @@ fun T.foo(block: (T, T)-> R) = block fun main() { C().foo { // no ambiguity here - www -> + www -> xs } } - diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt index c68608f66a6..38b58fa387f 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/cannotInferParameterTypeWithInference.kt @@ -5,13 +5,13 @@ fun foo(block: (T)-> R) = block fun test1() { foo { - x -> // here we have 'cannot infer parameter type' error + x -> // here we have 'cannot infer parameter type' error 43 } } -fun bar(f: (A)->Unit) {} +fun bar(f: (A)->Unit) {} fun test2() { - bar { a -> } // here we don't have 'cannot infer parameter type' error + bar { a -> } // here we don't have 'cannot infer parameter type' error } diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/kt42620.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/kt42620.kt index 04b2d5c3703..554050e9a93 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/kt42620.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/kt42620.kt @@ -10,6 +10,6 @@ fun main2() = if (true) Foo::minus } else { Foo::times } -fun main4() = try { Foo::minus } finally { Foo::times } +fun main4() = try { Foo::minus } finally { Foo::times } fun main5() = Foo::minus ?: Foo::times diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/reportUnresolvedReferenceWrongReceiverForManyCandidates.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/reportUnresolvedReferenceWrongReceiverForManyCandidates.kt index a39d4876be5..62c4322f6e6 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/reportUnresolvedReferenceWrongReceiverForManyCandidates.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/reportUnresolvedReferenceWrongReceiverForManyCandidates.kt @@ -1,5 +1,5 @@ fun test() { - val a = -false + val a = -false } operator fun A.unaryMinus() {} diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt index 9c6e5bccc09..7108a6b6381 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt @@ -5,9 +5,9 @@ fun foo (f: ()->R, r: MutableList) = r.add(f()) fun bar (r: MutableList, f: ()->R) = r.add(f()) fun test() { - val a = foo({1}, arrayListOf("")) //no type inference error on 'arrayListOf' - val b = bar(arrayListOf(""), {1}) + val a = foo({1}, arrayListOf("")) //no type inference error on 'arrayListOf' + val b = bar(arrayListOf(""), {1}) } // from standard library -fun arrayListOf(vararg values: T) : MutableList {} +fun arrayListOf(vararg values: T) : MutableList {} diff --git a/compiler/testData/diagnostics/tests/inference/typeConstructorMismatch.kt b/compiler/testData/diagnostics/tests/inference/typeConstructorMismatch.kt index 6585c269550..530718d7a48 100644 --- a/compiler/testData/diagnostics/tests/inference/typeConstructorMismatch.kt +++ b/compiler/testData/diagnostics/tests/inference/typeConstructorMismatch.kt @@ -10,5 +10,5 @@ fun test(set: Set) { "".elemAndListWithReceiver("", set) } -fun elemAndList(r: R, t: List): R = r -fun R.elemAndListWithReceiver(r: R, t: List): R = r +fun elemAndList(r: R, t: List): R = r +fun R.elemAndListWithReceiver(r: R, t: List): R = r diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt index d4ddda6d19a..571c0e479ab 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/kt2856.kt @@ -17,4 +17,4 @@ fun main() { } //from standard library -fun println(message : Any?) {} \ No newline at end of file +fun println(message : Any?) {} diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/typeParameterAsUpperBound.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/typeParameterAsUpperBound.kt index ac059f090e5..c3da1616825 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/typeParameterAsUpperBound.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/typeParameterAsUpperBound.kt @@ -4,7 +4,7 @@ @kotlin.internal.InlineOnly public inline fun C.ifEmpty(f: () -> R): R where C : Collection<*>, C : R = if (isEmpty()) f() else this -public fun listOf(t: T): List = TODO() +public fun listOf(t: T): List = TODO() fun usage(c: List) { diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt index fb46c5cf4c5..00b070ffaa4 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt @@ -4,9 +4,9 @@ package Hello open class Base class StringBase : Base() -class Client>(x: X) +class Client>(x: X) fun test() { val c = Client(StringBase()) // Type inference fails here for T. - val i : Int = c -} \ No newline at end of file + val i : Int = c +} diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt index eb4d5600c16..ceb29636360 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt @@ -1,8 +1,8 @@ // !WITH_NEW_INFERENCE package a -fun foo(v: V, u: U) = u -fun bar(v: V, u: U) = u +fun foo(v: V, u: U) = u +fun bar(v: V, u: U) = u fun test(a: Any, s: String) { val b = foo(a, s) @@ -11,13 +11,13 @@ fun test(a: Any, s: String) { checkItIsExactlyAny(a, arrayListOf(c)) } -fun checkItIsExactlyAny(t: T, l: MutableList) {} +fun checkItIsExactlyAny(t: T, l: MutableList) {} -fun baz(v: V, u: MutableSet) = u +fun baz(v: V, u: MutableSet) = u fun test(a: Any, s: MutableSet) { baz(a, s) } //from standard library -fun arrayListOf(vararg t: T): MutableList {} +fun arrayListOf(vararg t: T): MutableList {} diff --git a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt index 72bab8b732c..e8e49d23c15 100644 --- a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt +++ b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt @@ -23,17 +23,17 @@ abstract class Test() { abstract var y2 : Int set abstract var y3 : Int set get abstract var y4 : Int set get() = 1 - abstract var y5 : Int set(x) {} get() = 1 - abstract var y6 : Int set(x) {} + abstract var y5 : Int set(x) {} get() = 1 + abstract var y6 : Int set(x) {} var v : Int var v1 : Int get var v2 : Int get set var v3 : Int get() = 1; set - var v4 : Int get() = 1; set(x){} + var v4 : Int get() = 1; set(x){} var v5 : Int get() = 1; set(x){field = x} - var v6 : Int get() = field + 1; set(x){} + var v6 : Int get() = field + 1; set(x){} abstract val v7 : Int get abstract var v8 : Int get set @@ -44,9 +44,9 @@ abstract class Test() { } -open class Super(i : Int) +open class Super(i : Int) -class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { +class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { val xx = w @@ -56,4 +56,4 @@ class TestPCParameters(w : Int, x : Int, val y : Int, var fun foo() = x -} \ 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 d95e16160d6..fbd3aea3ae8 100644 --- a/compiler/testData/diagnostics/tests/infos/SmartCasts.kt +++ b/compiler/testData/diagnostics/tests/infos/SmartCasts.kt @@ -154,23 +154,23 @@ fun illegalWhenBlock(a: Any): Int { } fun declarations(a: Any?) { if (a is String) { - val p4: String = a + val p4: String = a } if (a is String?) { if (a != null) { - val s: String = a + val s: String = a } } if (a != null) { if (a is String?) { - val s: String = a + val s: String = a } } } fun vars(a: Any?) { var b: Int = 0 if (a is Int) { - b = a + b = a } } fun returnFunctionLiteralBlock(a: Any?): Function0 { @@ -199,7 +199,7 @@ fun mergeSmartCasts(a: Any?) { is String, is Any -> a.compareTo("") } if (a is String && a is Any) { - val i: Int = a.compareTo("") + val i: Int = a.compareTo("") } if (a is String && a.compareTo("") == 0) {} if (a is String || a.compareTo("") == 0) {} @@ -210,10 +210,10 @@ fun f(): String { var a: Any = 11 if (a is String) { // a is a string, despite of being a variable - val i: String = a + val i: String = a a.compareTo("f") // Beginning from here a is captured in a closure but nobody modifies it - val f: Function0 = { a } + val f: Function0 = { a } return a } return "" diff --git a/compiler/testData/diagnostics/tests/inline/constructor.kt b/compiler/testData/diagnostics/tests/inline/constructor.kt index 330cd5d69a2..f43a2aa5cbd 100644 --- a/compiler/testData/diagnostics/tests/inline/constructor.kt +++ b/compiler/testData/diagnostics/tests/inline/constructor.kt @@ -1,7 +1,7 @@ -class Z(s: (Int) -> Int) { +class Z(s: (Int) -> Int) { } public inline fun test(s : (Int) -> Int) { Z(s) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inline/kt15410.kt b/compiler/testData/diagnostics/tests/inline/kt15410.kt index 4946119d85a..6bca72641f5 100644 --- a/compiler/testData/diagnostics/tests/inline/kt15410.kt +++ b/compiler/testData/diagnostics/tests/inline/kt15410.kt @@ -6,5 +6,5 @@ open class Foo protected constructor() inline fun foo(f: () -> Unit) = object: Foo() {} class A : Foo() { - inline fun foo(f: () -> Unit) = Foo() + inline fun foo(f: () -> Unit) = Foo() } diff --git a/compiler/testData/diagnostics/tests/inline/parenthesized.kt b/compiler/testData/diagnostics/tests/inline/parenthesized.kt index 35ffeead895..b12d7d414d0 100644 --- a/compiler/testData/diagnostics/tests/inline/parenthesized.kt +++ b/compiler/testData/diagnostics/tests/inline/parenthesized.kt @@ -4,24 +4,24 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) { (s)(11) (s).invoke(11) (s) invoke 11 - (s) + (s) } inline fun Function1.inlineExt() { (this).invoke(11) (this) invoke 11 (this)(11) - (this) + (this) } inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) { (((s)))(11) (((s))).invoke(11) (((s))) invoke 11 - (((s))) + (((s))) } inline fun propagation(s: (p: Int) -> Unit) { inlineFunWithInvoke((label@ s)) inlineFunWithInvoke((label2@ label@ s)) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inline/property/propertyWithBackingField.kt b/compiler/testData/diagnostics/tests/inline/property/propertyWithBackingField.kt index dd07b222fc8..bf9fee39bb3 100644 --- a/compiler/testData/diagnostics/tests/inline/property/propertyWithBackingField.kt +++ b/compiler/testData/diagnostics/tests/inline/property/propertyWithBackingField.kt @@ -16,7 +16,7 @@ open class A { inline var z2 = 1 var z2_1 = 1 - inline set(p: Int) {} + inline set(p: Int) {} inline val z by Delegate() } diff --git a/compiler/testData/diagnostics/tests/inline/property/virtualProperty.kt b/compiler/testData/diagnostics/tests/inline/property/virtualProperty.kt index df38cbf5ea8..4789da733c2 100644 --- a/compiler/testData/diagnostics/tests/inline/property/virtualProperty.kt +++ b/compiler/testData/diagnostics/tests/inline/property/virtualProperty.kt @@ -7,11 +7,11 @@ final class FinalProperty { inline var varProp: Int get() = 1 - set(p: Int) {} + set(p: Int) {} var varProp_2: Int get() = 1 - inline set(p: Int) {} + inline set(p: Int) {} } @@ -24,11 +24,11 @@ open class OpenProperty { inline open var varProp: Int get() = 1 - set(p: Int) {} + set(p: Int) {} open var varProp_2: Int get() = 1 - inline set(p: Int) {} + inline set(p: Int) {} } diff --git a/compiler/testData/diagnostics/tests/inline/protectedCallDepecation.kt b/compiler/testData/diagnostics/tests/inline/protectedCallDepecation.kt index ac79595a9a4..6db2baf2f2e 100644 --- a/compiler/testData/diagnostics/tests/inline/protectedCallDepecation.kt +++ b/compiler/testData/diagnostics/tests/inline/protectedCallDepecation.kt @@ -15,7 +15,7 @@ open class A { protected val z: String = "1" public var zVar: String = "1" - protected set(value) {} + protected set(value) {} inline fun call() { test() @@ -78,7 +78,7 @@ internal class AInternal { protected val z: String = "1" public var zVar: String = "1" - protected set(value) {} + protected set(value) {} inline fun call() { @@ -99,4 +99,4 @@ private class X { } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inline/protectedCallError.kt b/compiler/testData/diagnostics/tests/inline/protectedCallError.kt index 04aefe9d4bf..52bf6b69eaa 100644 --- a/compiler/testData/diagnostics/tests/inline/protectedCallError.kt +++ b/compiler/testData/diagnostics/tests/inline/protectedCallError.kt @@ -15,7 +15,7 @@ open class A { protected val z: String = "1" public var zVar: String = "1" - protected set(value) {} + protected set(value) {} inline fun call() { test() @@ -78,7 +78,7 @@ internal class AInternal { protected val z: String = "1" public var zVar: String = "1" - protected set(value) {} + protected set(value) {} inline fun call() { @@ -99,4 +99,4 @@ private class X { } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt b/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt index 02f7b85ffd2..ba28cd7abd9 100644 --- a/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt +++ b/compiler/testData/diagnostics/tests/inline/publishedApi.fir.kt @@ -2,7 +2,7 @@ inline fun call(a: A) { a.test() publishedTopLevel() - + a.publishedVar a.publishedVar = 1 diff --git a/compiler/testData/diagnostics/tests/inline/publishedApi.kt b/compiler/testData/diagnostics/tests/inline/publishedApi.kt index bb08464c881..80f67ef56fa 100644 --- a/compiler/testData/diagnostics/tests/inline/publishedApi.kt +++ b/compiler/testData/diagnostics/tests/inline/publishedApi.kt @@ -2,7 +2,7 @@ inline fun call(a: A) { a.test() publishedTopLevel() - + a.publishedVar a.publishedVar = 1 @@ -23,7 +23,7 @@ inline var inlineVar: Int publishedVarTopLevel = 1 return 1 } - set(value) { + set(value) { val a = A() a.test() publishedTopLevel() @@ -88,7 +88,7 @@ internal class A { return 1 } - set(value) { + set(value) { publicFun() internalFun() privateFun() @@ -147,7 +147,7 @@ inline internal var publishedVarTopLevel: Int return 1 } - set(value) { + set(value) { publicFun() internalFun() privateFun() diff --git a/compiler/testData/diagnostics/tests/inline/sam.kt b/compiler/testData/diagnostics/tests/inline/sam.kt index 39b4fbc83a3..c8829745bef 100644 --- a/compiler/testData/diagnostics/tests/inline/sam.kt +++ b/compiler/testData/diagnostics/tests/inline/sam.kt @@ -22,8 +22,8 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) { 11.ext(11) 11 ext 11 - s - ext + s + ext 11 } } @@ -37,8 +37,8 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.( 11.ext(11) 11 ext 11 - s - ext + s + ext 11 } @@ -51,8 +51,8 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.( this invoke 11 this(11) - this + this 11 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.fir.kt b/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.fir.kt deleted file mode 100644 index 9e9d3cf80ab..00000000000 --- a/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -package test - -class B { - class B { - fun foo(b: B.C) { - } - class C { - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.kt b/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.kt index 6c9e33d1f0a..c7f4e786e52 100644 --- a/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.kt +++ b/compiler/testData/diagnostics/tests/inner/InnerClassNameClash.kt @@ -1,10 +1,11 @@ +// FIR_IDENTICAL package test class B { class B { - fun foo(b: B.C) { + fun foo(b: B.C) { } class C { } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.fir.kt b/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.fir.kt deleted file mode 100644 index a062b91dc38..00000000000 --- a/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -package f - -object A { - class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") - }) -} - -class B { - companion object { - class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") - }) - } - - class C { - class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") - }) - } -} - -open class Request(private val handler: ActionContext.() -> Unit) {} - -interface ActionContext { - val session : Map -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.kt b/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.kt index 556cf1985ee..26cca9a1ec7 100644 --- a/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.kt +++ b/compiler/testData/diagnostics/tests/inner/extensionLambdaInsideNestedClass.kt @@ -1,21 +1,22 @@ +// FIR_IDENTICAL package f object A { class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") + val failed = session.get("LOGIN_FAILED") }) } class B { companion object { class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") + val failed = session.get("LOGIN_FAILED") }) } class C { class LoginFormPage() : Request({ - val failed = session.get("LOGIN_FAILED") + val failed = session.get("LOGIN_FAILED") }) } } @@ -24,4 +25,4 @@ open class Request(private val handler: ActionContext.() -> Unit) {} interface ActionContext { val session : Map -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.fir.kt b/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.fir.kt deleted file mode 100644 index c4f1408564d..00000000000 --- a/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -class Test { - companion object { - fun test(t: TestInner) = 42 - } - - class TestStatic { - fun test(t: TestInner) = 42 - } - - inner class TestInner -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.kt b/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.kt index 6b059b2cfc2..25f2282e2fd 100644 --- a/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.kt +++ b/compiler/testData/diagnostics/tests/inner/innerClassesInStaticParameters.kt @@ -1,11 +1,12 @@ +// FIR_IDENTICAL class Test { companion object { - fun test(t: TestInner) = 42 + fun test(t: TestInner) = 42 } class TestStatic { - fun test(t: TestInner) = 42 + fun test(t: TestInner) = 42 } inner class TestInner -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt index 51d1731ff46..a0cbcb9abb3 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt @@ -12,7 +12,7 @@ class Test { fun more(): InnerClass { val b = InnerClass() - val testVal = inClass + val testVal = inClass foo() return b diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt index bb960cc2405..6f98c853c17 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt @@ -12,7 +12,7 @@ class Test { fun more(): InnerClass { val b = InnerClass() - val testVal = inClass + val testVal = inClass foo() return b diff --git a/compiler/testData/diagnostics/tests/inner/localThisSuper.fir.kt b/compiler/testData/diagnostics/tests/inner/localThisSuper.fir.kt deleted file mode 100644 index 2f39d731118..00000000000 --- a/compiler/testData/diagnostics/tests/inner/localThisSuper.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -interface Trait { - fun bar() = 42 -} - -class Outer : Trait { - fun foo() { - val t = this@Outer - val s = super@Outer.bar() - - class Local : Trait { - val t = this@Outer - val s = super@Outer.bar() - - inner class Inner { - val t = this@Local - val s = super@Local.bar() - - val tt = this@Outer - val ss = super@Outer.bar() - } - } - } -} diff --git a/compiler/testData/diagnostics/tests/inner/localThisSuper.kt b/compiler/testData/diagnostics/tests/inner/localThisSuper.kt index ecc13ab9fa8..9f5140ca5c7 100644 --- a/compiler/testData/diagnostics/tests/inner/localThisSuper.kt +++ b/compiler/testData/diagnostics/tests/inner/localThisSuper.kt @@ -1,20 +1,21 @@ +// FIR_IDENTICAL interface Trait { fun bar() = 42 } class Outer : Trait { fun foo() { - val t = this@Outer - val s = super@Outer.bar() - + val t = this@Outer + val s = super@Outer.bar() + class Local : Trait { val t = this@Outer val s = super@Outer.bar() - + inner class Inner { val t = this@Local val s = super@Local.bar() - + val tt = this@Outer val ss = super@Outer.bar() } diff --git a/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.kt b/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.kt index f21ddf85566..ac418c77d4c 100644 --- a/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.kt +++ b/compiler/testData/diagnostics/tests/j+k/accessClassObjectFromJava.kt @@ -2,9 +2,9 @@ class Foo { companion object { val bar = 1 - fun test(a: Foo.`object`) { + fun test(a: Foo.`object`) { } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/ambiguousSamAdapters.kt b/compiler/testData/diagnostics/tests/j+k/ambiguousSamAdapters.kt index 55e229f2b00..4a03ebed2b7 100644 --- a/compiler/testData/diagnostics/tests/j+k/ambiguousSamAdapters.kt +++ b/compiler/testData/diagnostics/tests/j+k/ambiguousSamAdapters.kt @@ -13,5 +13,5 @@ public class A { fun main() { A.foo { "Hello!" } - A.foo(Runnable { "Hello!" }) -} \ No newline at end of file + A.foo(Runnable { "Hello!" }) +} diff --git a/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.fir.kt b/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.fir.kt deleted file mode 100644 index f999e6b8e83..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// FILE: Super.java -public class Super { - void foo(Runnable r) { - } -} - -// FILE: Sub.kt -class Sub() : Super() { - fun foo(r : (() -> Unit)?) { - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.kt b/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.kt index be5480508d4..fd68ac1f00b 100644 --- a/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.kt +++ b/compiler/testData/diagnostics/tests/j+k/canDeclareIfSamAdapterIsInherited.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: Super.java public class Super { void foo(Runnable r) { @@ -6,6 +7,6 @@ public class Super { // FILE: Sub.kt class Sub() : Super() { - fun foo(r : (() -> Unit)?) { + fun foo(r : (() -> Unit)?) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt index 151342d0422..39691f4ef20 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt @@ -12,6 +12,6 @@ fun test(x: List, y: List) { A("", x) checkType { _>() } A("", y) checkType { _>() } - A("", x) + A("", x) A("", y) } diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt index b63c804e0cc..e31b2bb5152 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt @@ -14,5 +14,5 @@ fun test(x: List, y: List) { Outer().Inner("", y, 1) checkType { _.Inner>() } Outer().Inner("", x, 1) checkType { _.Inner>() } - Outer().Inner("", x, 1) + Outer().Inner("", x, 1) } diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt index fb1b0079501..5e3b91186d8 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/noClassTypeParametersInvParameter.kt @@ -13,9 +13,9 @@ fun test(x: Inv, y: Inv) { A("", x) A("", y) - A("", x) + A("", x) - A("", x) + A("", x) A("", y) A("", y) } diff --git a/compiler/testData/diagnostics/tests/j+k/innerNestedClassFromJava.kt b/compiler/testData/diagnostics/tests/j+k/innerNestedClassFromJava.kt index d7554c04d75..923172be7ef 100644 --- a/compiler/testData/diagnostics/tests/j+k/innerNestedClassFromJava.kt +++ b/compiler/testData/diagnostics/tests/j+k/innerNestedClassFromJava.kt @@ -23,10 +23,9 @@ public class M { package b fun f() { - val c1: a.M.Inner - val c2: a.M.Nested - val c3: a.M.PrInner - val c4: a.M.PrNested + val c1: a.M.Inner + val c2: a.M.Nested + val c3: a.M.PrInner + val c4: a.M.PrNested } - diff --git a/compiler/testData/diagnostics/tests/j+k/kt2606.kt b/compiler/testData/diagnostics/tests/j+k/kt2606.kt index 921dc189393..4ec58443fd6 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt2606.kt +++ b/compiler/testData/diagnostics/tests/j+k/kt2606.kt @@ -5,7 +5,7 @@ import java.util.* import java.lang.annotation.* fun bar() : Iterator? { - val i : Iterable<Integer> - val a : Annotation + val i : Iterable<Integer> + val a : Annotation return null -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/kt2619.kt b/compiler/testData/diagnostics/tests/j+k/kt2619.kt index 914f001fbfb..92feeff2333 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt2619.kt +++ b/compiler/testData/diagnostics/tests/j+k/kt2619.kt @@ -1,7 +1,7 @@ //FILE: foo.kt fun main() { val c: Type - when (c) { + when (c) { } } @@ -12,4 +12,4 @@ fun main() { public enum Type { TYPE, NO_TYPE; -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/kt2641.kt b/compiler/testData/diagnostics/tests/j+k/kt2641.kt index c2f999dd1de..b16912b65dd 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt2641.kt +++ b/compiler/testData/diagnostics/tests/j+k/kt2641.kt @@ -8,9 +8,9 @@ import java.lang.Comparable as Comp import checkSubtype fun bar(any: Any): java.lang.Iterable? { - val a: java.lang.Comparable? = null - val b: Iterable<Integer> - val c : Iterator? = null + val a: java.lang.Comparable? = null + val b: Iterable<Integer> + val c : Iterator? = null if (any is Iterator<*>) { checkSubtype<Iterator<*>>(any) diff --git a/compiler/testData/diagnostics/tests/j+k/kt2890.fir.kt b/compiler/testData/diagnostics/tests/j+k/kt2890.fir.kt deleted file mode 100644 index c8d0830ef06..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/kt2890.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -//FILE:_03_collections/CollectionTest.java -package _03_collections; - -import java.util.List; - -public class CollectionTest { - public static void add(List ints) { - ints.add(5); - } -} - -//FILE:n.kt -package _03_collections - -import java.util.ArrayList - -fun test() { - val c = CollectionTest() - CollectionTest.add(ArrayList()) -} diff --git a/compiler/testData/diagnostics/tests/j+k/kt2890.kt b/compiler/testData/diagnostics/tests/j+k/kt2890.kt index 896834b93ce..701db2167a0 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt2890.kt +++ b/compiler/testData/diagnostics/tests/j+k/kt2890.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //FILE:_03_collections/CollectionTest.java package _03_collections; @@ -15,6 +16,6 @@ package _03_collections import java.util.ArrayList fun test() { - val c = CollectionTest() + val c = CollectionTest() CollectionTest.add(ArrayList()) } diff --git a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt index 668a31570fa..ba1e8518705 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt @@ -18,11 +18,11 @@ public interface J2 extends J { fun main() { J { s: String -> s} // should be prohibited, because SAM value parameter has nullable type J { "" + it.length } - J { null } - J { it?.length?.toString() } + J { null } + J { it?.length?.toString() } J2 { s: String -> s} J2 { "" + it.length } - J2 { null } - J2 { it?.length?.toString() } + J2 { null } + J2 { it?.length?.toString() } } diff --git a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/genericInReturnType.kt index c4c1b925342..9b13f34945a 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/j+k/samByProjectedType/noAdapterBecuaseOfRecursiveUpperBound.kt b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/noAdapterBecuaseOfRecursiveUpperBound.kt index 8ae8eaaa41f..13c1030d12f 100644 --- a/compiler/testData/diagnostics/tests/j+k/samByProjectedType/noAdapterBecuaseOfRecursiveUpperBound.kt +++ b/compiler/testData/diagnostics/tests/j+k/samByProjectedType/noAdapterBecuaseOfRecursiveUpperBound.kt @@ -16,12 +16,12 @@ public class A { // FILE: main.kt fun main() { A().foo { - x -> + x -> "" } A.bar { - x -> + x -> "" } } diff --git a/compiler/testData/diagnostics/tests/javac/qualifiedExpression/visibleClassVsQualifiedClass.kt b/compiler/testData/diagnostics/tests/javac/qualifiedExpression/visibleClassVsQualifiedClass.kt index 80b970a1f3f..f96c2754485 100644 --- a/compiler/testData/diagnostics/tests/javac/qualifiedExpression/visibleClassVsQualifiedClass.kt +++ b/compiler/testData/diagnostics/tests/javac/qualifiedExpression/visibleClassVsQualifiedClass.kt @@ -19,8 +19,8 @@ package other class a {} -fun test(a_: a.b) { - val a_2 = a.b() +fun test(a_: a.b) { + val a_2 = a.b() } //FILE: c2.kt diff --git a/compiler/testData/diagnostics/tests/kt34440.kt b/compiler/testData/diagnostics/tests/kt34440.kt index bc4e307b475..99e4caf5052 100644 --- a/compiler/testData/diagnostics/tests/kt34440.kt +++ b/compiler/testData/diagnostics/tests/kt34440.kt @@ -2,7 +2,7 @@ class BufferUtil { fun isDirect(cond: Boolean): Boolean = - when (cond) { + when (cond) { else -> throw Exception("${buf.}") } private class BufferInfo(private val type: Class<*>) diff --git a/compiler/testData/diagnostics/tests/labels/automaticLabelFromInfixOperator.kt b/compiler/testData/diagnostics/tests/labels/automaticLabelFromInfixOperator.kt index 00a6f519178..ee2b29386c5 100644 --- a/compiler/testData/diagnostics/tests/labels/automaticLabelFromInfixOperator.kt +++ b/compiler/testData/diagnostics/tests/labels/automaticLabelFromInfixOperator.kt @@ -14,4 +14,4 @@ fun myMap(x: List): Int { return 0 } -infix fun List.myMap(x: () -> Unit) {} \ No newline at end of file +infix fun List.myMap(x: () -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/labels/kt361.kt b/compiler/testData/diagnostics/tests/labels/kt361.kt index 89911d335f2..f6025937086 100644 --- a/compiler/testData/diagnostics/tests/labels/kt361.kt +++ b/compiler/testData/diagnostics/tests/labels/kt361.kt @@ -1,5 +1,5 @@ fun nonlocals(b : Boolean) { - a@{ + a@{ fun foo() { if (b) { return@a 1 // The label must be resolved, but an error should be reported for a non-local return @@ -7,5 +7,5 @@ fun nonlocals(b : Boolean) { } return@a 5 - } -} \ No newline at end of file + } +} diff --git a/compiler/testData/diagnostics/tests/labels/kt3988.fir.kt b/compiler/testData/diagnostics/tests/labels/kt3988.fir.kt deleted file mode 100644 index 07dbf238721..00000000000 --- a/compiler/testData/diagnostics/tests/labels/kt3988.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -//KT-3988 This@label for outer function not resolved - -class Comment() { - var article = "" - -} -class Comment2() { - var article2 = "" -} - -fun new(body: Comment.() -> Unit) = body - -fun new2(body: Comment2.() -> Unit) = body - -fun main() { - new { - new2 { - this@new //UNRESOLVED REFERENCE - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/labels/kt3988.kt b/compiler/testData/diagnostics/tests/labels/kt3988.kt index ce75c164f3a..d21c4d407ea 100644 --- a/compiler/testData/diagnostics/tests/labels/kt3988.kt +++ b/compiler/testData/diagnostics/tests/labels/kt3988.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-3988 This@label for outer function not resolved class Comment() { @@ -15,7 +16,7 @@ fun new2(body: Comment2.() -> Unit) = body fun main() { new { new2 { - this@new //UNRESOLVED REFERENCE + this@new //UNRESOLVED REFERENCE } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/labels/kt591.kt b/compiler/testData/diagnostics/tests/labels/kt591.kt index 60be9fe4960..c9950d7318f 100644 --- a/compiler/testData/diagnostics/tests/labels/kt591.kt +++ b/compiler/testData/diagnostics/tests/labels/kt591.kt @@ -1,11 +1,11 @@ //KT-591 Unresolved label in valid code fun test() { - val a: (Int?).() -> Unit = a@{ + val a: (Int?).() -> Unit = a@{ if (this != null) { - val b: String.() -> Unit = { + val b: String.() -> Unit = { this@a.times(5) // a@ Unresolved } } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt b/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt index 1433d5dd18b..9e4e1444cac 100644 --- a/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt +++ b/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt @@ -14,7 +14,7 @@ fun foo(a: Any?): Int { var b = 1 - (@ b) = 2 + (@ b) = 2 return@ 1 } @@ -33,4 +33,4 @@ class B : A() { fun bar(f: () -> Unit) = f fun test() { bar @{} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability.kt b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability.kt index 07b6a1d4aa4..9eb08172214 100644 --- a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability.kt +++ b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability.kt @@ -20,7 +20,7 @@ public abstract class A(la private set fun a() { - lateinit var a: String + lateinit var a: String } lateinit var e1: V diff --git a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt index 37967b3d33f..790bb891756 100644 --- a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt +++ b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt @@ -20,7 +20,7 @@ public abstract class A(la private set fun a() { - lateinit var a: String + lateinit var a: String } lateinit var e1: V diff --git a/compiler/testData/diagnostics/tests/library/Collections.kt b/compiler/testData/diagnostics/tests/library/Collections.kt index fe7dd330ad2..a34229efccd 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.kt @@ -5,10 +5,10 @@ fun testCollection(c: Collection, t: T) { c.size c.isEmpty() c.contains(1) - val iterator: Iterator = c.iterator() + 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) @@ -21,11 +21,11 @@ fun testMutableCollection(c: MutableCollection, t: T) { c.size c.isEmpty() c.contains(1) - val iterator: Iterator = c.iterator() + val iterator: Iterator = c.iterator() c.containsAll(c) - val mutableIterator: MutableIterator = c.iterator() + val mutableIterator: MutableIterator = c.iterator() c.add(t) c.remove(1 as T) c.addAll(c) @@ -34,39 +34,39 @@ fun testMutableCollection(c: MutableCollection, t: T) { c.clear() } -fun testList(l: List, t: T) { +fun testList(l: List, t: T) { val t: T = l.get(1) - val i: Int = l.indexOf(t) - val i1: Int = l.lastIndexOf(t) - val listIterator: ListIterator = l.listIterator() - val listIterator1: ListIterator = l.listIterator(1) - val list: List = l.subList(1, 2) + val i: Int = l.indexOf(t) + val i1: Int = l.lastIndexOf(t) + val listIterator: ListIterator = l.listIterator() + val listIterator1: ListIterator = l.listIterator(1) + val list: List = l.subList(1, 2) - val value: T = l.set(1, 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) { - val value: T = l.set(1, t) + val value: T = l.set(1, t) l.add(1, t) l.removeAt(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 testSet(s: Set, t: T) { s.size s.isEmpty() s.contains(1) - val iterator: Iterator = s.iterator() + 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) @@ -79,11 +79,11 @@ fun testMutableSet(s: MutableSet, t: T) { s.size s.isEmpty() s.contains(1) - val iterator: Iterator = s.iterator() + val iterator: Iterator = s.iterator() s.containsAll(s) - val mutableIterator: MutableIterator = s.iterator() + val mutableIterator: MutableIterator = s.iterator() s.add(t) s.remove(1 as T) s.addAll(s) @@ -93,19 +93,19 @@ fun testMutableSet(s: MutableSet, t: T) { } fun testMap(m: Map) { - val set: Set = m.keys - val collection: Collection = m.values - val set1: Set> = m.entries + val set: Set = m.keys + 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) { - 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 array(vararg t: T): Array {} +fun array(vararg t: T): Array {} diff --git a/compiler/testData/diagnostics/tests/library/kt828.fir.kt b/compiler/testData/diagnostics/tests/library/kt828.fir.kt deleted file mode 100644 index f08475a80eb..00000000000 --- a/compiler/testData/diagnostics/tests/library/kt828.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun test() { - var res : Boolean = true - res = (res and false) - res = (res or false) - res = (res xor false) - res = (true and false) - res = (true or false) - res = (true xor false) - res = (!true) - res = (true && false) - res = (true || false) -} diff --git a/compiler/testData/diagnostics/tests/library/kt828.kt b/compiler/testData/diagnostics/tests/library/kt828.kt index 366b7b454b2..59cc921a9b2 100644 --- a/compiler/testData/diagnostics/tests/library/kt828.kt +++ b/compiler/testData/diagnostics/tests/library/kt828.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL fun test() { var res : Boolean = true res = (res and false) res = (res or false) - res = (res xor false) - res = (true and false) - res = (true or false) - res = (true xor false) - res = (!true) - res = (true && false) - res = (true || false) + res = (res xor false) + res = (true and false) + res = (true or false) + res = (true xor false) + res = (!true) + res = (true && false) + res = (true || false) } diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt index 4b5c2de73fd..6970c7d31cf 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt @@ -18,7 +18,7 @@ class FinalClass() { val i: Int = 1 open get(): Int = field var j: Int = 1 - open set(v: Int) {} + open set(v: Int) {} } private public class C @@ -28,7 +28,7 @@ class FinalClass() { annotation class annotated(val text: String = "not given") //Check legal modifiers in constructor -class LegalModifier(val a: Int, @annotated private var b: String, @annotated vararg v: Int) +class LegalModifier(val a: Int, @annotated private var b: String, @annotated vararg v: Int) //Check illegal modifier in constructor parameters class IllegalModifiers1( @@ -38,17 +38,17 @@ class IllegalModifiers1( enum private const - a: Int) + a: Int) //Check multiple illegal modifiers in constructor -class IllegalModifiers2(private abstract a: Int) +class IllegalModifiers2(private abstract a: Int) //Check annotations with illegal modifiers in constructor -class IllegalModifiers3(@annotated public abstract b: String) +class IllegalModifiers3(@annotated public abstract b: String) //Check annotations and vararg with illegal modifiers in constructor -class IllegalModifiers4(val a: Int, @annotated("a text") protected vararg v: Int) +class IllegalModifiers4(val a: Int, @annotated("a text") protected vararg v: Int) //Check illegal modifiers for functions and catch block abstract class IllegalModifiers5() { @@ -132,12 +132,12 @@ class IllegalModifiers8 { const constructor() {} - constructor(private enum abstract x: Int) {} + constructor(private enum abstract x: Int) {} } class IllegalModifiers9 { private protected constructor() {} - private internal constructor(x: Int) {} + private internal constructor(x: Int) {} } // Illegal modifiers on primary constructor diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/actualClassWithDifferentConstructors.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/actualClassWithDifferentConstructors.kt index df38f6c97b5..6e818d57d8c 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/actualClassWithDifferentConstructors.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/actualClassWithDifferentConstructors.kt @@ -31,11 +31,11 @@ public class JavaBar { // FILE: jvm.kt actual class Foo1(val s: String) -actual class Foo2(val p: String = "value", i: Int) +actual class Foo2(val p: String = "value", i: Int) actual typealias Foo3 = JavaFoo actual class Bar1(val s: String) -actual class Bar2(val p: String = "value", i: Int) +actual class Bar2(val p: String = "value", i: Int) actual typealias Bar3 = JavaBar actual class Bar4(val s: String) { constructor() : this("") @@ -43,7 +43,7 @@ actual class Bar4(val s: String) { actual class Bar5 { actual constructor() - constructor(s: String) + constructor(s: String) } class Bar6 { diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt index a05e9452615..a29e5ec526e 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt @@ -18,13 +18,13 @@ expect interface C10 // FILE: jvm.kt actual typealias C1 = String -actual typealias C2<A> = List +actual typealias C2 = List actual typealias C3 = List actual typealias C4 = MutableMap actual typealias C5 = MutableMap actual typealias C6 = MutableList actual typealias C7 = MutableList -actual typealias C8<J> = MutableList<*> +actual typealias C8 = MutableList<*> actual typealias C9 = MutableList typealias Tmp = MutableList diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt index e76995f34bd..7b39488f4b8 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt @@ -6,11 +6,11 @@ expect class Foo( constructorParameter: String ) { init { - "no" + "no" } constructor(s: String) { - "no" + "no" } constructor() : this("no") @@ -19,7 +19,7 @@ expect class Foo( var getSet: String get() = "no" - set(value) {} + set(value) {} fun functionWithBody(x: Int): Int { return x + 1 diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.kt index 872e1f42958..74f469447a6 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.kt @@ -21,7 +21,7 @@ expect class Foo { get() = "no" var customAccessorVar: String get() = "no" - set(value) {} + set(value) {} lateinit var lateinitVar: String diff --git a/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt b/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt index 28d5e9b7552..4cc83cae292 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt @@ -15,7 +15,7 @@ class Outer expect constructor() { fun foo() { expect fun localFun() - expect var x = 42 + expect var x = 42 expect class Bar } @@ -30,6 +30,6 @@ class Outer actual constructor() { fun foo() { actual fun localFun() {} - actual var x = 42 + actual var x = 42 actual class Bar } diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt index 4690a3f3abe..e73e201c4b4 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt @@ -24,7 +24,7 @@ expect val customAccessorVal: String get() = "no" expect var customAccessorVar: String get() = "no" - set(value) {} + set(value) {} expect const val constVal: Int diff --git a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt index f7645e90124..55c8734c07e 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt @@ -1,7 +1,7 @@ -fun foo(a : Int = 1, b : String = "abc") { +fun foo(a : Int = 1, b : String = "abc") { } -fun bar(x : Int = 1, y : Int = 1, z : String) { +fun bar(x : Int = 1, y : Int = 1, z : String) { } fun test() { @@ -24,4 +24,4 @@ fun test() { bar(1, zz = "", zz.foo ) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt index 211ce6449e1..1500e1a030a 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/AssertNotNull.kt @@ -34,6 +34,6 @@ fun main() { } } - val f : String = a!! + val f : String = a!! checkSubtype(a!!) } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt index 8762c3ab6f7..65fc2ab06c0 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt @@ -1,12 +1,12 @@ // !WITH_NEW_INFERENCE class A() { - operator infix fun plus(i : Int) {} + operator infix fun plus(i : Int) {} operator fun unaryMinus() {} - operator infix fun contains(a : Any?) : Boolean = true + operator infix fun contains(a : Any?) : Boolean = true } -operator infix fun A.div(i : Int) {} -operator infix fun A?.times(i : Int) {} +operator infix fun A.div(i : Int) {} +operator infix fun A?.times(i : Int) {} fun test(x : Int?, a : A?) { x.plus(1) diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/funcLiteralArgsInsideUnresolvedFunction.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/funcLiteralArgsInsideUnresolvedFunction.kt index d9e145bc47b..0b6bb6b791c 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/funcLiteralArgsInsideUnresolvedFunction.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/funcLiteralArgsInsideUnresolvedFunction.kt @@ -4,7 +4,7 @@ fun foo() { val i : Int? = 42 if (i != null) { doSmth { - val x = i + 1 + val x = i + 1 } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt deleted file mode 100644 index cbea5e11219..00000000000 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -//KT-2125 Inconsistent error message on UNSAFE_CALL - -package e - -fun main() { - val compareTo = 1 - val s: String? = null - s.compareTo("") - - val bar = 2 - s.bar() -} diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.kt index e6c213ce9fe..77c63d16a79 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL //KT-2125 Inconsistent error message on UNSAFE_CALL package e fun main() { - val compareTo = 1 + val compareTo = 1 val s: String? = null s.compareTo("") - val bar = 2 + val bar = 2 s.bar() } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2234.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2234.kt index 7b6df9dde68..e01f72f2b7b 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2234.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2234.kt @@ -18,8 +18,8 @@ fun main() { fun foo() { val x : Int? = 3 if (x != null) { - val u = checkSubtype(x!!) + val u = checkSubtype(x!!) val y = checkSubtype(x) - val z : Int = y + val z : Int = y } } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt index 0e6ad442ad7..d492e1a1224 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt @@ -6,7 +6,7 @@ package kt244 fun f(s: String?) { if (s != null) { s.length //ok - var i = s.length //error: Only safe calls are allowed on a nullable receiver + var i = s.length //error: Only safe calls are allowed on a nullable receiver System.out.println(s.length) //error } } @@ -16,7 +16,7 @@ class A(a: String?) { val b = if (a != null) a.length else 1 init { if (a != null) { - val c = a.length + val c = a.length } } diff --git a/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt b/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt index 16d11045916..2963bb3245d 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt @@ -1,13 +1,13 @@ fun nonMisleadingNullable( - nn: NN?, - nnn: NNN? + nn: NN?, + nnn: NNN? ) {} fun misleadingNullableSimple( - t: T?, - t2: T?, - n: N?, - ind: INDIRECT? + t: T?, + t2: T?, + n: N?, + ind: INDIRECT? ) {} -fun interactionWithRedundant(t: T??) {} \ No newline at end of file +fun interactionWithRedundant(t: T??) {} diff --git a/compiler/testData/diagnostics/tests/nullableTypes/redundantNullable.kt b/compiler/testData/diagnostics/tests/nullableTypes/redundantNullable.kt index cf75b008b94..b613a783b5c 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/redundantNullable.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/redundantNullable.kt @@ -1,9 +1,9 @@ class Generic fun redundantNullable( - i: Int??, - three: Int???, - gOut: Generic??, - gIn: Generic?> + i: Int??, + three: Int???, + gOut: Generic??, + gIn: Generic?> ) { -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/numbers/doublesInSimpleConstraints.kt b/compiler/testData/diagnostics/tests/numbers/doublesInSimpleConstraints.kt index aa00626fded..1502aa288b7 100644 --- a/compiler/testData/diagnostics/tests/numbers/doublesInSimpleConstraints.kt +++ b/compiler/testData/diagnostics/tests/numbers/doublesInSimpleConstraints.kt @@ -7,10 +7,10 @@ import checkSubtype fun id(t: T): T = t -fun either(t1: T, t2: T): T = t1 +fun either(t1: T, t2: T): T = t1 fun test() { - val a: Float = id(2.0.toFloat()) + val a: Float = id(2.0.toFloat()) val b = id(2.0) checkSubtype(b) @@ -21,5 +21,5 @@ fun test() { val d = either(11, 2.3) checkSubtype(d) - val e: Float = id(1) + val e: Float = id(1) } diff --git a/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.kt b/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.kt index 121c51f3363..44ca2aa9717 100644 --- a/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.kt +++ b/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.kt @@ -6,12 +6,12 @@ fun foo(i: Int) = i fun bar(l: Long) = l fun main() { - val i = 111111111111111777777777777777 + val i = 111111111111111777777777777777 //todo add diagnostic text messages //report only 'The value is out of range' //not 'An integer literal does not conform to the expected type Int/Long' - val l: Long = 1111111111111117777777777777777 + val l: Long = 1111111111111117777777777777777 foo(11111111111111177777777777777) bar(11111111111111177777777777777) } diff --git a/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.kt b/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.kt index 92d54db7d5c..49ea728d052 100644 --- a/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.kt +++ b/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.kt @@ -8,11 +8,11 @@ import checkSubtype fun id(t: T): T = t -fun either(t1: T, t2: T): T = t1 +fun either(t1: T, t2: T): T = t1 -fun other(s: String) {} +fun other(s: String) {} -fun otherGeneric(l: List) {} +fun otherGeneric(l: List) {} fun test() { val a: Byte = id(1) diff --git a/compiler/testData/diagnostics/tests/objects/Objects.kt b/compiler/testData/diagnostics/tests/objects/Objects.kt index 67f9e21d0ac..89814c40002 100644 --- a/compiler/testData/diagnostics/tests/objects/Objects.kt +++ b/compiler/testData/diagnostics/tests/objects/Objects.kt @@ -1,6 +1,6 @@ package toplevelObjectDeclarations - open class Foo(y : Int) { + open class Foo(y : Int) { open fun foo() : Int = 1 } @@ -26,4 +26,4 @@ package toplevelObjectDeclarations override fun foo() : Int = 1 } - val z = y.foo() \ No newline at end of file + val z = y.foo() diff --git a/compiler/testData/diagnostics/tests/objects/kt2240.fir.kt b/compiler/testData/diagnostics/tests/objects/kt2240.fir.kt deleted file mode 100644 index dc03783e2fc..00000000000 --- a/compiler/testData/diagnostics/tests/objects/kt2240.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -package a - -//KT-2240 Wrong overload resolution ambiguity when object literal is involved - -class A {} - -fun A.foo(f : T) {} - -val o = object { - fun foo(f: T) { - A().foo(f) // Ambiguity here! - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt2240.kt b/compiler/testData/diagnostics/tests/objects/kt2240.kt index 25ee044736b..f0096cbca12 100644 --- a/compiler/testData/diagnostics/tests/objects/kt2240.kt +++ b/compiler/testData/diagnostics/tests/objects/kt2240.kt @@ -1,13 +1,14 @@ +// FIR_IDENTICAL package a //KT-2240 Wrong overload resolution ambiguity when object literal is involved class A {} -fun A.foo(f : T) {} +fun A.foo(f : T) {} val o = object { fun foo(f: T) { A().foo(f) // Ambiguity here! } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.kt index 94d57e3294a..4b4a9d81557 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.kt @@ -5,7 +5,7 @@ class MyInt(val i: Int) { operator fun plus(m: MyInt) : MyInt = MyInt(m.i + i) } -operator fun Any.plusAssign(a: Any) {} +operator fun Any.plusAssign(a: Any) {} fun test(m: MyInt) { m += m @@ -13,5 +13,3 @@ fun test(m: MyInt) { var i = 1 i += 34 } - - diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.fir.kt deleted file mode 100644 index 6f1790ed0d8..00000000000 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.fir.kt +++ /dev/null @@ -1,40 +0,0 @@ -class A { - operator fun plusAssign(x: Int) {} - operator fun minusAssign(x: Int) {} - operator fun timesAssign(x: Int) {} - operator fun divAssign(x: Int) {} - operator fun remAssign(x: Int) {} -} - -fun testVal() { - val a = A() - a += 1 - a -= 1 - a *= 1 - a /= 1 - a %= 1 -} - -fun testExpr() { - A() += 1 - A() -= 1 - A() *= 1 - A() /= 1 - A() %= 1 -} - -class B { - operator fun plus(x: Int): B = B() - operator fun minus(x: Int): B = B() - operator fun times(x: Int): B = B() - operator fun div(x: Int): B = B() - operator fun rem(x: Int): B = B() -} - -fun testWrong() { - B() += 1 - B() -= 1 - B() *= 1 - B() /= 1 - B() %= 1 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.kt index cce99f1021f..32505f527dd 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignmentOperations.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL class A { - operator fun plusAssign(x: Int) {} - operator fun minusAssign(x: Int) {} - operator fun timesAssign(x: Int) {} - operator fun divAssign(x: Int) {} - operator fun remAssign(x: Int) {} + operator fun plusAssign(x: Int) {} + operator fun minusAssign(x: Int) {} + operator fun timesAssign(x: Int) {} + operator fun divAssign(x: Int) {} + operator fun remAssign(x: Int) {} } fun testVal() { @@ -24,11 +25,11 @@ fun testExpr() { } class B { - operator fun plus(x: Int): B = B() - operator fun minus(x: Int): B = B() - operator fun times(x: Int): B = B() - operator fun div(x: Int): B = B() - operator fun rem(x: Int): B = B() + operator fun plus(x: Int): B = B() + operator fun minus(x: Int): B = B() + operator fun times(x: Int): B = B() + operator fun div(x: Int): B = B() + operator fun rem(x: Int): B = B() } fun testWrong() { @@ -37,4 +38,4 @@ fun testWrong() { B() *= 1 B() /= 1 B() %= 1 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/kt11300.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/kt11300.kt index fe05453ce05..336e7b3ca7b 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/kt11300.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/kt11300.kt @@ -2,7 +2,7 @@ class A { operator fun get(x: Int): Int = x - fun set(x: Int, y: Int) {} // no `operator` modifier + fun set(x: Int, y: Int) {} // no `operator` modifier } fun main() { diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.fir.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.fir.kt deleted file mode 100644 index 753ddd6221b..00000000000 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -class A { - fun a(a: Int): Int = 0 - - fun a(a: Int) { - } -} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.kt index 184876677c1..99c3f859afd 100644 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.kt +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL class A { - fun a(a: Int): Int = 0 + fun a(a: Int): Int = 0 - fun a(a: Int) { + fun a(a: Int) { } } diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.fir.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.fir.kt deleted file mode 100644 index e785dc5bebb..00000000000 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -package qwertyuiop - -fun c(s: String) { -} - -fun c(s: String) { -} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.kt index 0ee31c687f7..ffe1b7b0843 100644 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.kt +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL package qwertyuiop -fun c(s: String) { +fun c(s: String) { } -fun c(s: String) { +fun c(s: String) { } diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.fir.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.fir.kt deleted file mode 100644 index aaee8c77bfe..00000000000 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -package extensionFunctions - -fun Int.qwe(a: Float) = 1 - -fun Int.qwe(a: Float) = 2 diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.kt b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.kt index 9a29d4b564b..458ac83e33b 100644 --- a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.kt +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.kt @@ -1,5 +1,6 @@ +// FIR_IDENTICAL package extensionFunctions -fun Int.qwe(a: Float) = 1 +fun Int.qwe(a: Float) = 1 -fun Int.qwe(a: Float) = 2 +fun Int.qwe(a: Float) = 2 diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.fir.kt deleted file mode 100644 index daa89b278a0..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.HashMap - -interface ModuleDescriptorImpl -interface ModuleInfo -interface ResolverForModule -interface ResolverForProject - -class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject -) : ResolverForProject - -fun foo(delegateResolver: ResolverForProject): ResolverForProject { - val descriptorByModule = HashMap() - return ResolverForProjectImpl(descriptorByModule, delegateResolver) -} - -// M = M2 -// HashMap :< Map => M = M2! -// R = A -// RFP :< RFP \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt index 5c998b4ecce..4eb024a681b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL import java.util.HashMap interface ModuleDescriptorImpl @@ -6,8 +7,8 @@ interface ResolverForModule interface ResolverForProject class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject + descriptorByModule: Map, + delegateResolver: ResolverForProject ) : ResolverForProject fun foo(delegateResolver: ResolverForProject): ResolverForProject { @@ -18,4 +19,4 @@ fun foo(delegateResolver: ResolverForProj // M = M2 // HashMap :< Map => M = M2! // R = A -// RFP :< RFP \ No newline at end of file +// RFP :< RFP diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.fir.kt deleted file mode 100644 index 9fe15a7742e..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.fir.kt +++ /dev/null @@ -1,39 +0,0 @@ -// JAVAC_EXPECTED_FILE -// FILE: MyMap.java - -import java.util.AbstractMap; -import java.util.Set; - -class MyMap extends AbstractMap { - @Override - public Set> entrySet() { - return null; - } -} - -// FILE: main.kt - -interface ResolverForProject { - val exposeM: M1 get() = null!! -} - -class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject -) : ResolverForProject - -interface WithFoo { - fun foo() -} - -fun foo(delegateResolver: ResolverForProject): ResolverForProject { - val descriptorByModule = MyMap() - val result = ResolverForProjectImpl(descriptorByModule, delegateResolver) - result.exposeM.foo() // M is not M2? - result.exposeM?.foo() // no warning, M is not M2, hense M is M2! - - return ResolverForProjectImpl(descriptorByModule, delegateResolver) // another bound check -} - -// MyMap :< Map => M = M2! -// RFP :< RFP => M = M2? \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt index 61756c2e436..d58725330b7 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JAVAC_EXPECTED_FILE // FILE: MyMap.java @@ -18,8 +19,8 @@ interface ResolverForProject { } class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject + descriptorByModule: Map, + delegateResolver: ResolverForProject ) : ResolverForProject interface WithFoo { @@ -36,4 +37,4 @@ fun foo(delegateResolver: ResolverForProject): ResolverForPro } // MyMap :< Map => M = M2! -// RFP :< RFP => M = M2? \ No newline at end of file +// RFP :< RFP => M = M2? diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt index b4e216c8712..578f1093a57 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt @@ -28,15 +28,15 @@ fun main() { val raw = Test.rawAField raw.charSequences = arrayOf() - raw.charSequences = arrayOf() + raw.charSequences = arrayOf() raw.maps = arrayOf>() raw.maps = arrayOf>() - raw.maps = arrayOf>() + raw.maps = arrayOf>() raw.arraysOfLists = arrayOf>>() - raw.arraysOfLists = arrayOf>() - raw.arraysOfLists = arrayOf>>() + raw.arraysOfLists = arrayOf>() + raw.arraysOfLists = arrayOf>>() raw.arraysOfAny = arrayOf>>() diff --git a/compiler/testData/diagnostics/tests/privateInFile/visibility.kt b/compiler/testData/diagnostics/tests/privateInFile/visibility.kt index f61df940fd2..e72ea6ab702 100644 --- a/compiler/testData/diagnostics/tests/privateInFile/visibility.kt +++ b/compiler/testData/diagnostics/tests/privateInFile/visibility.kt @@ -10,7 +10,7 @@ private open class A { private var x: Int = 10 var xx: Int = 20 - private set(value: Int) {} + private set(value: Int) {} private fun foo() {} diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.fir.kt deleted file mode 100644 index d755fd6ec1a..00000000000 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -// !CHECK_TYPE -class A { - val x get() = 1 - val y get() = id(1) - val y2 get() = id(id(2)) - val z get() = l("") - val z2 get() = l(id(l(""))) - - val T.u get() = id(this) -} -fun id(x: E) = x -fun l(x: E): List = null!! - -fun foo(a: A) { - a.x checkType { _() } - a.y checkType { _() } - a.y2 checkType { _() } - a.z checkType { _>() } - a.z2 checkType { _>>() } - - with(a) { - 1.u checkType { _() } - } -} diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.kt index 9e0835f7777..e63bfdd603a 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/members.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE class A { val x get() = 1 @@ -9,7 +10,7 @@ class A { val T.u get() = id(this) } fun id(x: E) = x -fun l(x: E): List = null!! +fun l(x: E): List = null!! fun foo(a: A) { a.x checkType { _() } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.kt index 86f81277cb9..748b1512262 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.kt @@ -17,4 +17,4 @@ class A { } fun id(x: E) = x -fun l(x: E): List = null!! +fun l(x: E): List = null!! diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.fir.kt deleted file mode 100644 index a28d20cf58a..00000000000 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !CHECK_TYPE -val x get() = 1 -val y get() = id(1) -val y2 get() = id(id(2)) -val z get() = l("") -val z2 get() = l(id(l(""))) - -val T.u get() = id(this) - -fun id(x: E) = x -fun l(x: E): List = null!! - -fun foo() { - x checkType { _() } - y checkType { _() } - y2 checkType { _() } - z checkType { _>() } - z2 checkType { _>>() } - - 1.u checkType { _() } -} diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.kt index 13f297ca5e9..e4339799d00 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/topLevel.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE val x get() = 1 val y get() = id(1) @@ -8,7 +9,7 @@ val z2 get() = l(id(l(""))) val T.u get() = id(this) fun id(x: E) = x -fun l(x: E): List = null!! +fun l(x: E): List = null!! fun foo() { x checkType { _() } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/unsupportedInferenceFromGetters.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/unsupportedInferenceFromGetters.kt index 994e836395f..f238f196290 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/unsupportedInferenceFromGetters.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/unsupportedInferenceFromGetters.kt @@ -34,12 +34,12 @@ class A { val T.u get() = id(this) } fun id(x: E) = x -fun l(x: E): List = null!! +fun l(x: E): List = null!! // vars var x3 get() = 1 - set(q) { + set(q) { } // recursive diff --git a/compiler/testData/diagnostics/tests/recovery/absentLeftHandSide.kt b/compiler/testData/diagnostics/tests/recovery/absentLeftHandSide.kt index d2e695571e1..fd4898166c0 100644 --- a/compiler/testData/diagnostics/tests/recovery/absentLeftHandSide.kt +++ b/compiler/testData/diagnostics/tests/recovery/absentLeftHandSide.kt @@ -4,7 +4,7 @@ fun import() { } fun composite() { - val s = 13+~/12 + val s = 13+~/12 } fun html() { diff --git a/compiler/testData/diagnostics/tests/redeclarations/RedeclarationSuspendMainInMultiFile_before.kt b/compiler/testData/diagnostics/tests/redeclarations/RedeclarationSuspendMainInMultiFile_before.kt index d4de3428e37..fa4df3f5675 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/RedeclarationSuspendMainInMultiFile_before.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/RedeclarationSuspendMainInMultiFile_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -ExtendedMainConvention // FILE: a.kt -suspend fun main(args: Array) {} +suspend fun main(args: Array) {} // FILE: b.kt -suspend fun main(args: Array) {} +suspend fun main(args: Array) {} diff --git a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.fir.kt b/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.fir.kt deleted file mode 100644 index 68cd9854c50..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// One of the two passes is making a scope and turning vals into functions -// See KT-76 - -package x - -val b : Foo = Foo() -val a1 = b.compareTo(2) - -class Foo() { - fun compareTo(other : Byte) : Int = 0 - fun compareTo(other : Char) : Int = 0 -} diff --git a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.kt b/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.kt index f17f0596ef7..791e3f16951 100644 --- a/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.kt +++ b/compiler/testData/diagnostics/tests/regressions/AmbiguityOnLazyTypeComputation.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // One of the two passes is making a scope and turning vals into functions // See KT-76 @@ -7,6 +8,6 @@ val b : Foo = Foo() val a1 = b.compareTo(2) class Foo() { - fun compareTo(other : Byte) : Int = 0 - fun compareTo(other : Char) : Int = 0 + fun compareTo(other : Byte) : Int = 0 + fun compareTo(other : Char) : Int = 0 } diff --git a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.fir.kt b/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.fir.kt deleted file mode 100644 index b942565037b..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun test() { - var a : Any? = null - if (a is Any) else a = null; - while (a is Any) a = null - while (true) a = null -} diff --git a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt b/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt index facd0830146..b0ebb7a0e8e 100644 --- a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt +++ b/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL fun test() { var a : Any? = null if (a is Any) else a = null; while (a is Any) a = null - while (true) a = null + while (true) a = null } diff --git a/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.kt b/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.kt index ba04871cefc..fd2b17bf39c 100644 --- a/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.kt +++ b/compiler/testData/diagnostics/tests/regressions/CoercionToUnit.kt @@ -1,8 +1,8 @@ -fun foo(u : Unit) : Int = 1 +fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : () -> Unit = { + val a : () -> Unit = { foo(1) } return 1 diff --git a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt index 20b6cb77286..13bfbe9eeff 100644 --- a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt +++ b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt @@ -31,7 +31,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) if (expr.length > 0) { - val c = expr.get(0) + val c = expr.get(0) expr.deleteCharAt(0) } return lhs diff --git a/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.fir.kt b/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.fir.kt deleted file mode 100644 index a773dd1bbf1..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo(a : Any) {} - -fun test() { - foo(object {}); -} diff --git a/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt b/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt index 73c5eaa6438..c439b778050 100644 --- a/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt +++ b/compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt @@ -1,4 +1,5 @@ -fun foo(a : Any) {} +// FIR_IDENTICAL +fun foo(a : Any) {} fun test() { foo(object {}); diff --git a/compiler/testData/diagnostics/tests/regressions/Jet124.fir.kt b/compiler/testData/diagnostics/tests/regressions/Jet124.fir.kt deleted file mode 100644 index 6fa400a1acc..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/Jet124.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo1() : (Int) -> Int = { x: Int -> x } - -fun foo() { - val h : (Int) -> Int = foo1(); - h(1) - val m : (Int) -> Int = {a : Int -> 1}//foo1() - m(1) -} diff --git a/compiler/testData/diagnostics/tests/regressions/Jet124.kt b/compiler/testData/diagnostics/tests/regressions/Jet124.kt index ff38a390e05..4f0a8fee696 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet124.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet124.kt @@ -1,8 +1,9 @@ +// FIR_IDENTICAL fun foo1() : (Int) -> Int = { x: Int -> x } fun foo() { val h : (Int) -> Int = foo1(); h(1) - val m : (Int) -> Int = {a : Int -> 1}//foo1() + val m : (Int) -> Int = {a : Int -> 1}//foo1() m(1) } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet169.kt b/compiler/testData/diagnostics/tests/regressions/Jet169.kt index ba56f72b947..eaf1494d564 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet169.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet169.kt @@ -1,8 +1,8 @@ -fun set(key : String, value : String) { +fun set(key : String, value : String) { val a : String? = "" when (a) { "" -> a.get(0) is String, is Any -> a.compareTo("") else -> a.toString() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/Jet183.fir.kt b/compiler/testData/diagnostics/tests/regressions/Jet183.fir.kt deleted file mode 100644 index 65c0a2efb39..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/Jet183.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -enum class ProtocolState { - WAITING { - override fun signal() = ProtocolState.TALKING - }, - - TALKING { - override fun signal() = ProtocolState.WAITING - }; - - abstract fun signal() : ProtocolState -} - -fun box() { - val x: ProtocolState = ProtocolState.WAITING -} diff --git a/compiler/testData/diagnostics/tests/regressions/Jet183.kt b/compiler/testData/diagnostics/tests/regressions/Jet183.kt index c6f7516117f..d92d4b1ffde 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet183.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet183.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING @@ -11,5 +12,5 @@ enum class ProtocolState { } fun box() { - val x: ProtocolState = ProtocolState.WAITING + val x: ProtocolState = ProtocolState.WAITING } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet69.kt b/compiler/testData/diagnostics/tests/regressions/Jet69.kt index 650edef408e..fcfed2c5b73 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet69.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet69.kt @@ -1,10 +1,10 @@ class Command() {} -fun parse(cmd: String): Command? { return null } +fun parse(cmd: String): Command? { return null } fun Any.equals(other : Any?) : Boolean = this === other fun main() { val command = parse("") - if (command == null) 1 // error on this line, but must be OK -} \ No newline at end of file + if (command == null) 1 // error on this line, but must be OK +} diff --git a/compiler/testData/diagnostics/tests/regressions/OutProjections.kt b/compiler/testData/diagnostics/tests/regressions/OutProjections.kt index 58386a757be..ce685827dcc 100644 --- a/compiler/testData/diagnostics/tests/regressions/OutProjections.kt +++ b/compiler/testData/diagnostics/tests/regressions/OutProjections.kt @@ -4,17 +4,17 @@ class Point() { class G() {} -fun f(expression : T) : G = G() +fun f(expression : T) : G = G() fun foo() : G { val p = Point() - return f(p) + return f(p) } class Out() {} -fun fout(expression : T) : Out<out T> = Out() +fun fout(expression : T) : Out<out T> = Out() fun fooout() : Out { val p = Point(); diff --git a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt index 7f0041bee43..d92a28606b5 100644 --- a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt +++ b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt @@ -1,4 +1,4 @@ -fun Any.equals(other : Any?) : Boolean = true +fun Any.equals(other : Any?) : Boolean = true fun main() { diff --git a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt index 74b97d3837b..4391781a4f1 100644 --- a/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt +++ b/compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt @@ -2,15 +2,15 @@ fun main() { val a : Int? = null; var v = 1 - val b : String = v; - val f : String = a!!; - val g : String = v++; - val g1 : String = ++v; - val h : String = v--; - val h1 : String = --v; - val i : String = !true; - val j : String = foo@ true; - val k : String = foo@ bar@ true; - val l : String = -1; - val m : String = +1; -} \ No newline at end of file + val b : String = v; + val f : String = a!!; + val g : String = v++; + val g1 : String = ++v; + val h : String = v--; + val h1 : String = --v; + val i : String = !true; + val j : String = foo@ true; + val k : String = foo@ bar@ true; + val l : String = -1; + val m : String = +1; +} diff --git a/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.kt b/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.kt index e8663c426a7..c72307c7f2d 100644 --- a/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.kt +++ b/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.kt @@ -1,8 +1,8 @@ open class Foo {} open class Bar {} -fun foo(x : Int) {} -fun foo(x : Long) {} +fun foo(x : Int) {} +fun foo(x : Long) {} fun f(): Unit { foo<Int, Int>(1) diff --git a/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt b/compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt index acf8d9ad5b4..65b023f7c13 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/regressions/kt10843.kt b/compiler/testData/diagnostics/tests/regressions/kt10843.kt index e1159184635..c209aad4428 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt10843.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt10843.kt @@ -1,8 +1,8 @@ // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE // See EA-76890 / KT-10843: NPE during analysis -fun lambda(x : Int?) = x?.let l { +fun lambda(x : Int?) = x?.let l { y -> - if (y > 0) return@l x + if (y > 0) return@l x y }!! diff --git a/compiler/testData/diagnostics/tests/regressions/kt127.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt127.fir.kt deleted file mode 100644 index 6e026f7ecf0..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt127.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// KT-127 Support extension functions in when expressions - -class Foo() {} - -fun Any?.equals1(other : Any?) : Boolean = true - -fun main() { - - val command : Foo? = null - - // Commented for KT-621 - // when (command) { - // .equals(null) => 1; // must be resolved - // ?.equals(null) => 1 // same here - // } - command.equals1(null) - command?.equals(null) -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt127.kt b/compiler/testData/diagnostics/tests/regressions/kt127.kt index 883f207faf6..110163a825f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt127.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt127.kt @@ -1,8 +1,9 @@ +// FIR_IDENTICAL // KT-127 Support extension functions in when expressions class Foo() {} -fun Any?.equals1(other : Any?) : Boolean = true +fun Any?.equals1(other : Any?) : Boolean = true fun main() { diff --git a/compiler/testData/diagnostics/tests/regressions/kt128.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt128.fir.kt deleted file mode 100644 index 0225952f080..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt128.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// KT-128 Support passing only the last closure if all the other parameters have default values - -fun div(c : String = "", f : () -> Unit) {} -fun f() { - div { // Nothing passed, but could have been... - // ... - } - - div (c = "foo") { // More things could have been passed - // ... - } -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt128.kt b/compiler/testData/diagnostics/tests/regressions/kt128.kt index fb15cee8f9f..0fb8dd9feb9 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt128.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt128.kt @@ -1,6 +1,7 @@ +// FIR_IDENTICAL // KT-128 Support passing only the last closure if all the other parameters have default values -fun div(c : String = "", f : () -> Unit) {} +fun div(c : String = "", f : () -> Unit) {} fun f() { div { // Nothing passed, but could have been... // ... diff --git a/compiler/testData/diagnostics/tests/regressions/kt13685.kt b/compiler/testData/diagnostics/tests/regressions/kt13685.kt index bc5d8303712..8bc4030ed4c 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt13685.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt13685.kt @@ -2,6 +2,6 @@ // !DIAGNOSTICS: -UNREACHABLE_CODE fun foo() { - val text: List = null!! + val text: List = null!! text.map Any?::toString } diff --git a/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt index e8a38553320..af180e6e67f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt @@ -13,7 +13,7 @@ class C { } } - fun foo(x : X, body : (X) -> Unit) { + fun foo(x : X, body : (X) -> Unit) { } fun p() : Resource? = null diff --git a/compiler/testData/diagnostics/tests/regressions/kt16086_2.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt16086_2.fir.kt deleted file mode 100644 index abd3f382969..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt16086_2.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// FILE: 1.kt -package a -import b.ObserverSupport - -interface IEntity - -fun IEntity(f: ObserverSupport) {} - -// FILE: 2.kt -package b -import a.IEntity - -class ObserverSupport \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt16086_2.kt b/compiler/testData/diagnostics/tests/regressions/kt16086_2.kt index 603a4237f8d..574271b709a 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt16086_2.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt16086_2.kt @@ -1,13 +1,14 @@ +// FIR_IDENTICAL // FILE: 1.kt package a import b.ObserverSupport interface IEntity -fun IEntity(f: ObserverSupport) {} +fun IEntity(f: ObserverSupport) {} // FILE: 2.kt package b import a.IEntity -class ObserverSupport \ No newline at end of file +class ObserverSupport diff --git a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.fir.kt deleted file mode 100644 index 9571fa7e0e3..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FULL_JDK -// SKIP_TXT - -package test - -import javax.swing.JFrame - -class KFrame() : JFrame() { - init { - val x = this.rootPaneCheckingEnabled // make sure field is visible - } -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt index ec39152d13b..1496c0556c2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FULL_JDK // SKIP_TXT @@ -7,6 +8,6 @@ import javax.swing.JFrame class KFrame() : JFrame() { init { - val x = this.rootPaneCheckingEnabled // make sure field is visible + val x = this.rootPaneCheckingEnabled // make sure field is visible } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt235.kt b/compiler/testData/diagnostics/tests/regressions/kt235.kt index 3e8d0f47a47..0cc57c40181 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt235.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt235.kt @@ -4,46 +4,46 @@ package kt235 fun main() { val array = MyArray() - val f: () -> String = { + val f: () -> String = { array[2] = 23 //error: Type mismatch: inferred type is Int (!!!) but String was expected } - val g: () -> String = { + val g: () -> String = { var x = 1 x += 2 //no error, but it should be here } - val h: () -> String = { + val h: () -> String = { var x = 1 - x = 2 //the same + x = 2 //the same } val array1 = MyArray1() - val i: () -> String = { + val i: () -> String = { array1[2] = 23 } - val fi: () -> String = { + val fi: () -> String = { array[2] = 23 } - val gi: () -> String = { + val gi: () -> String = { var x = 1 x += 21 } var m: MyNumber = MyNumber() - val a: () -> MyNumber = { + val a: () -> MyNumber = { m++ } } class MyArray() { - operator fun get(i: Int): Int = 1 - operator fun set(i: Int, value: Int): Int = 1 + operator fun get(i: Int): Int = 1 + operator fun set(i: Int, value: Int): Int = 1 } class MyArray1() { - operator fun get(i: Int): Int = 1 - operator fun set(i: Int, value: Int) {} + operator fun get(i: Int): Int = 1 + operator fun set(i: Int, value: Int) {} } class MyNumber() { operator fun inc(): MyNumber = MyNumber() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt258.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt258.fir.kt deleted file mode 100644 index 7ea51cec00d..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt258.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// KT-258 Support equality constraints in type inference - -import java.util.* - -fun test() { - val attributes : HashMap = HashMap() - attributes["href"] = "1" // inference fails, but it shouldn't -} - -operator fun MutableMap.set(key : K, value : V) {}//= this.put(key, value) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt258.kt b/compiler/testData/diagnostics/tests/regressions/kt258.kt index cba69c3d509..b7f8301cf2a 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt258.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt258.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-258 Support equality constraints in type inference import java.util.* @@ -7,4 +8,4 @@ fun test() { attributes["href"] = "1" // inference fails, but it shouldn't } -operator fun MutableMap.set(key : K, value : V) {}//= this.put(key, value) \ No newline at end of file +operator fun MutableMap.set(key : K, value : V) {}//= this.put(key, value) diff --git a/compiler/testData/diagnostics/tests/regressions/kt282.kt b/compiler/testData/diagnostics/tests/regressions/kt282.kt index add5982d012..c0a3d9c89e2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt282.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt282.kt @@ -2,12 +2,12 @@ // KT-282 Nullability in extension functions and in binary calls class Set { - operator fun contains(x : Int) : Boolean = true + operator fun contains(x : Int) : Boolean = true } -operator fun Set?.plus(x : Int) : Int = 1 +operator fun Set?.plus(x : Int) : Int = 1 -operator fun Int?.contains(x : Int) : Boolean = false +operator fun Int?.contains(x : Int) : Boolean = false fun f(): Unit { var set : Set? = null diff --git a/compiler/testData/diagnostics/tests/regressions/kt287.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt287.fir.kt deleted file mode 100644 index 72ea707f966..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt287.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// KT-287 Infer constructor type arguments - -import java.util.* - -fun attributes() : Map = HashMap() // Should be inferred; -val attributes : Map = HashMap() // Should be inferred; - -fun foo(m : Map) {} - -fun test() { - foo(HashMap()) -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt287.kt b/compiler/testData/diagnostics/tests/regressions/kt287.kt index 9892cd7a6a9..1817bf73a08 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt287.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt287.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-287 Infer constructor type arguments import java.util.* @@ -5,7 +6,7 @@ import java.util.* fun attributes() : Map = HashMap() // Should be inferred; val attributes : Map = HashMap() // Should be inferred; -fun foo(m : Map) {} +fun foo(m : Map) {} fun test() { foo(HashMap()) diff --git a/compiler/testData/diagnostics/tests/regressions/kt306.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt306.fir.kt deleted file mode 100644 index dba4b547214..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt306.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// KT-306 Ambiguity when different this's have same-looking functions - -fun test() { - (fun Foo.() { - bar() - (fun Barr.() { - this.bar() - bar() - }) - }) - (fun Barr.() { - this.bar() - bar() - }) -} - -class Foo { - fun bar() {} -} - -class Barr { - fun bar() {} -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt306.kt b/compiler/testData/diagnostics/tests/regressions/kt306.kt index e12d6e208f7..851b3a2bc03 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt306.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt306.kt @@ -1,17 +1,18 @@ +// FIR_IDENTICAL // KT-306 Ambiguity when different this's have same-looking functions fun test() { - (fun Foo.() { + (fun Foo.() { bar() - (fun Barr.() { + (fun Barr.() { this.bar() bar() - }) - }) - (fun Barr.() { + }) + }) + (fun Barr.() { this.bar() bar() - }) + }) } class Foo { diff --git a/compiler/testData/diagnostics/tests/regressions/kt335.336.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt335.336.fir.kt deleted file mode 100644 index cf1e1ca7fe7..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt335.336.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// KT-336 Can't infer type parameter for ArrayList in a generic function (Exception in type inference) -// KT-335 Type inference fails on Collections.sort - -import java.util.* - -fun > MutableList.sort() { - Collections.sort(this) // Error here -} - -fun List.plus(other : List) : List { - val result = ArrayList(this) - return result -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt335.336.kt b/compiler/testData/diagnostics/tests/regressions/kt335.336.kt index 637acf77467..5fc8eaf64ab 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt335.336.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt335.336.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-336 Can't infer type parameter for ArrayList in a generic function (Exception in type inference) // KT-335 Type inference fails on Collections.sort @@ -7,7 +8,7 @@ fun > MutableList.sort() { Collections.sort(this) // Error here } -fun List.plus(other : List) : List { +fun List.plus(other : List) : List { val result = ArrayList(this) return result } diff --git a/compiler/testData/diagnostics/tests/regressions/kt352.kt b/compiler/testData/diagnostics/tests/regressions/kt352.kt index 5bd249c75ea..80cc37de7aa 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt352.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt352.kt @@ -6,7 +6,7 @@ package kt352 val f : (Any) -> Unit = { -> } //type mismatch fun foo() { - val f : (Any) -> Unit = { -> } //!!! no error + val f : (Any) -> Unit = { -> } //!!! no error } class A() { @@ -14,16 +14,16 @@ class A() { } //more tests -val g : () -> Unit = { 42 } +val g : () -> Unit = { 42 } val gFunction : () -> Unit = fun(): Int = 1 val h : () -> Unit = { doSmth() } fun doSmth(): Int = 42 -fun doSmth(a: String) {} +fun doSmth(a: String) {} val testIt : (Any) -> Unit = { if (it is String) { doSmth(it) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt353.kt b/compiler/testData/diagnostics/tests/regressions/kt353.kt index efe7adee74e..fa8ddba128d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt353.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt353.kt @@ -6,17 +6,17 @@ interface A { } fun foo(a: A) { - val g : () -> Unit = { + val g : () -> Unit = { a.gen() //it works: Unit is derived } - val u: Unit = a.gen() // Unit should be inferred + val u: Unit = a.gen() // Unit should be inferred if (true) { a.gen() // Shouldn't work: no info for inference } - val b : () -> Unit = { + val b : () -> Unit = { if (true) { a.gen() // unit can be inferred } @@ -25,7 +25,7 @@ fun foo(a: A) { } } - val f : () -> Int = { + val f : () -> Int = { a.gen() //type mismatch, but Int can be derived } diff --git a/compiler/testData/diagnostics/tests/regressions/kt399.kt b/compiler/testData/diagnostics/tests/regressions/kt399.kt index 80ecbbbceff..7cfbea68622 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt399.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt399.kt @@ -1,6 +1,6 @@ // KT-399 Type argument inference not implemented for CALL_EXPRESSION -fun getSameTypeChecker(obj: T) : Function1 { +fun getSameTypeChecker(obj: T) : Function1 { return { a : Any -> a is T } } @@ -8,4 +8,4 @@ fun box() : String { if(getSameTypeChecker("lala")(10)) return "fail" if(!getSameTypeChecker("mama")("lala")) return "fail" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt402.kt b/compiler/testData/diagnostics/tests/regressions/kt402.kt index 277117c35d7..e70c0dc36b2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt402.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt402.kt @@ -1,7 +1,7 @@ package kt402 fun getTypeChecker() : (Any)->Boolean { - { a : Any -> a is T } // reports unsupported + { a : Any -> a is T } // reports unsupported } fun f() : (Any) -> Boolean { return { a : Any -> a is String } diff --git a/compiler/testData/diagnostics/tests/regressions/kt41.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt41.fir.kt deleted file mode 100644 index 086d22787c5..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt41.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-41 Make functions with errors in returning statement return ERROR type and not Nothing - -package kt41 - -fun aaa() = - 6 foo 1 - -fun bbb() { - aaa() - 1 // Stupid error: unreachable code -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt41.kt b/compiler/testData/diagnostics/tests/regressions/kt41.kt index 1398f5ee8de..0aa91d243e1 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt41.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt41.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-41 Make functions with errors in returning statement return ERROR type and not Nothing package kt41 @@ -7,5 +8,5 @@ fun aaa() = fun bbb() { aaa() - 1 // Stupid error: unreachable code + 1 // Stupid error: unreachable code } diff --git a/compiler/testData/diagnostics/tests/regressions/kt411.kt b/compiler/testData/diagnostics/tests/regressions/kt411.kt index 5e030220c35..b8b4dcb5e9f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt411.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt411.kt @@ -9,17 +9,17 @@ fun f() { } ) } -fun invoker(gen : () -> Int) : Int = 0 +fun invoker(gen : () -> Int) : Int = 0 //more tests fun t1() { - val v = l@{ + val v = l@{ return@l 111 } } fun t2() : String { - val g : ()-> Int = l@{ + val g : ()-> Int = l@{ if (true) { return@l 1 } @@ -54,10 +54,10 @@ fun t3() : String { } fun t4() : Int { - val h : ()-> String = l@{ + val h : ()-> String = l@{ return@l "a" } - val g : ()-> String = l@{ + val g : ()-> String = l@{ return@l "a" } @@ -66,4 +66,4 @@ fun t4() : Int { } return 12 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt439.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt439.fir.kt deleted file mode 100644 index d55d6a501f6..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt439.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -// KT-439 Support labeled function literals in call arguments - -fun main1(args : Array) { - run l@{ 1 } // should not be an error -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt439.kt b/compiler/testData/diagnostics/tests/regressions/kt439.kt index f8ffd0b6a03..8d7688c3bc0 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt439.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt439.kt @@ -1,5 +1,6 @@ +// FIR_IDENTICAL // KT-439 Support labeled function literals in call arguments -fun main1(args : Array) { +fun main1(args : Array) { run l@{ 1 } // should not be an error } diff --git a/compiler/testData/diagnostics/tests/regressions/kt442.kt b/compiler/testData/diagnostics/tests/regressions/kt442.kt index 0be9857fe66..1fbd6d186b5 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt442.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt442.kt @@ -3,13 +3,13 @@ fun funny(f : () -> T) : T = f() fun testFunny() { - val a : Int = funny {1} + val a : Int = funny {1} } -fun funny2(f : (t : T) -> T) : T {} +fun funny2(f : (t : T) -> T) : T {} fun testFunny2() { - val a : Int = funny2 {it} + val a : Int = funny2 {it} } fun box() : String { @@ -25,7 +25,7 @@ infix fun T.with(f : T.() -> Unit) { } fun main() { - val a = 1 with { + val a = 1 with { plus(1) } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt455.kt b/compiler/testData/diagnostics/tests/regressions/kt455.kt index 6265d564309..36456235641 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt455.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt455.kt @@ -7,4 +7,4 @@ fun foo() { doSmth(a) //error doSmth(a) //no repeat error } -fun doSmth(i: Int) {} +fun doSmth(i: Int) {} diff --git a/compiler/testData/diagnostics/tests/regressions/kt459.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt459.fir.kt deleted file mode 100644 index c2b93e0e6a1..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt459.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -// KT-459 Type argument inference fails when class names are fully qualified - -fun test() { - val attributes : java.util.HashMap = java.util.HashMap() // failure! - attributes["href"] = "1" // inference fails, but it shouldn't -} - -operator fun Map.set(key : K, value : V) {}//= this.put(key, value) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt459.kt b/compiler/testData/diagnostics/tests/regressions/kt459.kt index ece6110dbeb..8ae85717634 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt459.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt459.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-459 Type argument inference fails when class names are fully qualified fun test() { @@ -5,4 +6,4 @@ fun test() { attributes["href"] = "1" // inference fails, but it shouldn't } -operator fun Map.set(key : K, value : V) {}//= this.put(key, value) \ No newline at end of file +operator fun Map.set(key : K, value : V) {}//= this.put(key, value) diff --git a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.fir.kt deleted file mode 100644 index ceaf5571d30..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// http://youtrack.jetbrains.net/issue/KT-526 -// KT-526 Unresolved reference for inner static class - -package demo - -class Foo { - companion object { - class Bar() { } - } -} -class User { - fun main() : Unit { - var boo : Foo.Companion.Bar? /* <-- this reference is red */ = Foo.Companion.Bar() - } -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.kt b/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.kt index 4d9c7cc96e7..1d8e41c2bf2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt526UnresolvedReferenceInnerStatic.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // http://youtrack.jetbrains.net/issue/KT-526 // KT-526 Unresolved reference for inner static class @@ -10,6 +11,6 @@ class Foo { } class User { fun main() : Unit { - var boo : Foo.Companion.Bar? /* <-- this reference is red */ = Foo.Companion.Bar() + var boo : Foo.Companion.Bar? /* <-- this reference is red */ = Foo.Companion.Bar() } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt5326.kt b/compiler/testData/diagnostics/tests/regressions/kt5326.kt index 06afa18874e..e153e1e8493 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt5326.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt5326.kt @@ -2,10 +2,10 @@ class A { fun size() = 0 } -class Foo(i: Int) +class Foo(i: Int) public fun Foo(c: A) { - val a = Foo(c.size()) // Check no overload resolution ambiguity - val b: Foo = Foo(c.size()) // OK - val c: Foo = Foo(c.size()) // OK -} \ No newline at end of file + val a = Foo(c.size()) // Check no overload resolution ambiguity + val b: Foo = Foo(c.size()) // OK + val c: Foo = Foo(c.size()) // OK +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt58.kt b/compiler/testData/diagnostics/tests/regressions/kt58.kt index 6b490507883..626c14fc6ec 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt58.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt58.kt @@ -87,5 +87,5 @@ fun t7() : Int { } } -fun doSmth(i: Int) { +fun doSmth(i: Int) { } diff --git a/compiler/testData/diagnostics/tests/regressions/kt597.kt b/compiler/testData/diagnostics/tests/regressions/kt597.kt index 53870c1423f..17ce7a60871 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt597.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt597.kt @@ -15,5 +15,5 @@ operator fun Int?.inc() : Int { fun test() { var i : Int? = 10 - var i_inc = i++ // <- expected Int?, but returns Any? + var i_inc = i++ // <- expected Int?, but returns Any? } diff --git a/compiler/testData/diagnostics/tests/regressions/kt600.kt b/compiler/testData/diagnostics/tests/regressions/kt600.kt index d739181df82..792979f272b 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt600.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt600.kt @@ -4,5 +4,5 @@ fun T?._sure() : T { if (this != null) return fun test() { val i : Int? = 10 - val i2 : Int = i._sure() // inferred type is Int? but Int was excepted + val i2 : Int = i._sure() // inferred type is Int? but Int was excepted } diff --git a/compiler/testData/diagnostics/tests/regressions/kt618.kt b/compiler/testData/diagnostics/tests/regressions/kt618.kt index 989a75fe3d4..02a2bd8cab8 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt618.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt618.kt @@ -1,19 +1,19 @@ package lol class B() { - operator fun plusAssign(other : B) : String { + operator fun plusAssign(other : B) : String { return "s" } - operator fun minusAssign(other : B) : String { + operator fun minusAssign(other : B) : String { return "s" } - operator fun remAssign(other : B) : String { + operator fun remAssign(other : B) : String { return "s" } - operator fun divAssign(other : B) : String { + operator fun divAssign(other : B) : String { return "s" } - operator fun timesAssign(other : B) : String { + operator fun timesAssign(other : B) : String { return "s" } } @@ -25,4 +25,4 @@ fun main() { c /= B() c -= B() c %= B() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt629.kt b/compiler/testData/diagnostics/tests/regressions/kt629.kt index 57e89c2e4e4..026b69bf6d6 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt629.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt629.kt @@ -4,7 +4,7 @@ package kt629 class A() { var p = "yeah" - operator fun rem(other : A) : A { + operator fun rem(other : A) : A { return A(); } } diff --git a/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.kt b/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.kt index b0e5f9a585d..121f3206a7d 100644 --- a/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.kt +++ b/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.kt @@ -17,10 +17,10 @@ fun String.topLevelExtensionFun(){} val String.topLevelExtensionProperty: Int get() = 1 open class A { - constructor(p: Int) : this("") {} + constructor(p: Int) : this("") {} @Deprecated("hidden", level = DeprecationLevel.HIDDEN) - constructor(s: String){} + constructor(s: String){} @Deprecated("hidden", level = DeprecationLevel.HIDDEN) open fun memberFun(){} @@ -71,4 +71,4 @@ class B : A("") { class C : A { constructor() : super("") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/dslMarker/dslMarkerWithTypealiasRecursion.kt b/compiler/testData/diagnostics/tests/resolve/dslMarker/dslMarkerWithTypealiasRecursion.kt index 5336f397ce8..82127f4206c 100644 --- a/compiler/testData/diagnostics/tests/resolve/dslMarker/dslMarkerWithTypealiasRecursion.kt +++ b/compiler/testData/diagnostics/tests/resolve/dslMarker/dslMarkerWithTypealiasRecursion.kt @@ -13,7 +13,7 @@ typealias YBar = ZBar typealias ZBar = YBar fun Foo.foo(body: Foo.() -> Unit) = body() -fun Foo.zbar(body: ZBar.() -> Unit) = Bar().body() +fun Foo.zbar(body: ZBar.() -> Unit) = Bar().body() fun test() { Foo().foo { diff --git a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt index c2ae5a1a716..7e846d55861 100644 --- a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt +++ b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt @@ -1,6 +1,6 @@ package p -class X(provider: () -> V, trackValue: Boolean) { +class X(provider: () -> V, trackValue: Boolean) { } class B { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.fir.kt deleted file mode 100644 index a2c5d7721e1..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -interface A -interface Foo { - operator fun A.invoke() -} - -fun test(a: A, foo: Foo) { - a.foo() -} - -fun test(a: Int, foo: Int.()->Unit) { - a.foo() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt index 2bb7af266a0..312a083f583 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAsMemberExtensionToExplicitReceiver.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL interface A interface Foo { operator fun A.invoke() } -fun test(a: A, foo: Foo) { +fun test(a: A, foo: Foo) { a.foo() } fun test(a: Int, foo: Int.()->Unit) { a.foo() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.fir.kt deleted file mode 100644 index 5e9a39f6280..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -//KT-3772 Invoke and overload resolution ambiguity -package bar - -open class A { - public operator fun invoke(f: A.() -> Unit) {} -} - -class B { - public operator fun invoke(f: B.() -> Unit) {} -} - -open class C -val C.attr: A - get() = A() - -open class D: C() -val D.attr: B - get() = B() - - -fun main() { - val b = D() - b.attr {} // overload resolution ambiguity - - val d = b.attr - d {} // no error -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.kt index 8da05d9e3ed..0cf8f922e43 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt3772.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL //KT-3772 Invoke and overload resolution ambiguity package bar open class A { - public operator fun invoke(f: A.() -> Unit) {} + public operator fun invoke(f: A.() -> Unit) {} } class B { - public operator fun invoke(f: B.() -> Unit) {} + public operator fun invoke(f: B.() -> Unit) {} } open class C @@ -24,4 +25,4 @@ fun main() { val d = b.attr d {} // no error -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt4204-completeNestedCallsForInvoke.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt4204-completeNestedCallsForInvoke.kt index 56ebabc10ab..76b7db75068 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt4204-completeNestedCallsForInvoke.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt4204-completeNestedCallsForInvoke.kt @@ -3,7 +3,7 @@ package c public abstract class TestBug1() { - public fun m3(position: Int) { + public fun m3(position: Int) { position(m1().second!!) } @@ -13,7 +13,7 @@ public abstract class TestBug1() { private abstract fun m1(): Pair - private fun position(p: Int) {} + private fun position(p: Int) {} } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt9517.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9517.kt index 94d993d12b1..ab2ea19855b 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9517.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt9517.kt @@ -1,4 +1,3 @@ - //KT-9517 Wrong resolve for invoke convention after smart cast open class A { open val foo: () -> Number = null!! @@ -11,6 +10,6 @@ class B: A() { fun test(a: A) { if (a is B) { - val foo: Int = a.foo() // B::foo + invoke() + val foo: Int = a.foo() // B::foo + invoke() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/wrongInvokeExtension.kt b/compiler/testData/diagnostics/tests/resolve/invoke/wrongInvokeExtension.kt index 399dee6ccc6..49ccf408f0f 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/wrongInvokeExtension.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/wrongInvokeExtension.kt @@ -9,12 +9,12 @@ class A { val B.a: () -> Int get() = { 5 } fun test(a: A, b: B) { - val x: Int = b.a() + val x: Int = b.a() b.(a)() with(b) { - val y: Int = a() + val y: Int = a() (a)() } } diff --git a/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt b/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt index a556a086751..0dc3e618af1 100644 --- a/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt +++ b/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt @@ -112,7 +112,7 @@ fun testTwoLambdas() { fun f1(): (() -> Unit) -> (() -> Unit) -> Unit { return { l1 -> - l1() - { l2 -> l2() } + l1() + { l2 -> l2() } } } diff --git a/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt index dcdaa8002c6..6d6979b3035 100644 --- a/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt +++ b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt @@ -9,7 +9,7 @@ class A var A.timeInMillis: String get() = "" - set(v) {} + set(v) {} fun a(c: Calendar) { A().apply { diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.fir.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.fir.kt deleted file mode 100644 index d77aed83c16..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -//If this test hangs, it means something is broken. -package a - -class A { - val testVal : A = A() -} - -//inappropriate but participating in resolve functions -fun foo(a: T, b: T, i: Int) = a -fun foo(a: Any) = a -fun foo(a: T, b: String) = a -fun foo(a: T, b: T, s: String) = a -//appropriate function -fun foo(a: T, b: T) = a - -fun test(a: A) { - //the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now) - //to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference - foo(foo(a, foo(a, foo(a, a.testVal))), a) - -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt index 8477b65463f..64d9dd78378 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //If this test hangs, it means something is broken. package a @@ -6,16 +7,16 @@ class A { } //inappropriate but participating in resolve functions -fun foo(a: T, b: T, i: Int) = a +fun foo(a: T, b: T, i: Int) = a fun foo(a: Any) = a -fun foo(a: T, b: String) = a -fun foo(a: T, b: T, s: String) = a +fun foo(a: T, b: String) = a +fun foo(a: T, b: T, s: String) = a //appropriate function -fun foo(a: T, b: T) = a +fun foo(a: T, b: T) = a fun test(a: A) { //the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now) //to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference foo(foo(a, foo(a, foo(a, a.testVal))), a) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithRedeclarationError.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithRedeclarationError.kt index 94f9fd05d1c..5cbc21dd077 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithRedeclarationError.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithRedeclarationError.kt @@ -1,7 +1,7 @@ //If this test hangs, it means something is broken. package c -fun z(view: () -> Unit) {} +fun z(view: () -> Unit) {} fun x() = z { z { z { z { z { z { z { z { } } } } } } } } fun x() = z { z { z { z { z { z { z { z { } } } } } } } } @@ -31,4 +31,4 @@ fun z(view: () -> Unit) {} fun x() = z { z { z { z { z { z { z { z { } } } } } } } } fun x() = z { z { z { z { z { z { z { z { } } } } } } } } -class x() {} \ No newline at end of file +class x() {} diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.fir.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.fir.kt deleted file mode 100644 index 89fed6051f7..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -//If this test hangs, it means something is broken. -package c - -class A { - val testVal : A = A() -} - -//inappropriate but participating in resolve functions -fun foo(a: A, b: A, i: Int) = a -fun foo(a: Any) = a -fun foo(a: A, b: Any) = a -fun foo(a: A, b: A, s: String) = a -//appropriate function -fun foo(a: A, b: A) = a - -fun test(a: A) { - //the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now) - //to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference - foo(foo(a, foo(a, foo(a, a.testVal))), a) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.kt index 64c79ac30cd..ae292d2337c 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //If this test hangs, it means something is broken. package c @@ -6,15 +7,15 @@ class A { } //inappropriate but participating in resolve functions -fun foo(a: A, b: A, i: Int) = a +fun foo(a: A, b: A, i: Int) = a fun foo(a: Any) = a -fun foo(a: A, b: Any) = a -fun foo(a: A, b: A, s: String) = a +fun foo(a: A, b: Any) = a +fun foo(a: A, b: A, s: String) = a //appropriate function -fun foo(a: A, b: A) = a +fun foo(a: A, b: A) = a fun test(a: A) { //the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now) //to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference foo(foo(a, foo(a, foo(a, a.testVal))), a) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt index aed12c733ab..39388b96d04 100644 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt @@ -7,14 +7,14 @@ fun id(t: T): T = t fun doList(l: List) = l fun doInt(i: Int) = i -fun strangeNullableList(f: (T) -> Unit): List? = throw Exception() +fun strangeNullableList(f: (T) -> Unit): List? = throw Exception() fun emptyNullableListOfA(): List? = null //------------------------------- fun testExclExcl() { doList(emptyNullableListOfA()!!) //should be an error here - val l: List = id(emptyNullableListOfA()!!) + val l: List = id(emptyNullableListOfA()!!) doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase) } diff --git a/compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt b/compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt index 3be7ad04e94..a92c93b34a9 100644 --- a/compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt +++ b/compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt @@ -1,4 +1,4 @@ -fun devNull(obj: Any?) {} +fun devNull(obj: Any?) {} open class A { companion object { diff --git a/compiler/testData/diagnostics/tests/scopes/VisibilityInheritModifier.kt b/compiler/testData/diagnostics/tests/scopes/VisibilityInheritModifier.kt index b6885dfb852..8d3c9681e00 100644 --- a/compiler/testData/diagnostics/tests/scopes/VisibilityInheritModifier.kt +++ b/compiler/testData/diagnostics/tests/scopes/VisibilityInheritModifier.kt @@ -21,7 +21,7 @@ class E : D() { internal override fun self() = this fun test() { - val s : E = self() + val s : E = self() } } diff --git a/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.fir.kt b/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.fir.kt deleted file mode 100644 index b798c1f212e..00000000000 --- a/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A(val foo: Int) - -fun A.test(foo: String) { - val a: String = foo -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.kt b/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.kt index 81ef11ffd22..2943e9f18c9 100644 --- a/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.kt +++ b/compiler/testData/diagnostics/tests/scopes/implicitReceiverMemberVsParameter.kt @@ -1,5 +1,6 @@ +// FIR_IDENTICAL class A(val foo: Int) fun A.test(foo: String) { - val a: String = foo -} \ No newline at end of file + val a: String = foo +} diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.fir.kt deleted file mode 100644 index 90c26194add..00000000000 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.fir.kt +++ /dev/null @@ -1,33 +0,0 @@ -fun foo(init: A.() -> Unit) { } - -class A { - var x: Int = 0 - companion object { - val f = foo() { - x = 1 - } - } -} - -class B(val a: String) { - fun f() = 0 - companion object { - fun B.bar() = a + f() - } -} - -open class C { - fun bar() {} -} - -class E: C() { - - class D { - init { - with(C()) { - bar() - this.bar() - } - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt index 3212cae4cd1..4b18919d89b 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt @@ -1,4 +1,5 @@ -fun foo(init: A.() -> Unit) { } +// FIR_IDENTICAL +fun foo(init: A.() -> Unit) { } class A { var x: Int = 0 @@ -30,4 +31,4 @@ class E: C() { } } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.fir.kt deleted file mode 100644 index b991bb9c2c4..00000000000 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FILE: A.java -public class A { - public static int foo() {return 1;} -} - -// FILE: B.java -public class B extends A { - public static int foo() {return 1;} -} - -// FILE: 1.kt - -fun foo() = "" - -class C: B() { - init { - val a: Int = foo() - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt index 33d2f37b2ab..4b1e5f1454c 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java public class A { public static int foo() {return 1;} @@ -14,6 +15,6 @@ fun foo() = "" class C: B() { init { - val a: Int = foo() + val a: Int = foo() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt1580.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt1580.fir.kt deleted file mode 100644 index 925f7dab9b6..00000000000 --- a/compiler/testData/diagnostics/tests/scopes/kt1580.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -//FILE:a.kt -//KT-1580 Can't access nested class/interface from other package -package lib -interface WithInner { - interface Inner { - } -} - -//FILE:b.kt -package user - -import lib.WithInner - -fun main(a : WithInner, b : WithInner.Inner) { -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/kt1580.kt b/compiler/testData/diagnostics/tests/scopes/kt1580.kt index a0775c494fb..3b6cf1f8b07 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1580.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1580.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //FILE:a.kt //KT-1580 Can't access nested class/interface from other package package lib @@ -11,5 +12,5 @@ package user import lib.WithInner -fun main(a : WithInner, b : WithInner.Inner) { -} \ No newline at end of file +fun main(a : WithInner, b : WithInner.Inner) { +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt1942.kt b/compiler/testData/diagnostics/tests/scopes/kt1942.kt index 3dd654104cd..195bec8efbe 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1942.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1942.kt @@ -14,6 +14,6 @@ import a.C class A : C() { fun test() { - val v = myValue + val v = myValue } } diff --git a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt index c50727d0459..40cca83eb53 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt @@ -5,15 +5,15 @@ import java.util.HashMap //KT-250 Incorrect variable resolve in constructor arguments of superclass open class A(val x: Int) -class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated +class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated //KT-617 Prohibit dollars in call to superclass constructors -open class M(p: Int) +open class M(p: Int) class N(val p: Int) : A($p) //KT-10 Don't allow to use properties in supertype initializers open class Element() -class TextElement(name: String) : Element() +class TextElement(name: String) : Element() abstract class Tag(val name : String) { val children = ArrayList() @@ -36,7 +36,7 @@ class Body1() : BodyTag(this.name //more tests -open class X(p: Int, r: Int) { +open class X(p: Int, r: Int) { val s = "s" } @@ -46,4 +46,4 @@ class Y(i: Int) : X(i, rrr) { class Z(val i: Int) : X(s, x) { val x = 2 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt323.kt b/compiler/testData/diagnostics/tests/scopes/kt323.kt index f66b25aa25f..645ac01a58b 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt323.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt323.kt @@ -10,9 +10,9 @@ class B : A() { var b : Int public get() = 23 - set(i: Int) {} + set(i: Int) {} protected var c : Int get() = 23 - private set(i: Int) {} -} \ No newline at end of file + private set(i: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt900-1.kt b/compiler/testData/diagnostics/tests/scopes/kt900-1.kt index dd64c8a044a..55602aa81bd 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt900-1.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt900-1.kt @@ -5,8 +5,8 @@ import c.A.Companion.B import c.M.* fun foo() { - val b: B = B() - var r: R = R() + val b: B = B() + var r: R = R() } class A() { @@ -21,4 +21,4 @@ class A() { object M { fun foo() {} class R() {} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt900.kt b/compiler/testData/diagnostics/tests/scopes/kt900.kt index 714f9f21d91..54747e57fcd 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt900.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt900.kt @@ -4,7 +4,7 @@ package a fun foo() { - val b : B = B() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved + val b : B = B() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved B.foo() P.foo() @@ -40,7 +40,7 @@ import b.A.Companion.P import b.A.Companion.B fun foo() { - val b : B = B() + val b : B = B() B.foo() P.foo() @@ -66,4 +66,4 @@ object N { object M { fun bar() {} } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/script/ComplexScript.kts b/compiler/testData/diagnostics/tests/script/ComplexScript.kts index bc9bce6e138..c4ee3cbd13b 100644 --- a/compiler/testData/diagnostics/tests/script/ComplexScript.kts +++ b/compiler/testData/diagnostics/tests/script/ComplexScript.kts @@ -1,6 +1,6 @@ // !DIAGNOSICS: +UNUSED_PARAMETER -fun foo(x: Int) = 1 +fun foo(x: Int) = 1 val y = 2 diff --git a/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.kts b/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.kts index c82d462b7e3..40d2fcc8b97 100644 --- a/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.kts +++ b/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.kts @@ -6,9 +6,9 @@ val String.testExtVal: Int get() = 42 val String.testExtValNoType get() = 42 -var testVar: Int get() = 42; set(value) {} +var testVar: Int get() = 42; set(value) {} -var String.testExtVar: Int get() = 42; set(value) {} +var String.testExtVar: Int get() = 42; set(value) {} val testValLineBreak: Int get() = 42 @@ -24,11 +24,11 @@ get() = 42 var testVarLineBreak: Int get() = 42 -set(value) {} +set(value) {} var String.testExtVarLineBreak: Int get() = 42 -set(value) {} +set(value) {} var testVarLineBreakSemi: Int; get() = 42 diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowLambdaParameter.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowLambdaParameter.kt index 0bcb8f31de6..3292820bf36 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowLambdaParameter.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowLambdaParameter.kt @@ -5,9 +5,9 @@ fun foo2(i: (Int, Int) -> Unit) {} fun foo3(i: (Pair) -> Unit) {} fun bar(x: Int, y: Int) { - foo1 { x -> x } + foo1 { x -> x } foo2 { x: Int, y: Int -> x + y } foo3 { (x, y) -> x + y } } -data class Pair(val a: Int, val b: Int) \ No newline at end of file +data class Pair(val a: Int, val b: Int) diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowMultiDeclarationWithFunParameter.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowMultiDeclarationWithFunParameter.kt index 8b49aa2d551..bfc7f094c94 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowMultiDeclarationWithFunParameter.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowMultiDeclarationWithFunParameter.kt @@ -6,9 +6,9 @@ class A { fun foo(a: A, c: Int) { val (a, b) = a val arr = Array(2) { A() } - for ((c, d) in arr) { + for ((c, d) in arr) { } - val e = a.toString() + b + c + val e = a.toString() + b + c } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInFunctionBody.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInFunctionBody.kt index ba6fafe7a02..fb210cfba51 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInFunctionBody.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInFunctionBody.kt @@ -1,4 +1,4 @@ -fun f(p: Int): Int { +fun f(p: Int): Int { val p = 2 return p } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt index 3ed0cdd3541..e3e91fbe857 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt @@ -1,7 +1,7 @@ -fun f(i: Int) { +fun f(i: Int) { for (j in 1..100) { - { - var i = 12 - } + { + var i = 12 + } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt index dadd00da351..2fd755bdc1c 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt @@ -1,7 +1,7 @@ fun ff(): Int { var i = 1 - { - val i = 2 - } + { + val i = 2 + } return i -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt index c525b548841..f73d781953b 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt @@ -1,5 +1,5 @@ fun f(): Int { var i = 17 - { var i = 18 } + { var i = 18 } return i -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt index bc3cbfdf0f8..df83fb8c7b5 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt @@ -1,5 +1,5 @@ fun ff(): Int { var i = 1 - { i: Int -> i } + { i: Int -> i } return i } diff --git a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.fir.kt deleted file mode 100644 index 75dad0ee21b..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -package foo - -fun dispatch(request: Request) { - val url = request.getRequestURI() as String - - if (request.getMethod()?.length != 0) { - } -} - -interface Request { - fun getRequestURI(): String? - fun getMethod(): String? -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt b/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt index cc0b0e0dd27..1aa003f46b7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL package foo fun dispatch(request: Request) { - val url = request.getRequestURI() as String + val url = request.getRequestURI() as String if (request.getMethod()?.length != 0) { } diff --git a/compiler/testData/diagnostics/tests/smartCasts/dataFlowInfoForArguments.kt b/compiler/testData/diagnostics/tests/smartCasts/dataFlowInfoForArguments.kt index 5fe449365a0..55c7d46a1e9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/dataFlowInfoForArguments.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/dataFlowInfoForArguments.kt @@ -1,6 +1,6 @@ package aaa -fun bar(a: Int, b: Int) {} +fun bar(a: Int, b: Int) {} fun foo(a: Int?) { bar(a!!, a) diff --git a/compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt b/compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt index 7e849803919..598fd1580b3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/incDecToNull.kt @@ -4,7 +4,7 @@ class IncDec { fun foo(): IncDec { var x = IncDec() - x = x++ + x = x++ x++ return x } diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/dependentOnPrevArg.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/dependentOnPrevArg.kt index ef7f84e1b3b..9005c033a85 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/dependentOnPrevArg.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/dependentOnPrevArg.kt @@ -1,7 +1,7 @@ package a -fun foo(u: T, v: T): T = u +fun foo(u: T, v: T): T = u fun test(s: String?) { - val r: String = foo(s!!, s) -} \ No newline at end of file + val r: String = foo(s!!, s) +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.fir.kt index a5726756c33..c2269721d49 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.fir.kt @@ -32,7 +32,7 @@ fun test(a: A, b: B, c: C) { checkSubtype(k) checkSubtype(k) val l: Int = three(a, b, c) - + use(d, e, f, g, h, k, l) } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt index be7f514adc3..02f9cd386a5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt @@ -7,9 +7,9 @@ import checkSubtype fun id(t: T): T = t -fun two(u: T, v: T): T = u +fun two(u: T, v: T): T = u -fun three(a: T, b: T, c: T): T = c +fun three(a: T, b: T, c: T): T = c interface A interface B: A @@ -32,12 +32,12 @@ fun test(a: A, b: B, c: C) { checkSubtype(k) checkSubtype(k) val l: Int = three(a, b, c) - + use(d, e, f, g, h, k, l) } } -fun foo(t: T, l: MutableList): T = t +fun foo(t: T, l: MutableList): T = t fun testErrorMessages(a: A, ml: MutableList) { if (a is B && a is C) { @@ -58,6 +58,6 @@ fun rr(s: String?) { } //from library -fun arrayListOf(vararg values: T): MutableList = throw Exception() +fun arrayListOf(vararg values: T): MutableList = throw Exception() fun use(vararg a: Any) = a diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt index 68c1624d0bf..3a7956a96ed 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt @@ -35,6 +35,4 @@ public data class Tag(public var tagName: String) { //from library operator fun MutableMap.set(key : K, value : V) = this.put(key, value) -fun arrayListOf(vararg values: T): MutableList = throw Exception() - - +fun arrayListOf(vararg values: T): MutableList = throw Exception() diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt index 33c75b8cc71..09ba33abeab 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt @@ -1,10 +1,10 @@ //KT-2746 Do.smartcasts in inference -class C(t :T) +class C(t :T) fun test1(a: Any) { if (a is String) { - val c: C = C(a) + val c: C = C(a) } } @@ -13,6 +13,6 @@ fun f(t :T): C = C(t) fun test2(a: Any) { if (a is String) { - val c1: C = f(a) + val c1: C = f(a) } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt index a0779561177..fae3ffc8f19 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt @@ -10,7 +10,7 @@ fun main() { } } -fun foo(map: Pair) {} +fun foo(map: Pair) {} //from library diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt4403.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt4403.kt index 71f2c591f58..7fa4a671fc8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt4403.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt4403.kt @@ -7,5 +7,5 @@ fun T.f(): T = this fun test(a: A) { if (a !is B) return - val c = a.f() // type mismatch -} \ No newline at end of file + val c = a.f() // type mismatch +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt4415.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt4415.kt index cced68127f8..729e65b513c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt4415.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt4415.kt @@ -3,7 +3,7 @@ interface SelfJson object A { - fun find(clz:Class<*>){ } + fun find(clz:Class<*>){ } fun toJson2(obj:Any){ if(obj is SelfJson){ diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt1461.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt1461.fir.kt deleted file mode 100644 index bda384bf859..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/kt1461.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -//KT-1461 Front-end complains on overload resolution when superclass property is accessed from string template and implicit type cast is performed -package f - -open class Super(val property : String) {} - -class Sub(str : String) : Super(str) {} - -fun foo(sup : Super, sub : Sub) { - if (sup is Sub) { - println("${sup.property}") - println(sup.property) - } - println("${sub.property}") - println(sub.property) -} - -//from library -fun println(message : Any?) { throw Exception() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt1461.kt b/compiler/testData/diagnostics/tests/smartCasts/kt1461.kt index 585117a5696..f1a6943bb78 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt1461.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt1461.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-1461 Front-end complains on overload resolution when superclass property is accessed from string template and implicit type cast is performed package f @@ -15,4 +16,4 @@ fun foo(sup : Super, sub : Sub) { } //from library -fun println(message : Any?) { throw Exception() } \ No newline at end of file +fun println(message : Any?) { throw Exception() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt2865.kt b/compiler/testData/diagnostics/tests/smartCasts/kt2865.kt index adbf52f7c6b..ec7305cbef6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt2865.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt2865.kt @@ -1,5 +1,5 @@ // !WITH_NEW_INFERENCE -operator fun MutableMap.set(k: K, v: V) {} +operator fun MutableMap.set(k: K, v: V) {} fun foo(a: MutableMap, x: String?) { a[x!!] = x diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt index db7a36d3b9b..a301ad8ad3a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt @@ -4,6 +4,6 @@ infix fun String.to(second: String) = StringPair(this, second) fun f(a: String?) { if (a != null) { - val b: StringPair = a to a + val b: StringPair = a to a } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3899.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3899.fir.kt index 23fc330973c..70b1312bca0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3899.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3899.fir.kt @@ -9,5 +9,5 @@ fun F() : MutableMap { val value: String? = "xyz" if (value == null) throw Error() // Smart cast should be here - return hashMapOf("sss" to value) -} \ No newline at end of file + return hashMapOf("sss" to value) +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt index 2a3b7c0ae86..cea2516c3a3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt @@ -2,12 +2,12 @@ data class StringPair(val first: String, val second: String) infix fun String.to(second: String) = StringPair(this, second) -fun hashMapOf(pair: StringPair): MutableMap { +fun hashMapOf(pair: StringPair): MutableMap { } fun F() : MutableMap { val value: String? = "xyz" if (value == null) throw Error() // Smart cast should be here - return hashMapOf("sss" to value) -} \ No newline at end of file + return hashMapOf("sss" to value) +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgument.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgument.kt index 5792a3f89a0..ebaa55f15c6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgument.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgument.kt @@ -2,7 +2,7 @@ inline fun foo(t1: T, t2: T) = t1 ?: t2 -inline fun bar(l: (T) -> Unit): T = null!! +inline fun bar(l: (T) -> Unit): T = null!! fun use() { var x: Int? diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgumentFun.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgumentFun.kt index 0cbe4c4629b..a3bc6dee3d5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgumentFun.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaAndArgumentFun.kt @@ -2,7 +2,7 @@ // See KT-9143: smart cast on a variable nulled inside a lambda argument inline fun foo(t1: T, t2: T) = t1 ?: t2 -inline fun bar(l: (T) -> Unit): T = null!! +inline fun bar(l: (T) -> Unit): T = null!! fun use() { var x: Int? diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt index e11188b6bdf..f4d231d2d0f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithBoundWithoutType.kt @@ -22,5 +22,5 @@ val foofoo: Foo = run { val bar: Bar = run { val x = foo() if (x == null) throw Exception() - x + x } diff --git a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithoutTypeIfMerge.kt b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithoutTypeIfMerge.kt index 6a603a324c8..ef688667d04 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithoutTypeIfMerge.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/lambdaArgumentWithoutTypeIfMerge.kt @@ -1,6 +1,6 @@ // See also KT-7817 -fun synchronized(lock: Any, block: () -> R): R = block() +fun synchronized(lock: Any, block: () -> R): R = block() class My { val test: String @@ -11,4 +11,4 @@ class My { } x } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.fir.kt index ab64f87ef3e..65a464945d2 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.fir.kt @@ -2,7 +2,7 @@ fun trans(n: Int, f: () -> Boolean) = if (f()) n else null fun foo() { - var i: Int? = 5 + var i: Int? = 5 if (i != null) { fun can(): Boolean { i = null diff --git a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt index 11537043f3f..c999b0d0786 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/localFunChanges.kt @@ -2,14 +2,14 @@ fun trans(n: Int, f: () -> Boolean) = if (f()) n else null fun foo() { - var i: Int? = 5 + var i: Int? = 5 if (i != null) { fun can(): Boolean { i = null return true } i.hashCode() - trans(i, ::can) + trans(i, ::can) i.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt index cdfdca72128..f1b81d051c9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt @@ -2,9 +2,9 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // Exotic variant with unused literal - do { -> + do { -> p!!.length - } while (!x()) + } while (!x()) // Literal is not called so p.length is unsafe return p.length -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/captured.kt index 158b6c22d25..3a212020d76 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/safecalls/safeAccessReceiverNotNull.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.kt index 139653e644f..13f79d76f0d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.kt @@ -71,7 +71,7 @@ class A(val y: Int) fun kt7491_1() { val x: A? = A(42) - val z = x?.y ?: return + val z = x?.y ?: return x.y } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt index 67884b2c8da..c966f96e050 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.kt @@ -6,5 +6,5 @@ fun foo(x: Int, f: () -> Unit, y: Int) {} fun bar() { var x: Int? x = 4 - foo(x, { x = null; x.hashCode() }, x) + foo(x, { x = null; x.hashCode() }, x) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt index c6af27d8ad7..1b734d49bd8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/property.kt @@ -7,5 +7,5 @@ fun bar(s: String): Int { fun foo(m: MyClass): Int { m.p = "xyz" - return bar(m.p) + return bar(m.p) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.kt index c1248f74030..a591436706c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.kt @@ -55,7 +55,7 @@ fun test4() { fun test5() { var a: Int?// = null try { - a = 3 + a = 3 } catch (e: Exception) { return @@ -68,7 +68,7 @@ fun test5() { fun test6() { var a: Int?// = null try { - a = 3 + a = 3 } catch (e: Exception) { return diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt index a5ef4b3718a..91cfdaff869 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varCapturedInInlineClosure.kt @@ -9,7 +9,7 @@ fun IntArray.forEachIndexed( op: (i: Int, value: Int) -> Unit) { fun max(a: IntArray): Int? { var maxI: Int? = null a.forEachIndexed { i, value -> - if (maxI == null || value >= a[maxI]) + if (maxI == null || value >= a[maxI]) maxI = i } return maxI diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.fir.kt deleted file mode 100644 index 80e56ac8127..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -public fun foo() { - var i: Int? = 1 - if (i != null) { - while (i != 10) { - i++ // Here smart cast should not be performed due to a successor - i = null - } - } -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.kt index 93b716800fd..1896a7954ed 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varChangedInLoop.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL public fun foo() { var i: Int? = 1 if (i != null) { while (i != 10) { - i++ // Here smart cast should not be performed due to a successor + i++ // Here smart cast should not be performed due to a successor i = null } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/propertyAccessors.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/propertyAccessors.kt index a65a8e62731..28bfadf4c27 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/propertyAccessors.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/propertyAccessors.kt @@ -10,23 +10,23 @@ val v2 = "" var v3: String @SinceKotlin("1.1") get() = "" - set(value) {} + set(value) {} var v4: String get() = "" @SinceKotlin("1.1") - set(value) {} + set(value) {} var v5: String @SinceKotlin("1.1") get() = "" @SinceKotlin("1.1") - set(value) {} + set(value) {} @SinceKotlin("1.1") var v6: String get() = "" - set(value) {} + set(value) {} @SinceKotlin("1.0") val v7: String diff --git a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt index 016eed78e41..68186eb01d4 100644 --- a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt +++ b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt @@ -1,8 +1,8 @@ package h -public class MyClass(param: MyClass) { +public class MyClass(param: MyClass) { fun test() { val result: MyClass? = null MyClass(result as MyClass) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt index 13b20d49921..cae112dc688 100644 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt @@ -2,12 +2,12 @@ // FILE: foo.kt package foo -fun f(l: List) {} +fun f(l: List) {} // FILE: bar.kt package bar -fun f(l: List) {} +fun f(l: List) {} // FILE: main.kt diff --git a/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt b/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt deleted file mode 100644 index 034d6a928af..00000000000 --- a/compiler/testData/diagnostics/tests/subtyping/kt2744.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -class X : S - -fun f(l: List) {} diff --git a/compiler/testData/diagnostics/tests/subtyping/kt2744.kt b/compiler/testData/diagnostics/tests/subtyping/kt2744.kt index 83030b96456..f9ceb42c921 100644 --- a/compiler/testData/diagnostics/tests/subtyping/kt2744.kt +++ b/compiler/testData/diagnostics/tests/subtyping/kt2744.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class X : S -fun f(l: List) {} +fun f(l: List) {} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.fir.kt deleted file mode 100644 index 7371bbcfc79..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.fir.kt +++ /dev/null @@ -1,31 +0,0 @@ -// FILE: KotlinFile.kt -open class KotlinClass1 : JavaClass1() { - public fun getSomethingKotlin1(): Int = 1 -} - -class KotlinClass2 : JavaClass2() { - public fun getSomethingKotlin2(): Int = 1 -} - -fun foo(k: KotlinClass2) { - useInt(k.getSomething1()) - useInt(k.something1) - useInt(k.getSomething2()) - useInt(k.something2) - useInt(k.getSomethingKotlin1()) - useInt(k.getSomethingKotlin2()) - k.somethingKotlin1 - k.somethingKotlin2 -} - -fun useInt(i: Int) {} - -// FILE: JavaClass1.java -public class JavaClass1 { - public int getSomething1() { return 1; } -} - -// FILE: JavaClass2.java -public class JavaClass2 extends KotlinClass1 { - public int getSomething2() { return 1; } -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt index 9eb9f40821b..63b910a94f9 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Bases.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: KotlinFile.kt open class KotlinClass1 : JavaClass1() { public fun getSomethingKotlin1(): Int = 1 @@ -18,7 +19,7 @@ fun foo(k: KotlinClass2) { k.somethingKotlin2 } -fun useInt(i: Int) {} +fun useInt(i: Int) {} // FILE: JavaClass1.java public class JavaClass1 { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt index 56f9bd2f56e..7bd2c1230c9 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Getter.kt @@ -12,7 +12,7 @@ fun foo(javaClass: JavaClass, kotlinClass: KotlinClass) { kotlinClass.something } -fun useInt(i: Int) {} +fun useInt(i: Int) {} // FILE: JavaClass.java public class JavaClass { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.fir.kt deleted file mode 100644 index 084edcc7941..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FILE: KotlinFile.kt -fun JavaClass.foo() { - useInt(getSomething()) - useInt(something) -} - -fun useInt(i: Int) {} - -// FILE: JavaClass.java -public class JavaClass { - public int getSomething() { return 1; } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt index f8aa9d9af1c..a8a1ecd6fa8 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/ImplicitReceiver.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL // FILE: KotlinFile.kt fun JavaClass.foo() { useInt(getSomething()) useInt(something) } -fun useInt(i: Int) {} +fun useInt(i: Int) {} // FILE: JavaClass.java public class JavaClass { public int getSomething() { return 1; } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt index ca18c9b15bc..daf83210de7 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/JavaOverridesKotlin.kt @@ -13,7 +13,7 @@ fun foo(javaClass: JavaClass) { javaClass.something2 = javaClass.something2 + 1 } -fun useInt(i: Int) {} +fun useInt(i: Int) {} // FILE: JavaClass.java public class JavaClass extends KotlinClass implements JavaInterface { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt index c57cb72afa5..db38eecdad5 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava.kt @@ -32,8 +32,8 @@ fun foo(k: KotlinClass) { k.something5 = 1 } -fun useInt(i: Int) {} -fun useString(i: String) {} +fun useInt(i: Int) {} +fun useString(i: String) {} // FILE: JavaClass.java public class JavaClass { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt index fadda63cd94..9b596206351 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava2.kt @@ -12,7 +12,7 @@ fun foo(k: KotlinClass) { k.something = 1 } -fun useString(i: String) {} +fun useString(i: String) {} // FILE: JavaInterface1.java public interface JavaInterface1 { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt index 568078acfd3..13ee9e915a2 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava3.kt @@ -12,7 +12,7 @@ fun foo(k: KotlinClass) { k.something = "" } -fun useString(i: String) {} +fun useString(i: String) {} // FILE: JavaInterface1.java public interface JavaInterface1 { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt index ef65896c7cb..186687c66f1 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava4.kt @@ -12,7 +12,7 @@ fun foo(k: KotlinClass) { k.something = "" } -fun useString(i: String) {} +fun useString(i: String) {} // FILE: JavaInterface1.java public interface JavaInterface1 { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt index 69e516b4abc..6222d8d0687 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/KotlinOverridesJava5.kt @@ -12,7 +12,7 @@ fun foo(k: KotlinClass) { k.something = "" } -fun useString(i: String) {} +fun useString(i: String) {} // FILE: JavaInterface1.java public interface JavaInterface1 { diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt index c8e14d5333b..47a6facc73d 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt @@ -8,7 +8,7 @@ fun foo(o: JavaClass2) { o.something += "1" } -fun useString(i: String) {} +fun useString(i: String) {} // FILE: JavaClass1.java public class JavaClass1 { @@ -19,4 +19,4 @@ public class JavaClass1 { // FILE: JavaClass2.java public class JavaClass2 extends JavaClass1 { public String getSomething() { return ""; } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.kt index d0d8de0a565..99d477dbb07 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.kt @@ -4,7 +4,7 @@ package k import JavaClass fun foo(javaClass: JavaClass) { - val v = javaClass.something + val v = javaClass.something javaClass.something = 1 javaClass.something++ } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt index c9781637d70..9240e501a88 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt @@ -1,7 +1,7 @@ // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass): String { - return javaClass.doSomething("", 1) { s: String -> "" } + return javaClass.doSomething("", 1) { s: String -> "" } } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt index f715eebf393..551aeadc9e5 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericMethodInGenericClass.kt @@ -1,8 +1,8 @@ // JAVAC_EXPECTED_FILE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { - val a: String = javaClass.doSomething1("", 1) { p: String -> p } - val b: String = javaClass.doSomething2("", 1, true) { p: Int -> p } + val a: String = javaClass.doSomething1("", 1) { p: String -> p } + val b: String = javaClass.doSomething2("", 1, true) { p: Int -> p } } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/tailRecOverridden.kt b/compiler/testData/diagnostics/tests/tailRecOverridden.kt index 4656d7284df..54c792ad103 100644 --- a/compiler/testData/diagnostics/tests/tailRecOverridden.kt +++ b/compiler/testData/diagnostics/tests/tailRecOverridden.kt @@ -26,7 +26,7 @@ class C: A() { gav(y - 1, z - 1) } - tailrec fun bar(y: Int = 1, z: Int = 2) { + tailrec fun bar(y: Int = 1, z: Int = 2) { bar(z) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt index 9d5405ca797..1ddb920271f 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt @@ -16,13 +16,13 @@ class A1 { class A2() @JvmRecord -class A3(name: String) +class A3(name: String) @JvmRecord class A4(var name: String) @JvmRecord -class A5(vararg val name: String, y: Int) +class A5(vararg val name: String, y: Int) @JvmRecord open class A6(val x: String) diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt b/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt index f5e3a64f79e..44ee170f410 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt @@ -1,12 +1,12 @@ // FILE: f.kt class A() { fun foo() : Unit { - this@A + this@A this@a - this + this } val x = this@A.foo() val y = this.foo() val z = foo() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt b/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt index bbdf9072f5f..faae9b8eb87 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/superInExtensionFunctionCall.kt @@ -1,6 +1,6 @@ // No supertype at all -fun Any.extension(arg: Any?) {} +fun Any.extension(arg: Any?) {} class A1 { fun test() { diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt b/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt index 35934fb79a4..373a27ce618 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt @@ -1,12 +1,12 @@ -fun any(a : Any) {} +fun any(a : Any) {} fun notAnExpression() { any(super) // not an expression if (super) {} else {} // not an expression - val x = super // not an expression + val x = super // not an expression when (1) { - super -> 1 // not an expression + super -> 1 // not an expression else -> {} } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/thisInFunctionLiterals.kt b/compiler/testData/diagnostics/tests/thisAndSuper/thisInFunctionLiterals.kt index bffe069dc0b..4b02c244a39 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/thisInFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/thisInFunctionLiterals.kt @@ -4,15 +4,15 @@ class A(val a:Int) { inner class B() { fun Byte.xx() : Double.() -> Any { checkSubtype(this) - val a: Double.() -> Unit = { + val a: Double.() -> Unit = { checkSubtype(this) checkSubtype(this@xx) checkSubtype(this@B) checkSubtype(this@A) } - val b: Double.() -> Unit = a@{ checkSubtype(this@a) + checkSubtype(this@xx) } - val c = a@{ -> this@a + checkSubtype(this@xx) } + val b: Double.() -> Unit = a@{ checkSubtype(this@a) + checkSubtype(this@xx) } + val c = a@{ -> this@a + checkSubtype(this@xx) } return (a@{checkSubtype(this@a) + checkSubtype(this@xx)}) } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt index a29b5460edd..1a8c99b9c79 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingInReturnPosition.kt @@ -93,7 +93,7 @@ interface RenderContext val emptyOrNull: List? = null val x = emptyOrNull?.get(0) -val errorCompletion = { e: Throwable -> throw Exception() } +val errorCompletion = { e: Throwable -> throw Exception() } fun test1() { errorCompletion(Exception("fail")) diff --git a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt index 0553d167d1e..c21d0bbe30b 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt @@ -18,6 +18,6 @@ private object Scope { fun materialize(): T = Any() as T fun test(i: Inv) { - val p: Int by Scope.Delegate(i) + val p: Int by Scope.Delegate(i) } } diff --git a/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.fir.kt b/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.fir.kt deleted file mode 100644 index fe4d61cd67c..00000000000 --- a/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -object AnObject { - val ok = "OK" - fun foo() = "OK" -} - -typealias GenericTestObject = AnObject - -val test11: AnObject = GenericTestObject -val test12: GenericTestObject<*> = GenericTestObject -val test13: String = GenericTestObject.ok -val test14: String = GenericTestObject.foo() - -class GenericClassWithCompanion { - companion object { - val ok = "OK" - fun foo() = "OK" - } -} - -typealias TestGCWC = GenericClassWithCompanion - -val test25: GenericClassWithCompanion.Companion = TestGCWC -val test26 = TestGCWC -val test27: String = TestGCWC.ok -val test28: String = TestGCWC.foo() diff --git a/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.kt b/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.kt index 507aa9d889b..c241b5f4b71 100644 --- a/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.kt +++ b/compiler/testData/diagnostics/tests/typealias/genericTypeAliasObject.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL object AnObject { val ok = "OK" fun foo() = "OK" } -typealias GenericTestObject<T> = AnObject +typealias GenericTestObject = AnObject val test11: AnObject = GenericTestObject val test12: GenericTestObject<*> = GenericTestObject diff --git a/compiler/testData/diagnostics/tests/typealias/illegalTypeInTypeAliasExpansion.kt b/compiler/testData/diagnostics/tests/typealias/illegalTypeInTypeAliasExpansion.kt index 09eb1165aca..c8218024c03 100644 --- a/compiler/testData/diagnostics/tests/typealias/illegalTypeInTypeAliasExpansion.kt +++ b/compiler/testData/diagnostics/tests/typealias/illegalTypeInTypeAliasExpansion.kt @@ -7,6 +7,6 @@ typealias AAN = AA typealias AAN2 = A> -typealias FirstY> = List +typealias First = List typealias UnusedAN1 = FirstArray> typealias UnusedAN2 = First> // TODO diff --git a/compiler/testData/diagnostics/tests/typealias/substitutionVariance.kt b/compiler/testData/diagnostics/tests/typealias/substitutionVariance.kt index 288770ee2b3..a593abfe1f3 100644 --- a/compiler/testData/diagnostics/tests/typealias/substitutionVariance.kt +++ b/compiler/testData/diagnostics/tests/typealias/substitutionVariance.kt @@ -7,17 +7,17 @@ class Inv typealias In1 = In typealias In2 = In<in T> typealias In3 = In<out T> -typealias In4<T> = In<*> +typealias In4 = In<*> typealias Out1 = Out typealias Out2 = Out<in T> typealias Out3 = Out<out T> -typealias Out4<T> = Out<*> +typealias Out4 = Out<*> typealias Inv1 = Inv typealias Inv2 = Inv typealias Inv3 = Inv -typealias Inv4<T> = Inv<*> +typealias Inv4 = Inv<*> val inv1: Inv1 = Inv() diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.kt index 75ab9223ce8..28a30c4006a 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.kt @@ -2,8 +2,8 @@ typealias L = List typealias NL = List? -typealias LStar<T> = List<*> -typealias MyList<T, X> = List +typealias LStar = List<*> +typealias MyList = List fun testL1(x: Collection) = x is L fun testL2(x: Collection): List = x as L diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInSuperCall.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInSuperCall.kt index 5ea5d5b070d..5a594083fa7 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInSuperCall.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInSuperCall.kt @@ -1,5 +1,5 @@ open class MyBase protected constructor() { - protected constructor(x: Nothing?): this() + protected constructor(x: Nothing?): this() } typealias MyAlias = MyBase diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasShouldExpandToClass.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasShouldExpandToClass.kt index cb983b263cb..3dfdc3e6e5f 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasShouldExpandToClass.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasShouldExpandToClass.kt @@ -2,7 +2,7 @@ typealias ToTypeParam1 = T typealias ToTypeParam2 = ToTypeParam1 -typealias ToTypeParam3T2> = ToTypeParam2 +typealias ToTypeParam3 = ToTypeParam2 typealias ToTypeParam4 = ToTypeParam1 typealias ToFun1 = () -> Unit @@ -11,6 +11,6 @@ typealias ToFun2 = (T) -> Unit class Outer { typealias ToTypeParam1 = T typealias ToTypeParam2 = ToTypeParam1 - typealias ToTypeParam3T2> = ToTypeParam2 + typealias ToTypeParam3 = ToTypeParam2 typealias ToTypeParam4 = ToTypeParam1 } diff --git a/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.fir.kt b/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.fir.kt index 578801571ad..fa313d97750 100644 --- a/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.fir.kt @@ -1,3 +1,3 @@ -// !DIAGNOSICS: +UNUSED_TYPEALIAS_PARAMETER +// !DIAGNOSTICS: +UNUSED_TYPEALIAS_PARAMETER typealias Test = List typealias Test2 = Test diff --git a/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.kt b/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.kt index 3f05904628c..17911a1565a 100644 --- a/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.kt +++ b/compiler/testData/diagnostics/tests/typealias/unusedTypeAliasParameter.kt @@ -1,3 +1,3 @@ -// !DIAGNOSICS: +UNUSED_TYPEALIAS_PARAMETER +// !DIAGNOSTICS: +UNUSED_TYPEALIAS_PARAMETER typealias TestX> = List typealias Test2X> = Test diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt index f3b19824d1e..1fdf84bdf72 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt @@ -63,7 +63,7 @@ fun test() { takeUByte(LONG_CONST) takeUByte(NON_CONST) - takeUByte(BIGGER_THAN_UBYTE) + takeUByte(BIGGER_THAN_UBYTE) takeUByte(UINT_CONST) takeUIntWithoutAnnotaion(IMPLICIT_INT) } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/unsignedLiteralsOn1_2.kt b/compiler/testData/diagnostics/tests/unsignedTypes/unsignedLiteralsOn1_2.kt index d3996077681..39b907a7c7c 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/unsignedLiteralsOn1_2.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/unsignedLiteralsOn1_2.kt @@ -3,4 +3,4 @@ val a = 0u val b = 1uL -fun foo(u: UInt) {} \ No newline at end of file +fun foo(u: UInt) {} diff --git a/compiler/testData/diagnostics/tests/varargs/AmbiguousVararg.kt b/compiler/testData/diagnostics/tests/varargs/AmbiguousVararg.kt index c6dde07bd9f..3800f94860c 100644 --- a/compiler/testData/diagnostics/tests/varargs/AmbiguousVararg.kt +++ b/compiler/testData/diagnostics/tests/varargs/AmbiguousVararg.kt @@ -1,6 +1,6 @@ -fun foo(vararg t : String) = "" -fun foo(vararg t : Int) = "" +fun foo(vararg t : String) = "" +fun foo(vararg t : Int) = "" fun test() { foo() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.fir.kt b/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.fir.kt deleted file mode 100644 index d820de2c83f..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun main(d : D) { - d.from("") - d.from(1) -} - -class D { - fun from(vararg a : Any){} - fun from(vararg a : String){} -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.kt b/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.kt index ef8688c4899..0d3cd4a3b9a 100644 --- a/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.kt +++ b/compiler/testData/diagnostics/tests/varargs/MoreSpecificVarargsOfEqualLength.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL fun main(d : D) { d.from("") d.from(1) } class D { - fun from(vararg a : Any){} - fun from(vararg a : String){} -} \ No newline at end of file + fun from(vararg a : Any){} + fun from(vararg a : String){} +} diff --git a/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.fir.kt b/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.fir.kt deleted file mode 100644 index 15e7efdc923..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun foo0() : String = "noarg" - -fun foo0(vararg t : Int) : String = "vararg" - -fun test0() { - foo0() - foo0(1) - val a = IntArray(0) - foo0(*a) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.kt b/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.kt index 9cd35047fae..d9b53341bc1 100644 --- a/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.kt +++ b/compiler/testData/diagnostics/tests/varargs/NilaryVsVararg.kt @@ -1,10 +1,11 @@ +// FIR_IDENTICAL fun foo0() : String = "noarg" -fun foo0(vararg t : Int) : String = "vararg" +fun foo0(vararg t : Int) : String = "vararg" fun test0() { foo0() foo0(1) val a = IntArray(0) foo0(*a) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.fir.kt b/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.fir.kt deleted file mode 100644 index 015513edea1..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun foo1(a : Int) : String = "noarg" - -fun foo1(a : Int, vararg t : Int) : String = "vararg" - -fun test1() { - foo1(1) - val a = IntArray(0) - foo1(1, *a) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.kt b/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.kt index 3fea2a65369..c2ee237ffba 100644 --- a/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.kt +++ b/compiler/testData/diagnostics/tests/varargs/UnaryVsVararg.kt @@ -1,9 +1,10 @@ -fun foo1(a : Int) : String = "noarg" +// FIR_IDENTICAL +fun foo1(a : Int) : String = "noarg" -fun foo1(a : Int, vararg t : Int) : String = "vararg" +fun foo1(a : Int, vararg t : Int) : String = "vararg" fun test1() { foo1(1) val a = IntArray(0) foo1(1, *a) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_3.kt b/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_3.kt index 59b89bb4c96..94171687179 100644 --- a/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_3.kt +++ b/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_3.kt @@ -20,7 +20,7 @@ fun test_fun(s: String, arr: Array) { } fun test_ann(s: String, arr: Array) { - @Ann([""], x = 1) + @Ann([""], x = 1) foo() @Ann(*[""], x = 1) foo() @@ -31,6 +31,6 @@ fun test_ann(s: String, arr: Array) { @Ann("", x = 1) foo() - @Ann(s = "", x = 1) + @Ann(s = "", x = 1) foo() } diff --git a/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_4.kt b/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_4.kt index 2d25dc50f1c..24dd6e14800 100644 --- a/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_4.kt +++ b/compiler/testData/diagnostics/tests/varargs/assignArrayToVararagInNamedForm_1_4.kt @@ -16,11 +16,11 @@ fun test_fun(s: String, arr: Array) { withVararg(s = *arr) // Warning withVararg(s) // OK - withVararg(s = s) // Error + withVararg(s = s) // Error } fun test_ann(s: String, arr: Array) { - @Ann([""], x = 1) + @Ann([""], x = 1) foo() @Ann(*[""], x = 1) foo() @@ -31,6 +31,6 @@ fun test_ann(s: String, arr: Array) { @Ann("", x = 1) foo() - @Ann(s = "", x = 1) + @Ann(s = "", x = 1) foo() } diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-param.fir.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-param.fir.kt deleted file mode 100644 index a6ab5e1ea02..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-param.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A(vararg t : Int) { - init { - val t1 : IntArray = t - } -} diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt index 39423b8d0a6..bf6aed051fc 100644 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt +++ b/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt @@ -1,5 +1,6 @@ +// FIR_IDENTICAL class A(vararg t : Int) { init { - val t1 : IntArray = t + val t1 : IntArray = t } } diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-val.fir.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-val.fir.kt deleted file mode 100644 index c63bf7396d3..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-val.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -class A(vararg val t : Int) { - init { - val t1 : IntArray = t - } -} diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt index b152fcadc0c..98f793456f4 100644 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt +++ b/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt @@ -1,5 +1,6 @@ +// FIR_IDENTICAL class A(vararg val t : Int) { init { - val t1 : IntArray = t + val t1 : IntArray = t } } diff --git a/compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt b/compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt index 65fec28db67..a3279d56229 100644 --- a/compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt +++ b/compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt @@ -21,27 +21,27 @@ fun test2() {} @Ann(s = arrayOf(1)) fun test3() {} -@Ann(s = ["value"]) +@Ann(s = ["value"]) fun test5() {} @JavaAnn(value = arrayOf("value")) fun jTest1() {} -@JavaAnn(value = ["value"]) +@JavaAnn(value = ["value"]) fun jTest2() {} -@JavaAnn(value = ["value"], path = ["path"]) +@JavaAnn(value = ["value"], path = ["path"]) fun jTest3() {} annotation class IntAnn(vararg val i: Int) -@IntAnn(i = [1, 2]) +@IntAnn(i = [1, 2]) fun foo1() {} @IntAnn(i = intArrayOf(0)) fun foo2() {} -fun foo(vararg i: Int) {} +fun foo(vararg i: Int) {} @Ann(s = "value") fun dep1() { diff --git a/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.fir.kt b/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.fir.kt deleted file mode 100644 index 7771bfe988e..00000000000 --- a/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun f(vararg t : Int, f : ()->Unit) { -} - -fun test() { - f {} - f() {} - f(1) { - - } - f(1, 2) { - - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.kt b/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.kt index 57bde281c46..58d8f77aaba 100644 --- a/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/varargs/varargsAndFunctionLiterals.kt @@ -1,4 +1,5 @@ -fun f(vararg t : Int, f : ()->Unit) { +// FIR_IDENTICAL +fun f(vararg t : Int, f : ()->Unit) { } fun test() { @@ -10,4 +11,4 @@ fun test() { f(1, 2) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt index 51583b0e413..5d5e4f2baf9 100644 --- a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt +++ b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt @@ -1,10 +1,10 @@ // !CHECK_TYPE -fun foo(vararg ts: T): T? = null +fun foo(vararg ts: T): T? = null -class Pair(a: A) +class Pair(a: A) fun test() { val v = foo(Pair(1)) checkSubtype(v) // check that it is not error type -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt b/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt index 7338a1f618e..0ed1277a0ee 100644 --- a/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt @@ -17,9 +17,9 @@ class Test( var type9: In<")!>I>, var type0: In<")!>O>, - type11: I, - type12: O, - type13: P, - type14: In, - type15: In + type11: I, + type12: O, + type13: P, + type14: In, + type15: In ) diff --git a/compiler/testData/diagnostics/tests/variance/VarProperty.kt b/compiler/testData/diagnostics/tests/variance/VarProperty.kt index 38dd3ff7f02..3c5378b3803 100644 --- a/compiler/testData/diagnostics/tests/variance/VarProperty.kt +++ b/compiler/testData/diagnostics/tests/variance/VarProperty.kt @@ -36,15 +36,15 @@ abstract class Test { abstract var In<")!>I>.receiver4: Int abstract var In.receiver5: Int - var X.typeParameter1: Int get() = 0; set(i) {} - var O> X.typeParameter2: Int get() = 0; set(i) {} - var X.typeParameter3: Int get() = 0; set(i) {} - var ")!>I>> X.typeParameter4: Int get() = 0; set(i) {} - var > X.typeParameter5: Int get() = 0; set(i) {} + var X.typeParameter1: Int get() = 0; set(i) {} + var O> X.typeParameter2: Int get() = 0; set(i) {} + var X.typeParameter3: Int get() = 0; set(i) {} + var ")!>I>> X.typeParameter4: Int get() = 0; set(i) {} + var > X.typeParameter5: Int get() = 0; set(i) {} - var X.typeParameter6: Int where X : I get() = 0; set(i) {} - var X.typeParameter7: Int where X : O get() = 0; set(i) {} - var X.typeParameter8: Int where X : P get() = 0; set(i) {} - var X.typeParameter9: Int where X : In<")!>I> get() = 0; set(i) {} - var X.typeParameter0: Int where X : In get() = 0; set(i) {} + var X.typeParameter6: Int where X : I get() = 0; set(i) {} + var X.typeParameter7: Int where X : O get() = 0; set(i) {} + var X.typeParameter8: Int where X : P get() = 0; set(i) {} + var X.typeParameter9: Int where X : In<")!>I> get() = 0; set(i) {} + var X.typeParameter0: Int where X : In get() = 0; set(i) {} } diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt index 9fe7c3e6a9a..877764454d2 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt @@ -3,7 +3,7 @@ fun getT(): T = null!! class Test { private fun foo() : I = getT() - fun apply(i: I) {} + fun apply(i: I) {} init { foo() diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt index b05426a7dc5..51aa6dd34ee 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt @@ -8,7 +8,7 @@ class Test { apply(this.i) } - fun apply(i: I) {} + fun apply(i: I) {} fun test() { apply(i) diff --git a/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.fir.kt b/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.fir.kt deleted file mode 100644 index cfdaa269fe4..00000000000 --- a/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - * - * SPEC VERSION: 0.1-152 - * PRIMARY LINKS: expressions, when-expression -> paragraph 5 -> sentence 1 - * expressions, when-expression -> paragraph 9 -> sentence 2 - * expressions, when-expression, exhaustive-when-expressions -> paragraph 1 -> sentence 1 - * expressions, function-literals, lambda-literals -> paragraph 10 -> sentence 1 - */ - -fun foo(x: Int) { - r { - when (x) { - 2 -> 0 - } - } -} - -fun r(f: () -> Unit) { - f() -} diff --git a/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt b/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt index 230a1fefe70..3b17d6c3372 100644 --- a/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt +++ b/compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * @@ -11,7 +12,7 @@ fun foo(x: Int) { r { when (x) { - 2 -> 0 + 2 -> 0 } } } diff --git a/compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt b/compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt index dce46c0d290..4a5550073d6 100644 --- a/compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt +++ b/compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt @@ -34,7 +34,7 @@ fun foo() { else -> {} }) - 1 + 1 sealed when { else -> {} } diff --git a/compiler/testData/diagnostics/tests/when/When.kt b/compiler/testData/diagnostics/tests/when/When.kt index a8a475024e9..21e0f1b59bf 100644 --- a/compiler/testData/diagnostics/tests/when/When.kt +++ b/compiler/testData/diagnostics/tests/when/When.kt @@ -19,16 +19,16 @@ fun foo() : Int { val s = "" val x = 1 when (x) { - is String -> 1 - !is Int -> 1 - is Any? -> 1 - is Any -> 1 - s -> 1 - 1 -> 1 - 1 + a -> 1 - in 1..a -> 1 - !in 1..a -> 1 - else -> 1 + is String -> 1 + !is Int -> 1 + is Any? -> 1 + is Any -> 1 + s -> 1 + 1 -> 1 + 1 + a -> 1 + in 1..a -> 1 + !in 1..a -> 1 + else -> 1 } return 0 @@ -41,20 +41,20 @@ fun test() { val s = ""; when (x) { - s -> 1 - "" -> 1 - x -> 1 - 1 -> 1 + s -> 1 + "" -> 1 + x -> 1 + 1 -> 1 } val z = 1 when (z) { - else -> 1 + else -> 1 1 -> 2 } - when (z) { - else -> 1 + when (z) { + else -> 1 } } diff --git a/compiler/testData/diagnostics/tests/when/whenAndLambdaWithExpectedType.kt b/compiler/testData/diagnostics/tests/when/whenAndLambdaWithExpectedType.kt index 7642b53335d..dba42c833c9 100644 --- a/compiler/testData/diagnostics/tests/when/whenAndLambdaWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/when/whenAndLambdaWithExpectedType.kt @@ -24,13 +24,12 @@ val test2: (String) -> Boolean = val test3: (String) -> Boolean = when { - true -> { s -> true } + true -> { s -> true } else -> null!! } val test4: (String) -> Boolean = when { - true -> { s1, s2 -> true } + true -> { s1, s2 -> true } else -> null!! } - diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.kt index 760822a5509..8aa1fd66c3b 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.kt @@ -43,7 +43,7 @@ fun test5(x: Inv) { } fun test6(x: Inv) { - when (val y = x.data) { + when (val y = x.data) { is String -> x.data.length // should be ok } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.fir.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.fir.kt index 88cfdd3aa77..a67828a937e 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.fir.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.fir.kt @@ -1,8 +1,9 @@ // !LANGUAGE: +VariableDeclarationInWhenSubject +// !DIAGNOSTICS: +UNUSED_VARIABLE fun foo(): Any = 42 fun test() { when (val x = foo()) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.kt index 615bd63a49c..0faac20028a 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/unusedWhenSubjectVariable.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +VariableDeclarationInWhenSubject -// !DIAGNOSICS: +UNUSED_VARIABLE +// !DIAGNOSTICS: +UNUSED_VARIABLE fun foo(): Any = 42 diff --git a/compiler/testData/diagnostics/testsWithStdLib/RenameOnImportHidesDefaultImport.kt b/compiler/testData/diagnostics/testsWithStdLib/RenameOnImportHidesDefaultImport.kt index 97ac64d6069..c959a05f683 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/RenameOnImportHidesDefaultImport.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/RenameOnImportHidesDefaultImport.kt @@ -6,4 +6,4 @@ fun f() { listOf(1).map { it.hashCode() } } -fun g(a1: KotlinArray, a2: Array){} \ No newline at end of file +fun g(a1: KotlinArray, a2: Array){} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/Synchronized.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/Synchronized.kt index 8f98e552660..5c4d6457a57 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/Synchronized.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/Synchronized.kt @@ -11,7 +11,7 @@ interface My { var v: String @Synchronized get() = "" - @Synchronized set(value) {} + @Synchronized set(value) {} } abstract class Your { @@ -25,7 +25,7 @@ abstract class Your { var v: String @Synchronized get() = "" - @Synchronized set(value) {} + @Synchronized set(value) {} } @Synchronized fun gav() = 1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/nonConstValAsArgument.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/nonConstValAsArgument.kt index 0ba3f988a2b..96eefba26b8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/nonConstValAsArgument.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/nonConstValAsArgument.kt @@ -27,8 +27,8 @@ var mutable = "" var mutableWithGetter get() = "" - set(x) = TODO() + set(x) = TODO() object WithLateinit { lateinit var kClass: KClass<*> -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt index 70470e51d59..0106e3ef2c6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt @@ -25,5 +25,5 @@ interface B { @JvmDefault var prop4: String get() = "" - set(value) {} + set(value) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt index 800433dea87..b1372742eef 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt @@ -18,5 +18,5 @@ object B { fun test() {} @JvmDefault - fun test2(s: String = "") {} + fun test2(s: String = "") {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt index 247dd15cce9..23522da517b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt @@ -10,5 +10,5 @@ interface B { var prop2: String @JvmDefault get() = "" - @JvmDefault set(value) {} + @JvmDefault set(value) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt index e73f23b6fd5..348e891b8eb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt @@ -25,5 +25,5 @@ interface B { @JvmDefault var prop4: String get() = "" - set(value) {} + set(value) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt index 1421e03ba21..7fb6e0036f9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt @@ -26,5 +26,5 @@ interface B { @JvmDefault var prop4: String get() = "" - set(value) {} + set(value) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt index 533b155eb7d..670a2bf880d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmOverloads/jvmOverloadsOnPrivate.kt @@ -16,8 +16,8 @@ fun foo() { } } - val x = object { + val x = object { @kotlin.jvm.JvmOverloads fun foo(s: String = "OK") { } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt index 90e0a981724..961e021ada1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property.kt @@ -8,7 +8,7 @@ open class B { class A { companion object : B() { var p1:Int = 1 - @JvmStatic set(p: Int) { + @JvmStatic set(p: Int) { p1 = 1 } @@ -22,7 +22,7 @@ class A { object A : B() { var p:Int = 1 - @JvmStatic set(p1: Int) { + @JvmStatic set(p1: Int) { p = 1 } @@ -37,9 +37,9 @@ class A { } var p:Int = 1 - @JvmStatic set(p1: Int) { + @JvmStatic set(p1: Int) { p = 1 } @JvmStatic val z2 = 1; -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt index 5a24dff30ee..dc80fd76797 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmStatic/property_LL13.kt @@ -8,7 +8,7 @@ open class B { class A { companion object : B() { var p1:Int = 1 - @JvmStatic set(p: Int) { + @JvmStatic set(p: Int) { p1 = 1 } @@ -22,7 +22,7 @@ class A { object A : B() { var p:Int = 1 - @JvmStatic set(p1: Int) { + @JvmStatic set(p1: Int) { p = 1 } @@ -37,9 +37,9 @@ class A { } var p:Int = 1 - @JvmStatic set(p1: Int) { + @JvmStatic set(p1: Int) { p = 1 } @JvmStatic val z2 = 1; -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.fir.kt deleted file mode 100644 index 4e0a246c9c3..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect -// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER - -import kotlin.contracts.* - -fun myRun(block: () -> T): T { - contract { - callsInPlace(block, InvocationKind.EXACTLY_ONCE) - } - return block() -} - -fun functionWithSideEffects(x: Int): Int = x + 1 // ...and some other useful side-effects - -fun log(s: String) = Unit // some logging or println or whatever returning Unit - -fun implicitCastWithIf(s: String) { - myRun { if (s == "") functionWithSideEffects(42) else log(s) } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt index 24782933ce5..dc175871c2a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER @@ -13,8 +14,8 @@ fun myRun(block: () -> T): T { fun functionWithSideEffects(x: Int): Int = x + 1 // ...and some other useful side-effects -fun log(s: String) = Unit // some logging or println or whatever returning Unit +fun log(s: String) = Unit // some logging or println or whatever returning Unit fun implicitCastWithIf(s: String) { myRun { if (s == "") functionWithSideEffects(42) else log(s) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt index 17534021555..9e2e4c3c87d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt @@ -12,6 +12,6 @@ inline fun myRun(block: () -> T): T { } fun throwInLambda(): Int { - val x = myRun { throw java.lang.IllegalArgumentException(); 42 } + val x = myRun { throw java.lang.IllegalArgumentException(); 42 } return x -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.fir.kt deleted file mode 100644 index 13a2618d5d3..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !ALLOW_RESULT_RETURN_TYPE -// !LANGUAGE: -AllowNullOperatorsForResult - -fun result(): Result = TODO() -val resultP: Result = result() - -fun f(r1: Result?) { - r1 ?: 0 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt index 3ac49e58cf0..ea7e4144eb6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !ALLOW_RESULT_RETURN_TYPE // !LANGUAGE: -AllowNullOperatorsForResult @@ -5,5 +6,5 @@ fun result(): Result = TODO() val resultP: Result = result() fun f(r1: Result?) { - r1 ?: 0 -} \ No newline at end of file + r1 ?: 0 +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt index 8b55b9c80f5..366911ccaad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt @@ -5,7 +5,7 @@ class Impl : Inv class Scope(private val implClass: j.Class) { fun foo(c: Collection) { - val hm = c.asSequence() + val hm = c.asSequence() .filter(implClass::isInstance) .map(implClass::cast) .toSet() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/applyInsideCoroutine.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/applyInsideCoroutine.kt index 756e5794fc0..713a118f9a8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/applyInsideCoroutine.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/applyInsideCoroutine.kt @@ -10,25 +10,25 @@ class Controller { fun generate(g: suspend Controller.() -> Unit): S = TODO() val test1 = generate { - apply { - yield(4) + apply { + yield(4) } } val test2 = generate { yield(B) - apply { - yield(C) + apply { + yield(C) } } -val test3 = generate { - this.let { +val test3 = generate { + this.let { yield(B) } - apply { - yield(C) + apply { + yield(C) } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt index c43d3c9c806..4bcfe8fe294 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt @@ -4,7 +4,7 @@ class StateMachine internal constructor() { fun getInputStub(): Q = null as Q } -fun stateMachine(block: suspend StateMachine.() -> Unit): StateMachine { +fun stateMachine(block: suspend StateMachine.() -> Unit): StateMachine { return StateMachine() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt index 96eaa66b31f..44a15134fcc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt @@ -16,7 +16,7 @@ fun generate(@BuilderInference g: suspend GenericController.() -> Unit): @BuilderInference suspend fun GenericController>.yieldGenerate(g: suspend GenericController.() -> Unit): Unit = TODO() -val test1 = generate { +val test1 = generate { // TODO: KT-15185 yieldGenerate { yield(4) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt index 508c6b911a0..e49257af89e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.kt @@ -8,7 +8,7 @@ interface Job : CoroutineContext.Element {} interface Deferred : Job { suspend fun await(): T } -fun async(block: suspend () -> T): Deferred = TODO() +fun async(block: suspend () -> T): Deferred = TODO() suspend fun fib(n: Long) = async { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt index 91441f5f00d..0c3b9342ed0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/lambdaExpectedType.kt @@ -29,22 +29,22 @@ fun foo() { i = genericBuilder { 1 } genericBuilder { 1 } genericBuilder { 1 } - genericBuilder { "" } + genericBuilder { "" } val y = { 1 } genericBuilder(y) unitBuilder {} - unitBuilder { 1 } + unitBuilder { 1 } unitBuilder({}) - unitBuilder({ 1 }) + unitBuilder({ 1 }) manyArgumentsBuilder({}, { "" }) { 1 } val s: String = manyArgumentsBuilder({}, { "" }) { 1 } manyArgumentsBuilder({}, { "" }, { 1 }) - manyArgumentsBuilder({}, { 1 }, { 2 }) + manyArgumentsBuilder({}, { 1 }, { 2 }) severalParamsInLambda { x, y -> x checkType { _() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspend.kt index 1c196ec0820..d77fc341190 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspend.kt @@ -34,7 +34,7 @@ fun bar() { println() } - val w: (suspend () -> Int) -> Any? = ::suspend + val w: (suspend () -> Int) -> Any? = ::suspend A().suspend { println() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspendWithAnyParameter.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspendWithAnyParameter.kt index 0ec31376e47..65f1c989b1f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspendWithAnyParameter.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/modifierFormForNonBuiltInSuspendWithAnyParameter.kt @@ -36,7 +36,7 @@ fun bar() { suspend(null) - val w: (Any?) -> Any? = ::suspend + val w: (Any?) -> Any? = ::suspend A().suspend { println() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt index cf1e9382e5e..ac7e761cc9a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/noDefaultCoroutineImports.kt @@ -1,7 +1,7 @@ // FILE: 1.kt -fun test(c: Continuation) {} +fun test(c: Continuation) {} // FILE: 2.kt import kotlin.coroutines.* -fun test2(c: Continuation) {} +fun test2(c: Continuation) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltIn.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltIn.kt index e2d0c387ab5..fcdd6d38029 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltIn.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltIn.kt @@ -28,7 +28,7 @@ fun bar() { println() } - val w: (suspend () -> Int) -> Any? = ::suspend + val w: (suspend () -> Int) -> Any? = ::suspend } @Target(AnnotationTarget.EXPRESSION) @@ -41,5 +41,5 @@ fun main(suspend: WLambdaInvoke) { } class WLambdaInvoke { - operator fun invoke(l: () -> Unit) {} + operator fun invoke(l: () -> Unit) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltInRenameOnImport.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltInRenameOnImport.kt index 705ef7c7f7f..c6406a01509 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltInRenameOnImport.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/nonModifierFormForBuiltInRenameOnImport.kt @@ -26,5 +26,5 @@ fun bar() { println() } - val w: (suspend () -> Int) -> Any? = ::suspendLambda + val w: (suspend () -> Int) -> Any? = ::suspendLambda } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt index 59be393309e..84e15ebca53 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/memberExtension.kt @@ -20,9 +20,9 @@ suspend fun RestrictedController.ext() { memberExt() } -fun generate(c: suspend RestrictedController.() -> Unit) {} +fun generate(c: suspend RestrictedController.() -> Unit) {} -fun runBlocking(x: suspend () -> Unit) {} +fun runBlocking(x: suspend () -> Unit) {} fun test() { generate a@{ diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt index b2cda3566d3..a45e2cde834 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt @@ -8,7 +8,7 @@ import kotlin.experimental.ExperimentalTypeInference @kotlin.coroutines.RestrictsSuspension class RestrictedController { - suspend fun yield(x: T) {} + suspend fun yield(x: T) {} suspend fun anotherYield(x: T) { yield(x) @@ -27,10 +27,10 @@ class RestrictedController { } } -fun buildSequence(@BuilderInference c: suspend RestrictedController.() -> Unit) {} +fun buildSequence(@BuilderInference c: suspend RestrictedController.() -> Unit) {} @BuilderInference -suspend fun RestrictedController.yield2(x: T) {} +suspend fun RestrictedController.yield2(x: T) {} fun test() { buildSequence a@{ diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt index 296aadf0748..96d316de89e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/simpleForbidden.kt @@ -4,7 +4,7 @@ class RestrictedController suspend fun Any?.extFun() {} suspend fun suspendFun() {} -fun generate(c: suspend RestrictedController.() -> Unit) {} +fun generate(c: suspend RestrictedController.() -> Unit) {} fun test() { generate { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt index 259b1ca2210..54b024b5f09 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/wrongEnclosingFunction.kt @@ -4,9 +4,9 @@ class RestrictedController { suspend fun yield() {} } -fun generate(c: suspend RestrictedController.() -> Unit) {} +fun generate(c: suspend RestrictedController.() -> Unit) {} -fun runBlocking(x: suspend () -> Unit) {} +fun runBlocking(x: suspend () -> Unit) {} fun test() { generate { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/returnLabelForBuiltInSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/returnLabelForBuiltInSuspend.kt index 2e329b65e0c..0a56c187280 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/returnLabelForBuiltInSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/returnLabelForBuiltInSuspend.kt @@ -18,7 +18,7 @@ fun bar() { return@suspend } - val x = suspend@{ + val x = suspend@{ suspend { // Might be resolved to outer lambda, but doesn't make sense because suspend-lambdas here is noinline return@suspend diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt index 84b56542ce7..25be3a644e5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCovarianJavaOverride.kt @@ -25,7 +25,7 @@ class K3 : JavaClass() { override fun foo(x: Int, y: Continuation): Any? = null } -fun builder(block: suspend () -> Unit) {} +fun builder(block: suspend () -> Unit) {} fun main(x: Continuation) { JavaClass().foo(5, x) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.fir.kt deleted file mode 100644 index 0c974541763..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// SKIP_TXT -class A { - suspend operator fun component1(): String = "K" -} - -fun foo(c: suspend (A) -> Unit) {} - -fun bar() { - foo { - (x) -> - x.length - } -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.kt index 533b3f276bc..185b03ed2f4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendDestructuring.kt @@ -1,9 +1,10 @@ +// FIR_IDENTICAL // SKIP_TXT class A { suspend operator fun component1(): String = "K" } -fun foo(c: suspend (A) -> Unit) {} +fun foo(c: suspend (A) -> Unit) {} fun bar() { foo { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt index 4b5b776aa61..85112d8a185 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.kt @@ -37,7 +37,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/coroutines/suspendJavaImplementationFromDifferentClass.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt index 289182ebb34..9698426d293 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaImplementationFromDifferentClass.kt @@ -28,7 +28,7 @@ class K3 : JavaClass() { override fun foo(x: Int, y: Continuation): Any? = null } -fun builder(block: suspend () -> Unit) {} +fun builder(block: suspend () -> Unit) {} fun main(x: Continuation) { JavaClass().foo(5, x) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt index f6c6595e108..ba4ed507369 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendJavaOverrides.kt @@ -25,7 +25,7 @@ class K3 : JavaClass() { override fun foo(x: Int, y: Continuation): Any? = null } -fun builder(block: suspend () -> Unit) {} +fun builder(block: suspend () -> Unit) {} fun main(x: Continuation) { JavaClass().foo(5, x) diff --git a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt b/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt index 9afd3e5d21a..4dc282d2968 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/functionLiterals/pseudocodeMemoryOverhead.kt @@ -33,8 +33,8 @@ private val STRING = CompileTimeType() private val ANY = CompileTimeType() -private val emptyBinaryFun: Function2 = { a, b -> BigInteger("0") } -private val emptyUnaryFun: Function1 = { a -> 1.toLong() } +private val emptyBinaryFun: Function2 = { a, b -> BigInteger("0") } +private val emptyUnaryFun: Function1 = { a -> 1.toLong() } private val unaryOperations: HashMap, Pair, Function1>> = hashMapOf, Pair, Function1>>( diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/checkLowPriorityIsResolvedSuccessfully.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/checkLowPriorityIsResolvedSuccessfully.kt index bb20695bd26..8447667a390 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/checkLowPriorityIsResolvedSuccessfully.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/checkLowPriorityIsResolvedSuccessfully.kt @@ -7,7 +7,7 @@ class Foo { fun Foo.test() {} class Bar class Scope { - operator fun Bar.invoke(f: () -> Unit) {} + operator fun Bar.invoke(f: () -> Unit) {} } fun Scope.bar(e: Foo) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt index a5834d19d3c..186d011443e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt @@ -8,5 +8,5 @@ fun test1(l: List) { val i: Int = l.firstTyped() - val s: String = l.firstTyped() + val s: String = l.firstTyped() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/callableReferenceOnParameter.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/callableReferenceOnParameter.kt index 55504722547..e21b7e3103f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/callableReferenceOnParameter.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/callableReferenceOnParameter.kt @@ -2,7 +2,7 @@ internal class Z { val map = HashMap() - inline fun compute(key: String, producer: () -> String): String { + inline fun compute(key: String, producer: () -> String): String { return map.getOrPut(key, ::producer) } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.fir.kt deleted file mode 100644 index c6128f73444..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FULL_JDK - -import java.util.* - -fun foo(o: Optional) {} - -class Test(nullable: String?) { - private val nullableOptional = Optional.ofNullable(nullable) - fun doIt() { - foo(nullableOptional) - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt index 79ced2a266d..76029eac7af 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt12008.kt @@ -1,12 +1,13 @@ +// FIR_IDENTICAL // FULL_JDK import java.util.* -fun foo(o: Optional) {} +fun foo(o: Optional) {} class Test(nullable: String?) { private val nullableOptional = Optional.ofNullable(nullable) fun doIt() { foo(nullableOptional) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt42620.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt42620.kt index f8322ec29ff..7012d5b8203 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt42620.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt42620.kt @@ -10,6 +10,6 @@ fun main2() = if (true) Foo::minus } else { Foo::times } -fun main4() = try { Foo::minus } finally { Foo::times } +fun main4() = try { Foo::minus } finally { Foo::times } fun main5() = Foo::minus ?: Foo::times diff --git a/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContains.kt b/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContains.kt index 899ce6b966b..06af709babc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContains.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContains.kt @@ -3,7 +3,7 @@ // FULL_JDK class A : java.util.concurrent.ConcurrentHashMap() { - operator fun contains(x: Char): Boolean = true + operator fun contains(x: Char): Boolean = true } class B : java.util.concurrent.ConcurrentHashMap() { override fun contains(value: Any?): Boolean { @@ -77,4 +77,3 @@ fun main() { 1 in (c as Map) 1 !in (c as Map) } - diff --git a/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContainsError.kt b/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContainsError.kt index 112a5b35d2c..d55eab781ef 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContainsError.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/java/concurrentHashMapContainsError.kt @@ -3,7 +3,7 @@ // FULL_JDK class A : java.util.concurrent.ConcurrentHashMap() { - operator fun contains(x: Char): Boolean = true + operator fun contains(x: Char): Boolean = true } class B : java.util.concurrent.ConcurrentHashMap() { override fun contains(value: Any?): Boolean { @@ -77,4 +77,3 @@ fun main() { 1 in (c as Map) 1 !in (c as Map) } - diff --git a/compiler/testData/diagnostics/testsWithStdLib/kt7585/delegate.txt b/compiler/testData/diagnostics/testsWithStdLib/kt7585/delegate.txt index 96957778aa1..a02572ae522 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/kt7585/delegate.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/kt7585/delegate.txt @@ -63,8 +63,8 @@ public interface Other { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public/*package*/ open class Properties { - public/*package*/ constructor Properties() +public open class Properties { + public constructor Properties() 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 @@ -73,6 +73,15 @@ public/*package*/ open class Properties { public/*package*/ open fun calcVal(/*0*/ initializer: (() -> T!)!): Val! } +public open class Val { + public/*package*/ constructor Val(/*0*/ initializer: (() -> T!)!) + public/*package*/ final var initializer: (() -> T!)! + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open operator fun getValue(/*0*/ instance: kotlin.Any!, /*1*/ metadata: kotlin.Any!): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class Wrapper { public constructor Wrapper(/*0*/ v: T) public final val v: T diff --git a/compiler/testData/diagnostics/testsWithStdLib/kt8050.kt b/compiler/testData/diagnostics/testsWithStdLib/kt8050.kt index f6c0429a155..12547d5543d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/kt8050.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/kt8050.kt @@ -1,6 +1,6 @@ private class X -private operator fun X?.plus(p: Int) = X() +private operator fun X?.plus(p: Int) = X() class C { private val map = hashMapOf() @@ -8,4 +8,4 @@ class C { fun f() { map[""] += 1 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt b/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt index f9102b82a17..f8b78708ae0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt @@ -4,7 +4,7 @@ class A { external constructor() {} } - external constructor(x: Int) + external constructor(x: Int) } -class C external constructor() \ No newline at end of file +class C external constructor() diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70485_functionTypeInheritor.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70485_functionTypeInheritor.kt index 4ef22fc44b2..8a8e1509ffa 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70485_functionTypeInheritor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70485_functionTypeInheritor.kt @@ -4,7 +4,7 @@ class O : Function2 { } fun test() { - val a = fun(o: O) { + val a = fun(o: O) { } a {} } @@ -13,5 +13,5 @@ fun test() { } fun test2() { - val f: Ext = {} + val f: Ext = {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt index 20ceac91de4..ef0fb6f3b8b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/kt2082.kt @@ -1,10 +1,10 @@ fun foo(c : Collection) = { c.filter{ val s : String? = bar() - if (s == null) false // here! + if (s == null) false // here! zoo(s) } } fun bar() : String? = null -fun zoo(s : String) : Boolean = true \ No newline at end of file +fun zoo(s : String) : Boolean = true diff --git a/compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt b/compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt index 39922182a14..2e81ae2f383 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/reified/kt11881.kt @@ -2,8 +2,8 @@ class Inv inline operator fun Inv.invoke() {} -operator fun Inv.get(i: Int): Inv = this +operator fun Inv.get(i: Int): Inv = this fun test(a: Inv) { a[1]() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt index 7a349d7e040..7d2507945d1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/forEachSafe.kt @@ -4,7 +4,7 @@ fun indexOfMax(a: IntArray): Int? { var maxI: Int? = null a.forEachIndexed { i, value -> - if (maxI == null || value >= a[maxI]) { + if (maxI == null || value >= a[maxI]) { maxI = i } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.kt index c9ebce89b95..318c72855e4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.kt @@ -39,13 +39,13 @@ fun test4() { null } finally { - "" + "" } s.length } fun test5() { - val s: String? = try { + val s: String? = try { "" } catch (e: ExcA) { @@ -105,7 +105,7 @@ fun test10() { val x = try { "" } finally { - 42 + 42 } x.length } diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/catchRedeclaration.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/catchRedeclaration.kt index 09cd655a7a4..ddd02b65b64 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/catchRedeclaration.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/catchRedeclaration.kt @@ -8,7 +8,7 @@ class MyException : Exception() { } fun test1() { - val e = "something" + val e = "something" try {} catch (e: Exception) { e.message @@ -35,15 +35,15 @@ fun test3() { fun test4() { try {} catch (e: Exception) { - val a = 42 - val a = "foo" + val a = 42 + val a = "foo" } } fun test5() { try {} catch (e: Exception) { - val a: Int = 42 + val a: Int = 42 try {} catch (e: MyException) { e.myFun() @@ -51,4 +51,4 @@ fun test5() { a.length } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt index 238aeef76d2..78c0c735caa 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/tryExpression.kt @@ -9,7 +9,7 @@ fun test0(): List = run { try { emptyList() } finally { - "" + "" fun foo() {} } } @@ -22,7 +22,7 @@ fun test1(): Map = run { } catch (e: ExcB) { e.map } finally { - "" + "" } } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt index dfcb86c1a4f..a6ff3661093 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt @@ -9,6 +9,8 @@ import org.jetbrains.kotlin.config.ExplicitApiMode import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.TestJdkKind import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING @@ -30,6 +32,20 @@ import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurat import org.jetbrains.kotlin.test.services.configuration.ScriptingEnvironmentConfigurator abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() { + companion object { + val DISABLED_BY_DEFAULT_UNUSED_DIAGNOSTICS = listOf( + "UNUSED_VARIABLE", + "UNUSED_PARAMETER", + "UNUSED_ANONYMOUS_PARAMETER", + "UNUSED_DESTRUCTURED_PARAMETER_ENTRY", + "UNUSED_TYPEALIAS_PARAMETER", + "UNUSED_VALUE", + "UNUSED_CHANGED_VALUE", + "UNUSED_EXPRESSION", + "UNUSED_LAMBDA_EXPRESSION", + ).map { "-$it" } + } + override fun TestConfigurationBuilder.configuration() { globalDefaults { frontend = FrontendKinds.ClassicFrontend @@ -76,6 +92,12 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() { } } + forTestsNotMatching("compiler/testData/diagnostics/tests/controlFlowAnalysis/*") { + defaultDirectives { + DIAGNOSTICS with DISABLED_BY_DEFAULT_UNUSED_DIAGNOSTICS + } + } + forTestsMatching("compiler/testData/diagnostics/tests/unsignedTypes/*") { defaultDirectives { USE_EXPERIMENTAL with "kotlin.ExperimentalUnsignedTypes"