diff --git a/idea/testData/intentions/addBraces/addBracesForDoWhile.kt b/idea/testData/intentions/addBraces/addBracesForDoWhile.kt index f78477afb0a..4900e987b5b 100644 --- a/idea/testData/intentions/addBraces/addBracesForDoWhile.kt +++ b/idea/testData/intentions/addBraces/addBracesForDoWhile.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { - do println("test") + do doSomething("test") while(true) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForDoWhile.kt.after b/idea/testData/intentions/addBraces/addBracesForDoWhile.kt.after index 543c8fdb9bb..f9971272bd2 100644 --- a/idea/testData/intentions/addBraces/addBracesForDoWhile.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForDoWhile.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { do { - println("test") + doSomething("test") } while(true) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForElse.kt b/idea/testData/intentions/addBraces/addBracesForElse.kt index 52b358aaeaa..094ca177812 100644 --- a/idea/testData/intentions/addBraces/addBracesForElse.kt +++ b/idea/testData/intentions/addBraces/addBracesForElse.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test") - else println("test2") -} \ No newline at end of file + if (true) doSomething("test") + else doSomething("test2") +} diff --git a/idea/testData/intentions/addBraces/addBracesForElse.kt.after b/idea/testData/intentions/addBraces/addBracesForElse.kt.after index c5aeaf5b674..b8e40aac012 100644 --- a/idea/testData/intentions/addBraces/addBracesForElse.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForElse.kt.after @@ -1,6 +1,8 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test") + if (true) doSomething("test") else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForFor.kt b/idea/testData/intentions/addBraces/addBracesForFor.kt index 6f47f1d54a2..0b50ba21cc7 100644 --- a/idea/testData/intentions/addBraces/addBracesForFor.kt +++ b/idea/testData/intentions/addBraces/addBracesForFor.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { for (i in 1..4) - println("test") -} \ No newline at end of file + doSomething("test") +} diff --git a/idea/testData/intentions/addBraces/addBracesForFor.kt.after b/idea/testData/intentions/addBraces/addBracesForFor.kt.after index 84f7dc503e3..428d0f7e3cf 100644 --- a/idea/testData/intentions/addBraces/addBracesForFor.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForFor.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { for (i in 1..4) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForIf.kt b/idea/testData/intentions/addBraces/addBracesForIf.kt index 95d00a3d237..f93fefd6f7f 100644 --- a/idea/testData/intentions/addBraces/addBracesForIf.kt +++ b/idea/testData/intentions/addBraces/addBracesForIf.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test") else println("test2") -} \ No newline at end of file + if (true) doSomething("test") else doSomething("test2") +} diff --git a/idea/testData/intentions/addBraces/addBracesForIf.kt.after b/idea/testData/intentions/addBraces/addBracesForIf.kt.after index cc2cb2f8496..5b85659678b 100644 --- a/idea/testData/intentions/addBraces/addBracesForIf.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForIf.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") - } else println("test2") -} \ No newline at end of file + doSomething("test") + } else doSomething("test2") +} diff --git a/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt b/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt index 34360126212..4e2ebebcd5d 100644 --- a/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt +++ b/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - if (true)println("test") -} \ No newline at end of file + if (true) doSomething("test") +} diff --git a/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt.after b/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt.after index da3616d7d4e..7c4ab49c01b 100644 --- a/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForIfWithNoSpace.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt b/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt index 50fdc8059c0..7963225e163 100644 --- a/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt +++ b/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test"); -} \ No newline at end of file + if (true) doSomething("test"); +} diff --git a/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt.after b/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt.after index da3616d7d4e..7c4ab49c01b 100644 --- a/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForIfWithSemicolon.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesForWhile.kt b/idea/testData/intentions/addBraces/addBracesForWhile.kt index 4dd43df78cf..785b0a2f250 100644 --- a/idea/testData/intentions/addBraces/addBracesForWhile.kt +++ b/idea/testData/intentions/addBraces/addBracesForWhile.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { while (true) - println("test") -} \ No newline at end of file + doSomething("test") +} diff --git a/idea/testData/intentions/addBraces/addBracesForWhile.kt.after b/idea/testData/intentions/addBraces/addBracesForWhile.kt.after index bddcd93632f..8e27e22383e 100644 --- a/idea/testData/intentions/addBraces/addBracesForWhile.kt.after +++ b/idea/testData/intentions/addBraces/addBracesForWhile.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { while (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/addBraces/addBracesWithBraces.kt b/idea/testData/intentions/addBraces/addBracesWithBraces.kt index b1348c9aa58..ca5c54a7c88 100644 --- a/idea/testData/intentions/addBraces/addBracesWithBraces.kt +++ b/idea/testData/intentions/addBraces/addBracesWithBraces.kt @@ -1,6 +1,9 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt index 386acdbbd54..9665a4173fa 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test{ fun contains(a: Int) : Boolean = true } val test = Test() - println(test.contains(0).toString()) + doSomething(test.contains(0).toString()) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt.after b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt.after index fc03bcb1f4a..d293e366713 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt.after +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/containsInExpression.kt.after @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test{ fun contains(a: Int) : Boolean = true } val test = Test() - println((0 in test).toString()) + doSomething((0 in test).toString()) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt index dd0246a2835..961e739985a 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test{ fun contains(fn: () -> Boolean) : Boolean = true } val test = Test() - println(test.contains { true }.toString()) + doSomething(test.contains { true }.toString()) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt.after b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt.after index 9821d11aac7..363e6849ba0 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt.after +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/functionLiteralArgumentInExpression.kt.after @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test{ fun contains(fn: () -> Boolean) : Boolean = true } val test = Test() - println(({ true } in test).toString()) + doSomething(({ true } in test).toString()) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/invalidArgument.kt b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/invalidArgument.kt index c0e75af8254..345f4b7a247 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/invalidArgument.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/invalidArgument.kt @@ -1,4 +1,5 @@ // SHOULD_FAIL_WITH: invalid.arguments +// ERROR: Cannot find a parameter with this name: c fun test() { class Test{ fun contains(a: Int=1, b: Int=2): Boolean = true diff --git a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/missingArgument.kt b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/missingArgument.kt index 813116eb6c4..2ba79491ec8 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/missingArgument.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceContainsIntention/missingArgument.kt @@ -1,4 +1,5 @@ // SHOULD_FAIL_WITH: duplicate.or.missing.arguments +// ERROR: No value passed for parameter b fun test() { class Test{ fun contains(a: Int, b: Int): Boolean = true diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/duplicateArguments.kt b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/duplicateArguments.kt index 88cd7d9548d..7d2ad08f496 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/duplicateArguments.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/duplicateArguments.kt @@ -1,4 +1,6 @@ // SHOULD_FAIL_WITH: duplicate.or.missing.arguments +// ERROR: An argument is already passed for this parameter +// ERROR: No value passed for parameter b fun test() { class Test{ fun get(a: Int, b: Int) : Int = 0 diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/invalidArgument.kt b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/invalidArgument.kt index 244d2540616..97662b9c8da 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/invalidArgument.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/invalidArgument.kt @@ -1,4 +1,5 @@ // SHOULD_FAIL_WITH: invalid.arguments +// ERROR: Cannot find a parameter with this name: c fun test() { class Test{ fun get(a: Int=1, b: Int=2) : Int = 0 diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/missingArgument.kt b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/missingArgument.kt index d9785c2f6a6..5f1efffb0c8 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/missingArgument.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/missingArgument.kt @@ -1,4 +1,5 @@ // SHOULD_FAIL_WITH: duplicate.or.missing.arguments +// ERROR: No value passed for parameter b fun test() { class Test{ fun get(a: Int, b: Int) : Int = 0 diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt index f3f91ae35f7..6ff77e55489 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt @@ -1,9 +1,9 @@ fun test() { class Test{ - fun get(a: Int, b: Int, c: Int = 1, d: Int = 1 fn: (i: Int) -> Int) : Int = 0 + fun get(a: Int, b: Int, c: Int = 1, d: Int = 1, fn: (i: Int) -> Int) : Int = 0 } val test = Test() - test.get(1, c=3, b=2) { i -> + test.get(a=1, c=3, b=2, d=4) { i -> i } } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt.after b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt.after index 4adac0b69f2..6d2b6938019 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt.after +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/namedAndFunction.kt.after @@ -1,9 +1,9 @@ fun test() { class Test{ - fun get(a: Int, b: Int, c: Int = 1, d: Int = 1 fn: (i: Int) -> Int) : Int = 0 + fun get(a: Int, b: Int, c: Int = 1, d: Int = 1, fn: (i: Int) -> Int) : Int = 0 } val test = Test() - test[1, 2, 3, { i -> + test[1, 2, 3, 4, { i -> i }] } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/sanityCheck.kt b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/sanityCheck.kt index 299d8f3814c..b3079cc1e45 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/sanityCheck.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceGetIntention/sanityCheck.kt @@ -1,4 +1,5 @@ // IS_APPLICABLE: false +// ERROR: Unresolved reference: got fun test() { class Test{ fun get(i: Int) : Int = 0 diff --git a/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt b/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt index 4be86600219..baebf7ce4e6 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test { fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test" } val test = Test() - println(test.invoke(1, "a", "b") { }) + doSomething(test.invoke(1, "a", "b") { }) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt.after b/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt.after index 8385d874977..92316626640 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt.after +++ b/idea/testData/intentions/attributeCallReplacements/replaceInvokeIntention/invokeInExpression.kt.after @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test() { class Test { fun invoke(a: Int, vararg b: String, fn: () -> Unit): String = "test" } val test = Test() - println(test(1, "a", "b") { }) + doSomething(test(1, "a", "b") { }) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt b/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt index 4b0be765b63..48cbbaadcee 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt +++ b/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test() { class Test { fun plus(): Test = Test() @@ -5,5 +7,5 @@ fun test() { fun minus(): Test = Test() } val test = Test() - println(-(test + test).plus().toString()) + doSomething((-((test + test).plus())).toString()) } diff --git a/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt.after b/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt.after index 8284c66d761..7aa5f3e5df1 100644 --- a/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt.after +++ b/idea/testData/intentions/attributeCallReplacements/replaceUnaryPrefixIntention/complexPlus.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test() { class Test { fun plus(): Test = Test() @@ -5,5 +7,5 @@ fun test() { fun minus(): Test = Test() } val test = Test() - println(-(+(test + test)).toString()) + doSomething((-(+(test + test))).toString()) } diff --git a/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt b/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt index 94374abd14f..ab76eac55e8 100644 --- a/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt +++ b/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt @@ -1,10 +1,8 @@ fun foo(): String? { - print("foo") return "foo" } fun bar() { - print("bar") } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt.after b/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt.after index dd319db98b7..065ebbcefe5 100644 --- a/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt.after +++ b/idea/testData/intentions/branched/elvisToIfThen/callExpression.kt.after @@ -1,10 +1,8 @@ fun foo(): String? { - print("foo") return "foo" } fun bar() { - print("bar") } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt b/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt index 62eaa463eb6..3e80fa0d160 100644 --- a/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt +++ b/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt @@ -1,10 +1,8 @@ fun foo(): String? { - print("foo") return "foo" } fun bar() { - print("bar") } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt.after b/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt.after index dd319db98b7..065ebbcefe5 100644 --- a/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt.after +++ b/idea/testData/intentions/branched/elvisToIfThen/callExpressionParens.kt.after @@ -1,10 +1,8 @@ fun foo(): String? { - print("foo") return "foo" } fun bar() { - print("bar") } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt b/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt index b30ef836b9d..5be1951f3f5 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt +++ b/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "???" } } else if (n == 2) { - println("***") + doSomething("***") res = "two" } else { - println("***") + doSomething("***") res = "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt.after b/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt.after index 3202a0646e5..afff1fab549 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt.after +++ b/idea/testData/intentions/branched/folding/ifToAssignment/innerIfTransformed.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { res = if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") res = "two" } else { - println("***") + doSomething("***") res = "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt index c64e90844c9..a527cb91934 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt @@ -1,13 +1,15 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt.after index 7307c997714..e8e65a034ff 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithBlocks.kt.after @@ -1,13 +1,15 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String res = if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithShadowedVar.kt b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithShadowedVar.kt index a234873b8d9..ce72b6f06b8 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithShadowedVar.kt +++ b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithShadowedVar.kt @@ -1,16 +1,18 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String = "" if (n == 1) { - println("***") + doSomething("***") res = "one" } else { var res: String - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutElse.kt b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutElse.kt index 6c03979c77c..fff38dfc146 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutElse.kt +++ b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutElse.kt @@ -1,11 +1,13 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String = "" if (n == 1) { - println("***") + doSomething("***") res = "one" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutTerminatingAssignment.kt b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutTerminatingAssignment.kt index 9278328138f..b6776ac92d4 100644 --- a/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutTerminatingAssignment.kt +++ b/idea/testData/intentions/branched/folding/ifToAssignment/simpleIfWithoutTerminatingAssignment.kt @@ -1,14 +1,16 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { res = "one" - println("***") + doSomething("***") } else { - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt b/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt index b402a1c2f2d..95a81bc5d77 100644 --- a/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt +++ b/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt @@ -1,17 +1,19 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") return "one" } else { - println("***") + doSomething("***") return "???" } } else if (n == 2) { - println("***") + doSomething("***") return "two" } else { - println("***") + doSomething("***") return "too many" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt.after b/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt.after index bf97963e5f0..91b297361d6 100644 --- a/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt.after +++ b/idea/testData/intentions/branched/folding/ifToReturn/innerIfTransformed.kt.after @@ -1,17 +1,19 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { return if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") return "two" } else { - println("***") + doSomething("***") return "too many" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt index 4a306f5f17d..f666928030f 100644 --- a/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { - println("***") + doSomething("***") return "one" } else { - println("***") + doSomething("***") return "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt.after index a88492572b5..d14f08b85d2 100644 --- a/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/folding/ifToReturn/simpleIfWithBlocks.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { return if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt index ccdf2e9f3e6..f37bcbeeded 100644 --- a/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { - println("***") + doSomething("***") return "one" } return "two" -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt.after index 5777e6c7ac1..479577c1082 100644 --- a/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/folding/ifToReturnAsymmetrically/simpleIfWithBlocks.kt.after @@ -1,6 +1,8 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { return if (n == 1) { - println("***") + doSomething("***") "one" } else "two" -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt b/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt index c1784696fd1..7fd5d6b64b4 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt +++ b/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (3 > 2) { when(n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } } else { - println("***") + doSomething("***") res = "???" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt.after b/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt.after index d3f6b00fa62..c86fecce736 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt.after +++ b/idea/testData/intentions/branched/folding/whenToAssignment/innerWhenTransformed.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (3 > 2) { res = when(n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } } else { - println("***") + doSomething("***") res = "???" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt index d3e4325d5de..6a9a40a4e3f 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt +++ b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt @@ -1,16 +1,18 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt.after b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt.after index 237433b09f3..6c7427fe0a6 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt.after +++ b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithBlocks.kt.after @@ -1,16 +1,18 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String res = when (n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithShadowedVar.kt b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithShadowedVar.kt index e258e21ffe4..ccbe6641b90 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithShadowedVar.kt +++ b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithShadowedVar.kt @@ -1,19 +1,21 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String = "" when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { var res: String res = "two" - println("***") + doSomething("***") } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithUnmatchedAssignments.kt b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithUnmatchedAssignments.kt index dc577d43980..e3613d8de2f 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithUnmatchedAssignments.kt +++ b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithUnmatchedAssignments.kt @@ -1,18 +1,20 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String = "" var res2: String = "" when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res2 = "two" } } return res + res2 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithoutTerminatingAssignment.kt b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithoutTerminatingAssignment.kt index 6b2f07c7e4a..e5702c3bbdb 100644 --- a/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithoutTerminatingAssignment.kt +++ b/idea/testData/intentions/branched/folding/whenToAssignment/simpleWhenWithoutTerminatingAssignment.kt @@ -1,17 +1,19 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { res = "two" - println("***") + doSomething("***") } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt b/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt index 0a5a8764560..d3882bbff04 100644 --- a/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt +++ b/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (3 > 2) { when (n) { @@ -5,7 +7,7 @@ fun test(n: Int): String { else -> return "two" } } else { - println("***") + doSomething("***") return "???" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt.after b/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt.after index cec7664dbfa..8c966e99e4e 100644 --- a/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt.after +++ b/idea/testData/intentions/branched/folding/whenToReturn/innerWhenTransformed.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (3 > 2) { return when (n) { @@ -5,7 +7,7 @@ fun test(n: Int): String { else -> "two" } } else { - println("***") + doSomething("***") return "???" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt b/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt index 73a8c4fa415..165b4b7a9d8 100644 --- a/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt +++ b/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt @@ -1,12 +1,14 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { when(n) { 1 -> { - println("***") + doSomething("***") return "one" } else -> { - println("***") + doSomething("***") return "two" } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt.after b/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt.after index e90363e53dd..4e6e7924f08 100644 --- a/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt.after +++ b/idea/testData/intentions/branched/folding/whenToReturn/simpleWhenWithBlocks.kt.after @@ -1,12 +1,14 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { return when(n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifThenToElvis/blockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToElvis/blockHasMoreThanOneStatement.kt index ab7ac0691b5..586ea73522b 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/blockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/blockHasMoreThanOneStatement.kt @@ -1,10 +1,12 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main(args: Array) { val foo: String? = null val bar = "bar" if (foo != null) { - print ("Hello") + doSomething ("Hello") foo } else { diff --git a/idea/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt b/idea/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt index e200570107f..ffc885e542e 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun T.compareTo(a: T): Int = 0 + fun main(args: Array) { val foo = null val bar = "bar" diff --git a/idea/testData/intentions/branched/ifThenToElvis/conditionNotBinaryExpr.kt b/idea/testData/intentions/branched/ifThenToElvis/conditionNotBinaryExpr.kt index e3bf07517ba..7d107ecb6c6 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/conditionNotBinaryExpr.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/conditionNotBinaryExpr.kt @@ -1,4 +1,8 @@ // IS_APPLICABLE: false +// ERROR: Type mismatch.
Required:kotlin.Boolean
Found:kotlin.Int
+// ERROR: Condition must be of type kotlin.Boolean, but is of type kotlin.Int +// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use ?.-qualified call instead + fun main(args: Array) { val foo: Int? = 4 val bar = 3 diff --git a/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt b/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt index ef406ee9f1d..5d9d5ceec37 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun maybeFoo(): String? { return "foo" } fun main(args: Array) { val foo = maybeFoo() - print(foo) + doSomething(foo) val bar = "bar" if (foo != null) { foo diff --git a/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt.after b/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt.after index 67640f4aa79..b9051f282fe 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt.after +++ b/idea/testData/intentions/branched/ifThenToElvis/doesNotinlineValueIfUsedMoreThanOnce.kt.after @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun maybeFoo(): String? { return "foo" } fun main(args: Array) { val foo = maybeFoo() - print(foo) + doSomething(foo) val bar = "bar" foo ?: bar } diff --git a/idea/testData/intentions/branched/ifThenToElvis/noCondition.kt b/idea/testData/intentions/branched/ifThenToElvis/noCondition.kt index 4328f8a0770..4a70d1eb0bc 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/noCondition.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/noCondition.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +// ERROR: Type mismatch.
Required:kotlin.Boolean
Found:() → kotlin.String?
+// ERROR: Condition must be of type kotlin.Boolean, but is of type () -> kotlin.String? fun main(args: Array) { val foo: String? = "foo" val bar = "bar" diff --git a/idea/testData/intentions/branched/ifThenToElvis/otherBlockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToElvis/otherBlockHasMoreThanOneStatement.kt index a4a45b7123b..aea116a80c5 100644 --- a/idea/testData/intentions/branched/ifThenToElvis/otherBlockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToElvis/otherBlockHasMoreThanOneStatement.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main(args: Array) { val foo: String? = null val bar = "bar" @@ -7,7 +9,7 @@ fun main(args: Array) { foo } else { - print ("Hello") + doSomething("Hello") bar } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt index e8e6f896e53..e46f095b494 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/blockHasMoreThanOneStatement.kt @@ -1,8 +1,10 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main(args: Array) { val foo: String? = "abc" if (foo != null) { - print ("Hello") + doSomething ("Hello") foo.length } else null diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt index 5908e4ddef0..33259df89a8 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/blockUsesDifferentVar.kt @@ -3,7 +3,7 @@ fun main(args: Array) { var foo: String? = "foo" var bar: String? = "bar" if (foo != null) { - bar.length + bar?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt index 45bcd64e3a5..f6432dc4382 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun T.compareTo(a: T): Int = 0 + fun main(args: Array) { val foo = "foo" if (foo > null) { diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt index a3e4840e933..681e65feeee 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun String?.times(a: Int): Boolean = a == 0 + fun main(args: Array) { val foo: String = "foo" if (foo * 10) { diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt index 62909e54f69..728bc651f0d 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt @@ -2,11 +2,13 @@ fun maybeFoo(): String? { return "foo" } +fun doSomething(a: T) {} + fun main(args: Array) { val foo = maybeFoo() - print(foo) + doSomething(foo) if (foo != null) { - foo.length() + foo.length } else { null diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after index 07df4d7cb02..1333ac3b987 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueIfUsedMoreThanOnce.kt.after @@ -2,8 +2,10 @@ fun maybeFoo(): String? { return "foo" } +fun doSomething(a: T) {} + fun main(args: Array) { val foo = maybeFoo() - print(foo) - foo?.length() + doSomething(foo) + foo?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt index ad692c4df57..e78849e13b2 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt @@ -6,7 +6,7 @@ val x = maybeFoo() fun main(args: Array) { if (x != null) { - x.length() + x.length } else { null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after index 6665cb79390..336763c63b8 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/doesNotinlineValueOutsideOfScope.kt.after @@ -5,5 +5,5 @@ fun maybeFoo(): String? { val x = maybeFoo() fun main(args: Array) { - x?.length() + x?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt index 783bdd89eb3..6898c3e73b6 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt @@ -7,6 +7,6 @@ fun main(args: Array) { if (foo == null) { } else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/emptyThenBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt index 380ad91c1a9..0fa6af278bc 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) { - foo.length() + foo.length } else { null diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseBothInBlocks.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt index 477185371da..1704670fb88 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/ifAndElseNotInBlocks.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt index 9e40449ed9d..6f3bbb05e81 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (foo == null) null else - foo.length() + foo.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt index 477185371da..1704670fb88 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/lhsNotEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt index e279a4cfa6b..6b0aff7dff3 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noCondition.kt @@ -1,7 +1,10 @@ // IS_APPLICABLE: false +// ERROR: Type mismatch.
Required:kotlin.Boolean
Found:() → kotlin.Int
+// ERROR: Condition must be of type kotlin.Boolean, but is of type () -> kotlin.Int +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.String? fun main(args: Array) { val foo: String? = "foo" if { - foo.length() + foo.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt index 540f6c9c2ad..fe5c1033f6d 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt @@ -5,6 +5,6 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo != null) { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noElseBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt index d6b5b7b9d45..12cf26a8d30 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition.kt @@ -3,7 +3,7 @@ fun main(args: Array) { val foo: String? = "foo" val bar: String? = null if (foo == bar) { - foo.length() + foo?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt index e43bf8493b5..248646563b1 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noNullInCondition2.kt @@ -3,7 +3,7 @@ fun main(args: Array) { val foo: String? = "foo" val bar: String? = null if (foo == bar) { - bar.length() + bar?.length } else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt index 35dd651a2d1..d7bc397240b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt @@ -5,6 +5,6 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (foo == null) else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/noThenBlock.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt index 53a42595091..cdd13643c7a 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForFunction.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (maybeFoo() == null) null else - maybeFoo().length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt index e63b7e966bc..5c49d8494d4 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/notApplicableForLocalVar.kt @@ -8,5 +8,5 @@ fun main(args: Array) { if (foo == null) null else - foo.length() + foo?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt index afa18c05c77..355382ecf92 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/otherBlockHasMoreThanOneStatement.kt @@ -1,11 +1,13 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main(args: Array) { val foo: String? = "abc" if (foo != null) { foo.length } else { - print("Hi") + doSomething("Hi") null } } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt index 741c7b8201b..775eda6f9fd 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt @@ -7,5 +7,5 @@ fun main(args: Array) { if (null == foo) null else - foo.length() + foo.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt index 446ee02b391..1b01ec846fb 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt @@ -5,7 +5,7 @@ fun maybeFoo(): String? { fun main(args: Array) { val foo = maybeFoo() if (null != foo) - foo.length() + foo.length else null } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after index 005ab996cad..cb42a95887b 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/rhsNotEqualsNull.kt.after @@ -3,5 +3,5 @@ fun maybeFoo(): String? { } fun main(args: Array) { - maybeFoo()?.length() + maybeFoo()?.length } diff --git a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt b/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt index e0284d9c0c1..5fc8dcf9896 100644 --- a/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt +++ b/idea/testData/intentions/branched/ifThenToSafeAccess/thenAndElseNotNull.kt @@ -1,10 +1,11 @@ // IS_APPLICABLE: false +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.String? fun main(args: Array) { val foo: String? = "foo" if (foo == null) { - foo.length() + foo.length } else { - foo.length() + foo.length } } diff --git a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt index af99f2543d2..f2e3216c7c8 100644 --- a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt +++ b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt @@ -1,9 +1,11 @@ +class Klass + fun test(obj: Any): String { return if (obj is String) "string" else if (obj is Int) "int" - else if (obj is Class<*>) + else if (obj is Klass<*>) "class" else "unknown" -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt.after b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt.after index e2902c7666b..4087cc4321d 100644 --- a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt.after +++ b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithIs.kt.after @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { - return when (obj) { + return when (obj) { is String -> "string" is Int -> "int" - is Class<*> -> "class" + is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt index 58dd7cc95c0..316ce60ecd9 100644 --- a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt +++ b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt @@ -1,5 +1,5 @@ -fun test(n: Int) { - val s = "test" +fun test(n: Int): String { + var s = "test" if (n == 0) s = "zero" else if (n == 1) @@ -7,4 +7,4 @@ fun test(n: Int) { else if (n == 2) s = "two" return s -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt.after b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt.after index 6d8e609bb89..eba2e89c9fe 100644 --- a/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt.after +++ b/idea/testData/intentions/branched/ifWhen/ifToWhen/ifWithoutElse.kt.after @@ -1,9 +1,9 @@ -fun test(n: Int) { - val s = "test" +fun test(n: Int): String { + var s = "test" when (n) { 0 -> s = "zero" 1 -> s = "one" 2 -> s = "two" } return s -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt index 807fda71d73..7db7e9d03a1 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt @@ -1,4 +1,4 @@ -class G { +object G { fun cat(x: Int, y: Int): Int { return x + y } @@ -10,4 +10,4 @@ fun test(x: Int, y: Int): String { 2 -> return "two" else -> return "big" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt.after b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt.after index 1e222021460..40ac6be79fb 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt.after +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithDotQualifiedExpression.kt.after @@ -1,4 +1,4 @@ -class G { +object G { fun cat(x: Int, y: Int): Int { return x + y } @@ -8,4 +8,4 @@ fun test(x: Int, y: Int): String { if (G.cat(x, y) == 1) return "one" else if (G.cat(x, y) == 2) return "two" else return "big" -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt index e2902c7666b..b8c20171533 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { return when (obj) { is String -> "string" is Int -> "int" - is Class<*> -> "class" + is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt.after b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt.after index ac6b419228f..aa107720a43 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt.after +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithPatterns.kt.after @@ -1,6 +1,8 @@ +class Klass + fun test(obj: Any): String { return if (obj is String) "string" else if (obj is Int) "int" - else if (obj is Class<*>) "class" + else if (obj is Klass<*>) "class" else "unknown" -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt index 2518d2d002c..a7e0dac5840 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt @@ -1,9 +1,9 @@ -fun test(n: Int) { - val s = "test" +fun test(n: Int): String { + var s = "test" when (n) { 0 -> s = "zero" 1 -> s = "one" 2 -> s = "two" } return s -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt.after b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt.after index 203b7af7658..558efa547b2 100644 --- a/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt.after +++ b/idea/testData/intentions/branched/ifWhen/whenToIf/whenWithoutElse.kt.after @@ -1,7 +1,7 @@ -fun test(n: Int) { - val s = "test" +fun test(n: Int): String { + var s = "test" if (n == 0) s = "zero" else if (n == 1) s = "one" else if (n == 2) s = "two" return s -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt index e6d6a17999d..3aee513b5e1 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt @@ -1,3 +1,5 @@ +fun String.length() = length + fun foo(): String? = "foo" fun main(args: Array) { foo()?.length() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after index 36fd675f675..7772f3ea49c 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpression.kt.after @@ -1,3 +1,5 @@ +fun String.length() = length + fun foo(): String? = "foo" fun main(args: Array) { val s = foo() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt index d15f4d385e6..c139cb26f16 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt @@ -1,4 +1,4 @@ fun foo(): String? = "foo" fun main(args: Array) { - (foo())?.length() + (foo())?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after index 36fd675f675..0a3ef666033 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/callExpressionParens.kt.after @@ -1,5 +1,5 @@ fun foo(): String? = "foo" fun main(args: Array) { val s = foo() - if (s != null) s.length() + if (s != null) s.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt index 0ca9a7ff744..9bfdab5a00e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + class Foo { val b: String? get() { - print("I have side effects") return "Foo" } } + fun main(args: Array) { val a = Foo() - println(a.b?.length) + doSomething(a.b?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after index 0b73b8baa0c..6bc9e2da30d 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/customGetterAsReceiver.kt.after @@ -1,12 +1,14 @@ +fun doSomething(a: T) {} + class Foo { val b: String? get() { - print("I have side effects") return "Foo" } } + fun main(args: Array) { val a = Foo() val s = a.b - println(if (s != null) s.length else null) + doSomething(if (s != null) s.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt index 53516b6f062..854d092e4b9 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun main(args: Array) { val a: String? = "A" - println(a?.length) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after index 6549fd41d83..f51978ee6a4 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localValLhs.kt.after @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun main(args: Array) { val a: String? = "A" - println(if (a != null) a.length else null) + doSomething(if (a != null) a.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt index 20fceba6361..e3d5106731e 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun main(args: Array) { var a: String? = "A" - println(a?.length) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after index 38d8108d209..fc41c7b64c6 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/localVarLhs.kt.after @@ -1,6 +1,8 @@ +fun doSomething(a: T) {} + fun main(args: Array) { var a: String? = "A" val s = a - println(if (s != null) s.length else null) + doSomething(if (s != null) s.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt index 64de5978d03..895100a9970 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt @@ -1,5 +1,4 @@ fun f(s: Int?) { - println(s) } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after index d126f1c8113..79623722267 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/safeAccessAsFunctionArgument.kt.after @@ -1,5 +1,4 @@ fun f(s: Int?) { - println(s) } fun main(args: Array) { diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt index a9e79d8e66e..399cea3f21b 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - foo?.length() + foo?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after index 7edbddc06a4..91b7da93332 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpression.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt index 362ca42d6d5..d7bc97f1bcf 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - (foo)?.length() + (foo)?.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after index 7edbddc06a4..91b7da93332 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/simpleNameExpressionInParens.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - if (foo != null) foo.length() + if (foo != null) foo.length } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt index 69c79de0530..cda046018dd 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + val a: String? = "A" fun main(args: Array) { - println(a?.length) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after index f39eeae1a84..6e492136395 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelVal.kt.after @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + val a: String? = "A" fun main(args: Array) { - println(if (a != null) a.length else null) + doSomething(if (a != null) a.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt index 8f95e5baa74..7993bb0bb8c 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt @@ -1,6 +1,8 @@ +fun doSomething(a: T) {} + val a: String? get() = "" fun main(args: Array) { - println(a?.length) + doSomething(a?.length) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after index 9e365779cb3..7e26971ef74 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/topLevelValCustomGetter.kt.after @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + val a: String? get() = "" fun main(args: Array) { val s = a - println(if (s != null) s.length else null) + doSomething(if (s != null) s.length else null) } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt index 8fac3f4df26..5f676080296 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - val y = if (true) foo?.length() else null + val y = if (true) foo?.length else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after index 9aa3f0e4882..934df9a48d2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsResultOfCheckedIf.kt.after @@ -1,4 +1,4 @@ fun main(args: Array) { val foo: String? = "foo" - val y = if (true) if (foo != null) foo.length() else null else null + val y = if (true) if (foo != null) foo.length else null else null } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt index ab67857d882..bcb92df6cd2 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt @@ -1,6 +1,6 @@ -fun doSth(): String? { - val x?: String = "abc" - return x?.reverse() +fun doSth(): Int? { + val x: String? = "abc" + return x?.length } fun main(args: Array) { val y = doSth() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after index 71f1d7219a5..97656a5c0cf 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedAsReturnValue.kt.after @@ -1,6 +1,6 @@ -fun doSth(): String? { - val x?: String = "abc" - return if (x != null) x.reverse() else null +fun doSth(): Int? { + val x: String? = "abc" + return if (x != null) x.length else null } fun main(args: Array) { val y = doSth() diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt index 3c803c93d22..fac801cbee7 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt @@ -1,6 +1,6 @@ fun main(args: Array) { val foo: String? = "foo" if (true) { - foo?.length() + foo?.length } } diff --git a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after index 6531d3ce562..4845e7f7f61 100644 --- a/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after +++ b/idea/testData/intentions/branched/safeAccessToIfThen/usedInUncheckedIfExpression.kt.after @@ -1,6 +1,6 @@ fun main(args: Array) { val foo: String? = "foo" if (true) { - if (foo != null) foo.length() + if (foo != null) foo.length } } diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt b/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt index 3202a0646e5..afff1fab549 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { res = if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") res = "two" } else { - println("***") + doSomething("***") res = "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt.after b/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt.after index b30ef836b9d..5be1951f3f5 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt.after +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/innerIfTransformed.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "???" } } else if (n == 2) { - println("***") + doSomething("***") res = "two" } else { - println("***") + doSomething("***") res = "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt b/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt index d5ae1e4a2b0..57df8cfe368 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String res = if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") "two" } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt.after b/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt.after index a4f680c426d..1d1f26b3b72 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt.after +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/nestedIfs.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { res = if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else res = if (n == 2) { - println("***") + doSomething("***") "two" } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt index 7307c997714..e8e65a034ff 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt @@ -1,13 +1,15 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String res = if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt.after index c64e90844c9..a527cb91934 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithBlocks.kt.after @@ -1,13 +1,15 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt index 3a76ff13628..7902e24ea8c 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToIf/simpleIfWithoutAssignment.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false fun test(n: Int): String { - var res: String + var res: String = "" if (n == 1) { "one" @@ -9,4 +9,4 @@ fun test(n: Int): String { } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt b/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt index d3f6b00fa62..c86fecce736 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (3 > 2) { res = when(n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } } else { - println("***") + doSomething("***") res = "???" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt.after b/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt.after index c1784696fd1..7fd5d6b64b4 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt.after +++ b/idea/testData/intentions/branched/unfolding/assignmentToWhen/innerWhenTransformed.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (3 > 2) { when(n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } } else { - println("***") + doSomething("***") res = "???" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt b/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt index 237433b09f3..6c7427fe0a6 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt @@ -1,16 +1,18 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String res = when (n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt.after index d3e4325d5de..6a9a40a4e3f 100644 --- a/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/assignmentToWhen/simpleWhenWithBlocks.kt.after @@ -1,16 +1,18 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt index d66fa1da47d..e2e76858a2e 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt @@ -1,19 +1,21 @@ +fun doSomething(a: T) {} + fun test(n: Int): String? { val res = if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") null } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt.after b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt.after index 5b1471d1878..45f7ea817a9 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs.kt.after @@ -1,20 +1,22 @@ +fun doSomething(a: T) {} + fun test(n: Int): String? { val res: String? if (n == 1) { res = if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else res = if (n == 2) { - println("***") + doSomething("***") null } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt index f395889d491..d0581293898 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt @@ -1,19 +1,21 @@ +fun doSomething(a: T) {} + fun test(n: Int): String? { var res = if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") null } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt.after b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt.after index a8fb5588cc6..46297e53a93 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/nestedIfs2.kt.after @@ -1,20 +1,22 @@ +fun doSomething(a: T) {} + fun test(n: Int): String? { var res: String? if (n == 1) { res = if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else res = if (n == 2) { - println("***") + doSomething("***") null } else { - println("***") + doSomething("***") "too many" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt index 3bc95c25fd9..78282f4d676 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { val res = if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt.after index 953ab6c8863..ddfcae39357 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks.kt.after @@ -1,12 +1,14 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { val res: String if (n == 1) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt index acfe1239167..8b9351efbba 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res = if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt.after b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt.after index 705e0ce8b89..8ddbde32ec9 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToIf/simpleIfWithBlocks2.kt.after @@ -1,12 +1,14 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String if (n == 1) { - println("***") + doSomething("***") res = "one" } else { - println("***") + doSomething("***") res = "two" } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt index f2f5f133833..bab2b2436ca 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt @@ -1,14 +1,16 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { val res = when (n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt.after index b16b90b3c81..b65b8b621e1 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks.kt.after @@ -1,15 +1,17 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { val res: String when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt index fad0c972531..b69d6d669ab 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt +++ b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt @@ -1,14 +1,16 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res = when (n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt.after b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt.after index 74f9623e053..e9df13c30a7 100644 --- a/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt.after +++ b/idea/testData/intentions/branched/unfolding/propertyToWhen/simpleWhenWithBlocks2.kt.after @@ -1,15 +1,17 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { var res: String when (n) { 1 -> { - println("***") + doSomething("***") res = "one" } else -> { - println("***") + doSomething("***") res = "two" } } return res -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt b/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt index bf97963e5f0..91b297361d6 100644 --- a/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt +++ b/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt @@ -1,17 +1,19 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { return if (3 > 2) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "???" } } else if (n == 2) { - println("***") + doSomething("***") return "two" } else { - println("***") + doSomething("***") return "too many" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt.after b/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt.after index b402a1c2f2d..95a81bc5d77 100644 --- a/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt.after +++ b/idea/testData/intentions/branched/unfolding/returnToIf/innerIfTransformed.kt.after @@ -1,17 +1,19 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { if (3 > 2) { - println("***") + doSomething("***") return "one" } else { - println("***") + doSomething("***") return "???" } } else if (n == 2) { - println("***") + doSomething("***") return "two" } else { - println("***") + doSomething("***") return "too many" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt b/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt index a88492572b5..d14f08b85d2 100644 --- a/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { return if (n == 1) { - println("***") + doSomething("***") "one" } else { - println("***") + doSomething("***") "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt.after index 4a306f5f17d..f666928030f 100644 --- a/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/returnToIf/simpleIfWithBlocks.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (n == 1) { - println("***") + doSomething("***") return "one" } else { - println("***") + doSomething("***") return "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt b/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt index cec7664dbfa..8c966e99e4e 100644 --- a/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt +++ b/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (3 > 2) { return when (n) { @@ -5,7 +7,7 @@ fun test(n: Int): String { else -> "two" } } else { - println("***") + doSomething("***") return "???" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt.after b/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt.after index 0a5a8764560..d3882bbff04 100644 --- a/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt.after +++ b/idea/testData/intentions/branched/unfolding/returnToWhen/innerWhenTransformed.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { if (3 > 2) { when (n) { @@ -5,7 +7,7 @@ fun test(n: Int): String { else -> return "two" } } else { - println("***") + doSomething("***") return "???" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt b/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt index 5565cdc2ecd..932ced101af 100644 --- a/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt +++ b/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { return when(n) { 1 -> { - println("***") + doSomething("***") "one" } else -> { - println("***") + doSomething("***") "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt.after b/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt.after index 1c9b980257f..e3bd3b96550 100644 --- a/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt.after +++ b/idea/testData/intentions/branched/unfolding/returnToWhen/simpleWhenWithBlocks.kt.after @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + fun test(n: Int): String { when(n) { 1 -> { - println("***") + doSomething("***") return "one" } else -> { - println("***") + doSomething("***") return "two" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt b/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt index e2902c7666b..b8c20171533 100644 --- a/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt +++ b/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { return when (obj) { is String -> "string" is Int -> "int" - is Class<*> -> "class" + is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt.after b/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt.after index 3fd81cd40a8..686f1d8409f 100644 --- a/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt.after +++ b/idea/testData/intentions/branched/when/eliminateSubject/whenWithPatterns.kt.after @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { return when { obj is String -> "string" obj is Int -> "int" - obj is Class<*> -> "class" + obj is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt b/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt index 3fd81cd40a8..686f1d8409f 100644 --- a/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt +++ b/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { return when { obj is String -> "string" obj is Int -> "int" - obj is Class<*> -> "class" + obj is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt.after b/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt.after index e2902c7666b..b8c20171533 100644 --- a/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt.after +++ b/idea/testData/intentions/branched/when/introduceSubject/whenWithPatterns.kt.after @@ -1,8 +1,10 @@ +class Klass + fun test(obj: Any): String { return when (obj) { is String -> "string" is Int -> "int" - is Class<*> -> "class" + is Klass<*> -> "class" else -> "unknown" } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt b/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt index 3d0fb62df72..78cf776a7da 100644 --- a/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt +++ b/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt @@ -1,33 +1,35 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when (n) { 1 -> { res = "one" - println("A") + doSomething("A") } 2 -> { res = "two" - println("B") + doSomething("B") } else -> { res = "unknown" - println("C") + doSomething("C") } } when (n) { 1 -> { - println("A") - println("AA") + doSomething("A") + doSomething("AA") } 2 -> { - println("B") - println("BB") + doSomething("B") + doSomething("BB") } else -> { - println("C") - println("CC") + doSomething("C") + doSomething("CC") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt.after b/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt.after index 556689e3ec9..952cb7db6a7 100644 --- a/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt.after @@ -1,24 +1,26 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when (n) { 1 -> { res = "one" - println("A") - println("A") - println("AA") + doSomething("A") + doSomething("A") + doSomething("AA") } 2 -> { res = "two" - println("B") - println("B") - println("BB") + doSomething("B") + doSomething("B") + doSomething("BB") } else -> { res = "unknown" - println("C") - println("C") - println("CC") + doSomething("C") + doSomething("C") + doSomething("CC") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt b/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt index 1b1441e5f47..14b91aa966d 100644 --- a/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt +++ b/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt @@ -1,24 +1,26 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when (n) { 1 -> { res = "one" - println("A") + doSomething("A") } 2 -> { res = "two" - println("B") + doSomething("B") } else -> { res = "unknown" - println("C") + doSomething("C") } } when (n) { - 1 -> println("AA") - 2 -> println("BB") - else -> println("CC") + 1 -> doSomething("AA") + 2 -> doSomething("BB") + else -> doSomething("CC") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt.after b/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt.after index fb1151646af..b60336e6410 100644 --- a/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt.after @@ -1,21 +1,23 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when (n) { 1 -> { res = "one" - println("A") - println("AA") + doSomething("A") + doSomething("AA") } 2 -> { res = "two" - println("B") - println("BB") + doSomething("B") + doSomething("BB") } else -> { res = "unknown" - println("C") - println("CC") + doSomething("C") + doSomething("CC") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithConflictingDeclarations.kt b/idea/testData/intentions/branched/when/merge/mergeWithConflictingDeclarations.kt index a77ed71f010..ed9dd646a5f 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithConflictingDeclarations.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithConflictingDeclarations.kt @@ -1,4 +1,7 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -6,32 +9,32 @@ fun test(n: Int) { 1 -> { res = "one" val x = "A" - println(x) + doSomething(x) } 2 -> { res = "two" val x = "B" - println(x) + doSomething(x) } else -> { res = "unknown" val x = "C" - println(x) + doSomething(x) } } when (n) { 1 -> { val x = "AA" - println(x) + doSomething(x) } 2 -> { val x = "BB" - println(x) + doSomething(x) } else -> { val x = "CC" - println(x) + doSomething(x) } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt b/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt index 45c7289c3a7..5bd53a61ceb 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -5,32 +7,32 @@ fun test(n: Int) { 1 -> { res = "one" val x = "A" - println(x) + doSomething(x) } 2 -> { res = "two" val x = "B" - println(x) + doSomething(x) } else -> { res = "unknown" val x = "C" - println(x) + doSomething(x) } } when (n) { 1 -> { val y = "AA" - println(y) + doSomething(y) } 2 -> { val y = "BB" - println(y) + doSomething(y) } else -> { val y = "CC" - println(y) + doSomething(y) } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt.after b/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt.after index 493f68f5df4..9789f4849db 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -5,23 +7,23 @@ fun test(n: Int) { 1 -> { res = "one" val x = "A" - println(x) + doSomething(x) val y = "AA" - println(y) + doSomething(y) } 2 -> { res = "two" val x = "B" - println(x) + doSomething(x) val y = "BB" - println(y) + doSomething(y) } else -> { res = "unknown" val x = "C" - println(x) + doSomething(x) val y = "CC" - println(y) + doSomething(y) } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt b/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt index 9096c170fc9..5c1bce29b46 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun test(n: Int) { var res: String = "" when (n) { - 1 -> println("A") - 2 -> println("B") - else -> println("C") + 1 -> doSomething("A") + 2 -> doSomething("B") + else -> doSomething("C") } when (n) { @@ -15,4 +17,4 @@ fun test(n: Int) { return } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt.after b/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt.after index 54dd4bf46f4..bf510850dfc 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt.after @@ -1,19 +1,21 @@ +fun doSomething(a: T) {} + fun test(n: Int) { var res: String = "" when (n) { 1 -> { - println("A") + doSomething("A") res = "one" } 2 -> { - println("B") + doSomething("B") res = "two" } else -> { - println("C") + doSomething("C") res = "unknown" return } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithReturnBefore.kt b/idea/testData/intentions/branched/when/merge/mergeWithReturnBefore.kt index 56959a635c6..cd73245bbfc 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithReturnBefore.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithReturnBefore.kt @@ -1,4 +1,7 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun test(n: Int) { var res: String = "" @@ -12,8 +15,8 @@ fun test(n: Int) { } when (n) { - 1 -> println("A") - 2 -> println("B") - else -> println("C") + 1 -> doSomething("A") + 2 -> doSomething("B") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt b/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt index 1b106e5650c..8a79481ae9d 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -8,8 +10,8 @@ fun test(n: Int) { } when (n) { - 1 -> println("A") - 2 -> println("B") - else -> println("C") + 1 -> doSomething("A") + 2 -> doSomething("B") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt.after b/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt.after index 324f04e98bf..223c0e1e9d9 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeWithSubject.kt.after @@ -1,18 +1,20 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when (n) { 1 -> { res = "one" - println("A") + doSomething("A") } 2 -> { res = "two" - println("B") + doSomething("B") } else -> { res = "unknown" - println("C") + doSomething("C") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions1.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions1.kt index a6f308f70d6..004e860f3d0 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions1.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions1.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,7 +11,7 @@ fun test(n: Int) { } when (n) { - 1 -> println("A") - else -> println("C") + 1 -> doSomething("A") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions2.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions2.kt index e1428893c8d..dbad7590056 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions2.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions2.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,9 +11,9 @@ fun test(n: Int) { } when (n) { - 1 -> println("A") - 2 -> println("B") - 3 -> println("D") - else -> println("C") + 1 -> doSomething("A") + 2 -> doSomething("B") + 3 -> doSomething("D") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions3.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions3.kt index 40621363476..cd46ac10c63 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions3.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions3.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,8 +11,8 @@ fun test(n: Int) { } when (n) { - 2 -> println("B") - 1 -> println("A") - else -> println("C") + 2 -> doSomething("B") + 1 -> doSomething("A") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions4.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions4.kt index 075e5231db8..b6ad4ac53af 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions4.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions4.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,7 +11,7 @@ fun test(n: Int) { } when { - n == 1 -> println("A") - else -> println("C") + n == 1 -> doSomething("A") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions5.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions5.kt index 820b106bd29..6415b952bb8 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions5.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions5.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,9 +11,9 @@ fun test(n: Int) { } when { - n == 1 -> println("A") - n == 2 -> println("B") - n == 3 -> println("D") - else -> println("C") + n == 1 -> doSomething("A") + n == 2 -> doSomething("B") + n == 3 -> doSomething("D") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions6.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions6.kt index 23f33e2d45f..db7b74b663c 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions6.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions6.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,8 +11,8 @@ fun test(n: Int) { } when { - n == 2 -> println("B") - n == 1 -> println("A") - else -> println("C") + n == 2 -> doSomething("B") + n == 1 -> doSomething("A") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions7.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions7.kt index 38a2b861d59..4d87fac2524 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions7.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions7.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,8 +11,8 @@ fun test(n: Int) { } when { - n + 1 == 2 -> println("B") - n + 1 == 3 -> println("A") - else -> println("C") + n + 1 == 2 -> doSomething("B") + n + 1 == 3 -> doSomething("A") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects1.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects1.kt index 872141c0db3..44c65ce7b36 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects1.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects1.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,8 +11,8 @@ fun test(n: Int) { } when { - n == 1 -> println("A") - n == 2 -> println("B") - else -> println("C") + n == 1 -> doSomething("A") + n == 2 -> doSomething("B") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects2.kt b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects2.kt index ff4e5a08df5..178730ace8e 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects2.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects2.kt @@ -1,4 +1,6 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -9,8 +11,8 @@ fun test(n: Int) { } when (n + 1) { - 1 -> println("A") - 2 -> println("B") - else -> println("C") + 1 -> doSomething("A") + 2 -> doSomething("B") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt b/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt index 3152c239c05..13c5aaacb34 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt +++ b/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String @@ -8,8 +10,8 @@ fun test(n: Int) { } when { - n == 1 -> println("A") - n == 2 -> println("B") - else -> println("C") + n == 1 -> doSomething("A") + n == 2 -> doSomething("B") + else -> doSomething("C") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt.after b/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt.after index 6eb01385b81..8eab31f8ca2 100644 --- a/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt.after +++ b/idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt.after @@ -1,18 +1,20 @@ +fun doSomething(a: T) {} + fun test(n: Int) { val res: String when { n == 1 -> { res = "one" - println("A") + doSomething("A") } n == 2 -> { res = "two" - println("B") + doSomething("B") } else -> { res = "unknown" - println("C") + doSomething("C") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt index 49840996d70..291e81decc3 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean, c: Boolean): Boolean { return !a && !b && !c -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt.after index b83285c0ace..774720db8d4 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfThreeNegations.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean, c: Boolean): Boolean { return !(a || b || c) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt index 4678b24a3eb..b52ded667f9 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !a && !b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt.after index e73961dec90..d229f5ba5cf 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/conjunctionOfTwoNegations.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !(a || b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt b/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt index c3c9377836b..f8c5bad0a57 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !a || !b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt.after index c7b27760bc3..4fb8be5ca42 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/disjunctionOfTwoNegations.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !(a && b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt b/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt index f6e5801bc00..940d2489ad2 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean, c: Boolean) { +fun foo(a: Boolean, b: Boolean, c: Boolean): Boolean { return !(a && b) || !(a || c) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt.after index 7e0380a1434..ae75f1ce840 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/doubleParenthesizedExpression.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean, c: Boolean) { +fun foo(a: Boolean, b: Boolean, c: Boolean): Boolean { return !((a && b) && (a || c)) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedOperators.kt b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedOperators.kt index f0f2ab1fdd1..b32e0c26513 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedOperators.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedOperators.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(a: Boolean, b: Boolean, c: Boolean) { +fun foo(a: Boolean, b: Boolean, c: Boolean): Boolean { return !a && !b || !c -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedSequence.kt b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedSequence.kt index 9a00ea9e04b..5cca24ba936 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedSequence.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableMixedSequence.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(a: Boolean, b: boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !a && b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableSingleExpression.kt b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableSingleExpression.kt index 67006f8d882..323547c090f 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableSingleExpression.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/inapplicableSingleExpression.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(a: Boolean) { +fun foo(a: Boolean): Boolean { return !a -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt b/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt index ec0f7b9e15f..0320d57403d 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt @@ -1,11 +1,11 @@ -fun bar1() { +fun bar1(): Boolean { return true } -fun bar2() { +fun bar2(): Boolean { return false } -fun foo() { +fun foo(): Boolean { return !bar1() && !bar2() -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt.after index d4ff0111043..da0dbeb5f57 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/negatedFunction.kt.after @@ -1,11 +1,11 @@ -fun bar1() { +fun bar1(): Boolean { return true } -fun bar2() { +fun bar2(): Boolean { return false } -fun foo() { +fun foo(): Boolean { return !(bar1() || bar2()) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt b/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt index 087a3aa1d27..dabf8cdd5bd 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt +++ b/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return (!a && !b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt.after b/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt.after index e73961dec90..d229f5ba5cf 100644 --- a/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt.after +++ b/idea/testData/intentions/convertNegatedBooleanSequence/parenthesizedConjunctionOfTwoNegations.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) { +fun foo(a: Boolean, b: Boolean): Boolean { return !(a || b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt index 460bee829aa..51ede2c0e1f 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt @@ -1,7 +1,7 @@ fun String.not(): Boolean { - return isEmpty() + return length == 0 } fun foo(a: Boolean, b: Boolean) : Boolean { return !(!"" || b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after index 5ba3daae8c6..6c6a20b38bc 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after @@ -1,7 +1,7 @@ fun String.not(): Boolean { - return isEmpty() + return length == 0 } fun foo(a: Boolean, b: Boolean) : Boolean { return !!"" && !b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableOperator.kt b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableOperator.kt index 0487f43155e..00582dd97e4 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableOperator.kt +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableOperator.kt @@ -1,4 +1,5 @@ // IS_APPLICABLE: false +// ERROR: Unresolved reference.
None of the following candidates is applicable because of receiver type mismatch:
  • public fun kotlin.String?.plus(other: kotlin.Any?): kotlin.String defined in kotlin
fun foo(a: Boolean, b: Boolean) : Boolean { return !(!a + b) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableTriple.kt b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableTriple.kt index b497b856468..6a98a6a6055 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableTriple.kt +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/inapplicableTriple.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(a: Boolean, b: Boolean, c: Boolean) : Boolean { +fun foo(a: Boolean, b: Boolean, c: Boolean, d: Boolean) : Boolean { return !(a && b && c || !d) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt index a70db9fe6e7..5229619d91b 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) : Boolean { +fun foo(a: Boolean, b: Boolean, c: Boolean) : Boolean { return !(a || !b || c) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt.after b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt.after index 01d806d823f..20439b9bb45 100644 --- a/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt.after +++ b/idea/testData/intentions/convertNegatedExpressionWithDemorgansLaw/longMixedExpression.kt.after @@ -1,3 +1,3 @@ -fun foo(a: Boolean, b: Boolean) : Boolean { +fun foo(a: Boolean, b: Boolean, c: Boolean) : Boolean { return !a && !!b && !c -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt b/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt index 3e31bf3cd8f..6fff9a00538 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt @@ -1,3 +1,5 @@ class Owner { - fun f(p: () -> Unit): (Int) -> String {} -} \ No newline at end of file + fun f(p: () -> Unit): (Int) -> String { + return { it.toString() } + } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt.after index 881701ac105..4af0824a0d7 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/functionType.kt.after @@ -2,4 +2,5 @@ class Owner { } fun Owner.f(p: () -> Unit): (Int) -> String { -} \ No newline at end of file + return { it.toString() } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt index 52e1134e40a..dd69095a2fa 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt @@ -1,3 +1,3 @@ abstract class Owner { - fun f(t: T, r: R): R = t -} \ No newline at end of file + fun f(t: T, r: R): R = r +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt.after index a8497f3a9e1..c1ee18f6097 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClass.kt.after @@ -1,4 +1,4 @@ abstract class Owner { } -fun Owner.f(t: T, r: R): R = t \ No newline at end of file +fun Owner.f(t: T, r: R): R = r diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt index 387c48a1450..e146dea4399 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt @@ -1,3 +1,3 @@ abstract class Owner> { - fun f(t: T, r: R): R = t -} \ No newline at end of file + fun f(t: T, r: R): R = r +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt.after index cf29f7304c0..42e9aae4a23 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericFunInGenericClassWithUpperBounds.kt.after @@ -1,4 +1,4 @@ abstract class Owner> { } -fun , R : T> Owner.f(t: T, r: R): R = t \ No newline at end of file +fun , R : T> Owner.f(t: T, r: R): R = r diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt b/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt index a29cb0cbb48..1e5e854d725 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt @@ -1,3 +1,5 @@ +// ERROR: Property must be initialized or be abstract + class Owner { val p: R -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt.after index 0ead7010e46..1c16897cd39 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/genericProperty.kt.after @@ -1,5 +1,7 @@ +// ERROR: Property must be initialized or be abstract + class Owner { } val Owner.p: R - get() = throw UnsupportedOperationException() \ No newline at end of file + get() = throw UnsupportedOperationException() diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt b/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt index 027e44c4936..5e60d8c3e0e 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt @@ -1,3 +1,3 @@ abstract class Owner { - protected fun f() = 1 -} \ No newline at end of file + protected fun f(): Int = 1 +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt.after index ba37da9bae1..6847afd6630 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/protected.kt.after @@ -1,4 +1,4 @@ abstract class Owner { } -fun Owner.f() = 1 \ No newline at end of file +fun Owner.f(): Int = 1 diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/public.kt b/idea/testData/intentions/declarations/convertMemberToExtension/public.kt index 3f2bd78ad02..2612f7eb8d5 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/public.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/public.kt @@ -1,3 +1,3 @@ abstract class Owner { - public fun f() = 1 -} \ No newline at end of file + public fun f(): Int = 1 +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/public.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/public.kt.after index 85ecb717ac4..f48381003da 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/public.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/public.kt.after @@ -1,4 +1,4 @@ abstract class Owner { } -public fun Owner.f() = 1 \ No newline at end of file +public fun Owner.f(): Int = 1 diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt b/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt index edb98bf6da1..d30a768410b 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt @@ -1,3 +1,5 @@ class Owner { - fun f(p: kotlin.Int): kotlin.String {} -} \ No newline at end of file + fun f(p: kotlin.Int): kotlin.String { + return p.toString() + } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt.after index 162cb244b54..f99d05ea166 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/typeFqName.kt.after @@ -2,4 +2,5 @@ class Owner { } fun Owner.f(p: kotlin.Int): kotlin.String { -} \ No newline at end of file + return p.toString() +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt b/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt index e09668f02de..afffecfc498 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt @@ -1,3 +1,8 @@ +// ERROR: A 'return' expression required in a function with a block body ('{...}') +// ERROR: Unresolved reference: Foo +// ERROR: Unresolved reference: bar + class Owner { - fun f(p: Foo): bar.Baz {} -} \ No newline at end of file + fun f(p: Foo): bar.Baz { + } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt.after index 7233eed0611..2dcd74b759b 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/unknownType.kt.after @@ -1,5 +1,9 @@ +// ERROR: A 'return' expression required in a function with a block body ('{...}') +// ERROR: Unresolved reference: Foo +// ERROR: Unresolved reference: bar + class Owner { } fun Owner.f(p: Foo): bar.Baz { -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt b/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt index bf495ea7614..59c91c819d4 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt @@ -1,4 +1,5 @@ +// ERROR: Property must be initialized or be abstract class Owner { val p: Int get -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt.after index 1b6c5228c91..6cf9f03934a 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/valWithDefaultGetter.kt.after @@ -1,5 +1,6 @@ +// ERROR: Property must be initialized or be abstract class Owner { } val Owner.p: Int - get() = throw UnsupportedOperationException() \ No newline at end of file + get() = throw UnsupportedOperationException() diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt index 6b308034a01..5fb183d8048 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt @@ -1,5 +1,6 @@ +// ERROR: Property must be initialized or be abstract class Owner { var p: Int get set -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt.after index 3e72abd4aa2..b00e89859f8 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultGetterAndSetter.kt.after @@ -1,3 +1,4 @@ +// ERROR: Property must be initialized or be abstract class Owner { } @@ -5,4 +6,4 @@ var Owner.p: Int get() = throw UnsupportedOperationException() set(value) { throw UnsupportedOperationException() - } \ No newline at end of file + } diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt index 367251dc94d..41872aa9f2f 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt @@ -1,5 +1,6 @@ +// ERROR: Property must be initialized class Owner { var p: Int get() = 1 set -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt.after index 0e4d58843c1..2918f8c8161 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithDefaultSetter.kt.after @@ -1,3 +1,4 @@ +// ERROR: Property must be initialized class Owner { } @@ -5,4 +6,4 @@ var Owner.p: Int get() = 1 set(value) { throw UnsupportedOperationException() - } \ No newline at end of file + } diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt b/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt index 1428fed8783..5fda1810465 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt @@ -1,4 +1,5 @@ +// ERROR: Property must be initialized class Owner { var p: Int - get {return 1} -} \ No newline at end of file + get() { return 1 } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt.after index 86d2ba8877f..04dfe6da5cb 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithGetter.kt.after @@ -1,10 +1,11 @@ +// ERROR: Property must be initialized class Owner { } var Owner.p: Int - get { + get() { return 1 } set(value) { throw UnsupportedOperationException() - } \ No newline at end of file + } diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt b/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt index db97b7a64b0..b266fe9faf9 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt @@ -1,4 +1,5 @@ +// ERROR: Property must be initialized class Owner { var p: Int set(v) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt.after index 3b9e8388335..7504abc00a8 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/varWithSetter.kt.after @@ -1,7 +1,8 @@ +// ERROR: Property must be initialized class Owner { } var Owner.p: Int get() = throw UnsupportedOperationException() set(v) { - } \ No newline at end of file + } diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt b/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt index 49ee1bd345e..e7ab92d6458 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt +++ b/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt @@ -1,3 +1,3 @@ class Owner { - fun f(): Int {} -} \ No newline at end of file + fun f(): Int { return 1 } +} diff --git a/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt.after b/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt.after index d542a992e3a..fc4fa717dc6 100644 --- a/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt.after +++ b/idea/testData/intentions/declarations/convertMemberToExtension/withType.kt.after @@ -2,4 +2,5 @@ class Owner { } fun Owner.f(): Int { -} \ No newline at end of file + return 1 +} diff --git a/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt b/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt index 51bd3dcd82d..979e25367ad 100644 --- a/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt +++ b/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt @@ -1,3 +1,5 @@ +// ERROR: Unresolved reference: X + fun foo(n: Int) { var x = X<>() -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt.after b/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt.after index 9dcfc7aecd4..11fb4c283a3 100644 --- a/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt.after +++ b/idea/testData/intentions/declarations/split/simpleInitWithErrorType.kt.after @@ -1,4 +1,6 @@ +// ERROR: Unresolved reference: X + fun foo(n: Int) { var x x = X<>() -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt b/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt index bb139cd5e98..bc21637edca 100644 --- a/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt +++ b/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt @@ -1,3 +1,5 @@ +// ERROR: Unresolved reference: X + fun foo(n: Int) { val x = X<>() -} \ No newline at end of file +} diff --git a/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt.after b/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt.after index d62ed3fdfe2..e704e9225c6 100644 --- a/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt.after +++ b/idea/testData/intentions/declarations/split/simpleInitWithErrorType2.kt.after @@ -1,4 +1,6 @@ +// ERROR: Unresolved reference: X + fun foo(n: Int) { val x x = X<>() -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt index d594faca84c..193c32f3d7d 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt @@ -3,6 +3,6 @@ fun foo() { bar({ it }) } -fun bar(b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(b: (Int) -> Int) { + b(1) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt index 720df5a0303..c9e444d2a11 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt @@ -1,6 +1,9 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun foo(x: Int) { if (x == 1) { - println(x) + doSomething(x) } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt index 835fb1c444f..e8f13a3a1ea 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt @@ -5,6 +5,6 @@ fun foo() { } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after index 58cb2a46461..22113a0b5b6 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after @@ -5,6 +5,6 @@ fun foo() { }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt index f24e690a374..a6b03b8d32e 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt @@ -3,6 +3,6 @@ fun foo() { bar("x") { it } } -fun bar(t:T, a: Int->Int) : Int { +fun bar(t:T, a: (Int) -> Int): Int { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt.after index 3a9fa51b4cc..81dd0dfcf8e 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda10.kt.after @@ -3,6 +3,6 @@ fun foo() { bar("x", { it }) } -fun bar(t:T, a: Int->Int) : Int { +fun bar(t:T, a: (Int) -> Int): Int { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt index 39e574246c0..0125985af4a 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt @@ -1,8 +1,8 @@ // IS_APPLICABLE: true fun foo() { - bar { it } + bar { it.toString() } } fun bar(a: (Int)->T): T { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt.after index 737c2dd379e..4e26428259e 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda11.kt.after @@ -1,8 +1,8 @@ // IS_APPLICABLE: true fun foo() { - bar({ it }) + bar({ it.toString() }) } fun bar(a: (Int)->T): T { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt index d6b2663a1c9..90b8f3f7151 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt @@ -3,6 +3,6 @@ fun foo() { bar(2) {it * 3} } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after index 8868f1bc3de..20c53729cf1 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(2, { it * 3 }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt index 31004bf69ac..7a059acd8e8 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt @@ -6,6 +6,6 @@ fun foo() { } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after index cb6e7f4ddae..ea70185af52 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after @@ -6,6 +6,6 @@ fun foo() { }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt index dfdc8710052..a10b2c252f1 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt @@ -6,6 +6,6 @@ fun foo() { } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after index 9d3647d77d3..24d9a00974a 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after @@ -6,6 +6,6 @@ fun foo() { }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt index 437fb26f84e..3e3f2d31b84 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt @@ -3,6 +3,6 @@ fun foo() { bar() { it } } -fun bar(b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(b: (Int) -> Int) { + b(1) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after index 8fba2fbc9b0..75af117e85e 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after @@ -3,6 +3,6 @@ fun foo() { bar({ it }) } -fun bar(b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(b: (Int) -> Int) { + b(1) +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt index 486e27aea22..b03e82c26bf 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3) { it } } -fun bar(name1: Int, name2: Int->Int) : Int { +fun bar(name1: Int, name2: (Int) -> Int): Int { return name2(name1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after index 233b34e7518..9e1d7ab65d9 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3, name2 = { it }) } -fun bar(name1: Int, name2: Int->Int) : Int { +fun bar(name1: Int, name2: (Int) -> Int): Int { return name2(name1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt index a04d1da3929..3f39d585c6c 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3, name2 = 2, name3 = 1) { it } } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int): Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after index d74f1767df4..b27691775e9 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3, name2 = 2, name3 = 1, name4 = { it }) } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int): Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt index e0d0dbffbe5..2cb50cee8fa 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt @@ -3,6 +3,6 @@ fun foo() { bar(3, 2, 1) { it } } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int): Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after index be1c8bdf05e..0cfa9e2e807 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(3, 2, 1, { it }) } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int): Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt index 95dfd348567..64a0e681c6e 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt @@ -3,6 +3,6 @@ fun foo() { bar { it } } -fun bar(a: Int->Int) : Int { +fun bar(a: (Int) -> Int): Int { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after index cc854b360bd..cdc96699980 100644 --- a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after @@ -3,6 +3,6 @@ fun foo() { bar({ it }) } -fun bar(a: Int->Int) : Int { +fun bar(a: (Int) -> Int): Int { return a(1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt index e9d9247c9dd..24af5abf2ce 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt @@ -3,6 +3,6 @@ fun foo() { bar() { it } } -fun bar(b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(b: (Int) -> Int) { + b(1) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt index 720df5a0303..c9e444d2a11 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt @@ -1,6 +1,9 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun foo(x: Int) { if (x == 1) { - println(x) + doSomething(x) } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt index 10bf413bbe8..dd839bbed95 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt @@ -1,8 +1,11 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun foo(x: Int) { if (x == 1) { - println(x) + doSomething(x) } } -fun x() { println("x") } \ No newline at end of file +fun x() { doSomething("x") } diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt index e74421c044d..862f1c52a1d 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt @@ -3,6 +3,6 @@ fun foo() { bar(2, { it }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after index 3b0a33d1273..63796900007 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(2) { it } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt index 13666b8ae25..3f9f7c2fe35 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt @@ -3,6 +3,6 @@ fun foo() { bar(a = 2, b = { it }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after index 5240c827bc4..99b0d279b5a 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(a = 2) { it } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt index a22b80ccb36..b64da51a30e 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt @@ -1,8 +1,11 @@ // IS_APPLICABLE: true +// ERROR: Type mismatch.
Required:kotlin.Int
Found:() → ???
+// ERROR: No value passed for parameter b +// ERROR: Unresolved reference: it fun foo() { bar({ it }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after index b1a3f428743..4824cdb8676 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after @@ -1,8 +1,11 @@ // IS_APPLICABLE: true +// ERROR: Type mismatch.
Required:kotlin.Int
Found:() → ???
+// ERROR: No value passed for parameter b +// ERROR: Unresolved reference: it fun foo() { bar { it } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt index 713b1794978..c6af1292d25 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt @@ -6,6 +6,6 @@ fun foo() { }) } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after index 71374ae005a..aa16d81aea1 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after @@ -6,6 +6,6 @@ fun foo() { } } -fun bar(a: Int, b: Int->Int) { - return b(a) -} \ No newline at end of file +fun bar(a: Int, b: (Int) -> Int) { + b(a) +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt index de5b956ae7d..3b9423e0be6 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3, name2 = 2, name3 = 1, name4 = { it }) } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after index 6df9201fde4..9ee77818b18 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(name1 = 3, name2 = 2, name3 = 1) { it } } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt index 91c281d86fd..3622b3bb1f3 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt @@ -3,6 +3,6 @@ fun foo() { bar(3, 2, 1, { it }) } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after index c12751d9c40..3225e17c855 100644 --- a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after @@ -3,6 +3,6 @@ fun foo() { bar(3, 2, 1) { it } } -fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { +fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int { return name4(name1) + name2 + name3 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/reconstructedType/errorType.kt b/idea/testData/intentions/reconstructedType/errorType.kt index 6e2deb6e00c..ff3f5d318b6 100644 --- a/idea/testData/intentions/reconstructedType/errorType.kt +++ b/idea/testData/intentions/reconstructedType/errorType.kt @@ -1,2 +1,3 @@ // IS_APPLICABLE: false -fun foo(a: Any) = a as G \ No newline at end of file +// ERROR: Unresolved reference: G +fun foo(a: Any) = a as G diff --git a/idea/testData/intentions/reconstructedType/reconstructableType.kt b/idea/testData/intentions/reconstructedType/reconstructableType.kt index fdc206ab427..edf059093ab 100644 --- a/idea/testData/intentions/reconstructedType/reconstructableType.kt +++ b/idea/testData/intentions/reconstructedType/reconstructableType.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: true -class B -class G: B +open class B +class G: B() -fun foo(a: B) = a as G \ No newline at end of file +fun foo(a: B) = a as G diff --git a/idea/testData/intentions/reconstructedType/reconstructableType.kt.after b/idea/testData/intentions/reconstructedType/reconstructableType.kt.after index 43667449d20..10cace0bba2 100644 --- a/idea/testData/intentions/reconstructedType/reconstructableType.kt.after +++ b/idea/testData/intentions/reconstructedType/reconstructableType.kt.after @@ -1,5 +1,5 @@ // IS_APPLICABLE: true -class B -class G: B +open class B +class G: B() -fun foo(a: B) = a as G \ No newline at end of file +fun foo(a: B) = a as G diff --git a/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt b/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt index 74cb3274a34..66c2f0b39cc 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { do { - println("test") + doSomething("test") } while(true) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt.after b/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt.after index d6f116aac2f..b0b5c104ad6 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForDoWhile.kt.after @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { - do println("test") + do doSomething("test") while(true) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForDoWhileWithTwoStatements.kt b/idea/testData/intentions/removeBraces/removeBracesForDoWhileWithTwoStatements.kt index 6221971ac98..32188f51cff 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForDoWhileWithTwoStatements.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForDoWhileWithTwoStatements.kt @@ -1,7 +1,9 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { do { - println("test") - println("test2") + doSomething("test") + doSomething("test2") } while(true) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForElse.kt b/idea/testData/intentions/removeBraces/removeBracesForElse.kt index bb11287dce3..38b1801e62c 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForElse.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForElse.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") + doSomething("test") } else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForElse.kt.after b/idea/testData/intentions/removeBraces/removeBracesForElse.kt.after index cc2cb2f8496..5b85659678b 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForElse.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForElse.kt.after @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") - } else println("test2") -} \ No newline at end of file + doSomething("test") + } else doSomething("test2") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForFor.kt b/idea/testData/intentions/removeBraces/removeBracesForFor.kt index a92406306b1..ff9fb40ee8a 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForFor.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForFor.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { for (i in 1..4) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForFor.kt.after b/idea/testData/intentions/removeBraces/removeBracesForFor.kt.after index 1476d615f20..05930125351 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForFor.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForFor.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - for (i in 1..4) println("test") -} \ No newline at end of file + for (i in 1..4) doSomething("test") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIf.kt b/idea/testData/intentions/removeBraces/removeBracesForIf.kt index f109107e479..3c452d03977 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIf.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForIf.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIf.kt.after b/idea/testData/intentions/removeBraces/removeBracesForIf.kt.after index d03da0fa088..e1dd424c946 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIf.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForIf.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test") -} \ No newline at end of file + if (true) doSomething("test") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt b/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt index ff8570117c8..24e2680c29f 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt @@ -1,6 +1,8 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { //comment - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt.after b/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt.after index 89481bb8a86..538aae35e4f 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForIfWithComment.kt.after @@ -1,4 +1,6 @@ +fun doSomething(a: T) {} + fun foo() { //comment - if (true) println("test") -} \ No newline at end of file + if (true) doSomething("test") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt b/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt index 418b9bde4f4..c7c92569e13 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test"); + doSomething("test"); } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt.after b/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt.after index d03da0fa088..e1dd424c946 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForIfWithSemicolon.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - if (true) println("test") -} \ No newline at end of file + if (true) doSomething("test") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForIfWithTwoStatements.kt b/idea/testData/intentions/removeBraces/removeBracesForIfWithTwoStatements.kt index ddfe175ea74..7a75713f943 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForIfWithTwoStatements.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForIfWithTwoStatements.kt @@ -1,7 +1,9 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { if (true) { - println("test") - println("test2") + doSomething("test") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForWhile.kt b/idea/testData/intentions/removeBraces/removeBracesForWhile.kt index 43985b52d58..bfefbdeaca8 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForWhile.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForWhile.kt @@ -1,5 +1,7 @@ +fun doSomething(a: T) {} + fun foo() { while (true) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForWhile.kt.after b/idea/testData/intentions/removeBraces/removeBracesForWhile.kt.after index bc8f9cdf094..607d50e6007 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForWhile.kt.after +++ b/idea/testData/intentions/removeBraces/removeBracesForWhile.kt.after @@ -1,3 +1,5 @@ +fun doSomething(a: T) {} + fun foo() { - while (true) println("test") -} \ No newline at end of file + while (true) doSomething("test") +} diff --git a/idea/testData/intentions/removeBraces/removeBracesForWhileWithTwoStatements.kt b/idea/testData/intentions/removeBraces/removeBracesForWhileWithTwoStatements.kt index cde3d69262c..b2da2ed4763 100644 --- a/idea/testData/intentions/removeBraces/removeBracesForWhileWithTwoStatements.kt +++ b/idea/testData/intentions/removeBraces/removeBracesForWhileWithTwoStatements.kt @@ -1,7 +1,9 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { while (true) { - println("test") - println("test2") + doSomething("test") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt b/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt index 3643b9437da..b4141791cb6 100644 --- a/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt +++ b/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt @@ -1,3 +1,3 @@ fun foo(i: Int) { - array(42)[(i + i)] -} \ No newline at end of file + Array(1, { 42 })[(i + i)] +} diff --git a/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt.after b/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt.after index 9fb29aa8036..1a6428284ce 100644 --- a/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt.after +++ b/idea/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses7.kt.after @@ -1,3 +1,3 @@ fun foo(i: Int) { - array(42)[i + i] -} \ No newline at end of file + Array(1, { 42 })[i + i] +} diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt index 67a5347a6d3..34e5914893d 100644 --- a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt @@ -1,6 +1,6 @@ fun foo(i: (Int) -> Unit) {} fun test() { foo { x -> - array(1, 2, 3).filter { x -> x % 2 == 0 } + foo { x -> x % 2 == 0 } } } diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after index 9367f9c4f05..0a469d897ec 100644 --- a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after @@ -1,6 +1,6 @@ fun foo(i: (Int) -> Unit) {} fun test() { foo { - array(1, 2, 3).filter { x -> x % 2 == 0 } + foo { x -> x % 2 == 0 } } } diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt index e13fc0e9baa..76a8b4102c6 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - (x foo 1).bar() -} \ No newline at end of file +fun foo(x: Int) { + (x shl 1).minus() +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt.after b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt.after index 28a10b9f1a1..9ae9abf5207 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt.after +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionCallAfterInfixCall.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - (x.foo(1)).bar() -} \ No newline at end of file +fun foo(x: Int) { + (x.shl(1)).minus() +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt index 537769d5d06..db15a7baac9 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt @@ -1,3 +1,6 @@ +trait Foo { + fun foo(f: (Int) -> Unit) +} fun foo(x: Foo) { x foo { it * 2 } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt.after b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt.after index 6b9feefa4d6..86a4b701ab8 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt.after +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/functionLiteralArgument.kt.after @@ -1,3 +1,6 @@ +trait Foo { + fun foo(f: (Int) -> Unit) +} fun foo(x: Foo) { x.foo { it * 2 } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nonApplicableBinaryOperation.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nonApplicableBinaryOperation.kt index 4d7bfd7316e..7a62c6a51d0 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nonApplicableBinaryOperation.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nonApplicableBinaryOperation.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(x: Foo) { +fun foo(x: String) { x == x -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt index bde450537ed..066148b11d6 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x!! foo 1 -} \ No newline at end of file +fun foo(x: String) { + x!! compareTo "1" +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt.after b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt.after index 406ad8b358d..7eb0a544afe 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt.after +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/nullAssertedCall.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x!!.foo(1) -} \ No newline at end of file +fun foo(x: String) { + x!!.compareTo("1") +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt index e59e87003f8..338269d3a97 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x foo (1 + 2) -} \ No newline at end of file +fun foo(x: String) { + x plus ("1" + "2") +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt.after b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt.after index 3e0027edf7b..e21575bb82f 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt.after +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/parenthesesAroundRightHandArgument.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x.foo(1 + 2) -} \ No newline at end of file +fun foo(x: String) { + x.plus("1" + "2") +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt index 4c324ec3b60..854a8f59505 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x foo 1 -} \ No newline at end of file +fun foo(x: Int) { + x compareTo 1 +} diff --git a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt.after b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt.after index 5b509a98f79..3f32bd9e9c4 100644 --- a/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt.after +++ b/idea/testData/intentions/replaceWithDotQualifiedMethodCall/simpleInfixFunctionCall.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x.foo(1) -} \ No newline at end of file +fun foo(x: Int) { + x.compareTo(1) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt index d07530c24c5..b7be6ef8cc6 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x.foo(1 + 2) -} \ No newline at end of file +fun foo(x: Int) { + x.compareTo(1 + 2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt.after index 09647c106b7..b014afd2cbd 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/binaryExpressionArgument.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x foo (1 + 2) -} \ No newline at end of file +fun foo(x: Int) { + x compareTo (1 + 2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt index 6f44b90ac9b..a78b043e34e 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - (x.foo(1)).bar(2) -} \ No newline at end of file +fun foo(x: Int) { + (x.times(1)).div(2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt.after index de1fe05bd52..f4708a05c4d 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCall.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - (x foo 1).bar(2) -} \ No newline at end of file +fun foo(x: Int) { + (x times 1).div(2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt index 4f53bb517ca..98d87e2bf7b 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x.foo(1).bar(2) -} \ No newline at end of file +fun foo(x: Int) { + x.plus(1).minus(2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt.after index de1fe05bd52..ef62e662dcc 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/doubleFunctionCallWithoutParentheses.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - (x foo 1).bar(2) -} \ No newline at end of file +fun foo(x: Int) { + (x plus 1).minus(2) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt index 4cb841b23be..7cbd2db8368 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + class Foo { fun foo(x: Int) { - println("lol") + doSomething("lol") } } fun bar(baz: Foo) { baz.foo(x = 1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt.after index cc79e8c716f..7e619b0fbe5 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/firstParameterLabeled.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + class Foo { fun foo(x: Int) { - println("lol") + doSomething("lol") } } fun bar(baz: Foo) { baz foo 1 -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt index 44cfbc29082..7401cb46229 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt @@ -1,3 +1,7 @@ fun foo(x: Foo) { x.foo { it * 2 } -} \ No newline at end of file +} + +trait Foo { + fun foo(f: (Int) -> Int) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt.after index cfb30b4d639..8870231e2a2 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/functionLiteralArgument.kt.after @@ -1,3 +1,7 @@ fun foo(x: Foo) { x foo { it * 2 } -} \ No newline at end of file +} + +trait Foo { + fun foo(f: (Int) -> Int) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/functionSafeCall.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/functionSafeCall.kt index b4e1e8bc973..1196583229e 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/functionSafeCall.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/functionSafeCall.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(x: Foo) { - x?.foo(1) -} \ No newline at end of file +fun foo(x: String?) { + x?.compareTo("1") +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/multipleArguments.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/multipleArguments.kt index 3ac351e4031..de15862ecc2 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/multipleArguments.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/multipleArguments.kt @@ -1,4 +1,8 @@ // IS_APPLICABLE: false +trait Foo { + fun foo(a: Int, b: Int) +} + fun foo(x: Foo) { x.foo(1, 2) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/namedArgument.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/namedArgument.kt index d42db6104c2..a4078442256 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/namedArgument.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/namedArgument.kt @@ -1,4 +1,8 @@ // IS_APPLICABLE: false fun foo(x: Foo) { x.foo(bar = x) -} \ No newline at end of file +} + +trait Foo { + fun foo(baz: Int = 0, bar: Foo? = null) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt index 00385018b4b..b43bd0879d1 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x!!.foo(1) -} \ No newline at end of file +fun foo(x: String?) { + x!!.plus(1) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt.after index 9cdf9e38864..fed5bdadb77 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/nullAssertedReceiver.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x!! foo 1 -} \ No newline at end of file +fun foo(x: String?) { + x!! plus 1 +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/propertyAccess.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/propertyAccess.kt index 4c5835f02df..a056d68d8a3 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/propertyAccess.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/propertyAccess.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(x: foo) { - x.foo -} \ No newline at end of file +fun foo(x: String) { + x.length +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/secondParameterLabeled.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/secondParameterLabeled.kt index f5b3108c610..33045ba3433 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/secondParameterLabeled.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/secondParameterLabeled.kt @@ -1,10 +1,9 @@ // IS_APPLICABLE: false class Foo { fun foo(x: Int = 0, y: Int = 0) { - println("lol") } } fun bar(baz: Foo) { baz.foo(y = 1) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleArgumentAndFunctionLiteralArgument.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleArgumentAndFunctionLiteralArgument.kt index 03f887129a5..d9abb78bcfa 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleArgumentAndFunctionLiteralArgument.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleArgumentAndFunctionLiteralArgument.kt @@ -1,4 +1,8 @@ // IS_APPLICABLE: false fun foo(x: Foo) { x.foo(1) { it * 2 } -} \ No newline at end of file +} + +trait Foo { + fun foo(a: Int, f: (Int) -> Int) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt index ba565ab4fb0..fc6e49485d5 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x.foo(1) -} \ No newline at end of file +fun foo(x: Int) { + x.times(1) +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt.after b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt.after index dedbef8172f..c61e6841f3f 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt.after +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/simpleMethodCall.kt.after @@ -1,3 +1,3 @@ -fun foo(x: Foo) { - x foo 1 -} \ No newline at end of file +fun foo(x: Int) { + x times 1 +} diff --git a/idea/testData/intentions/replaceWithInfixFunctionCall/zeroArguments.kt b/idea/testData/intentions/replaceWithInfixFunctionCall/zeroArguments.kt index f0a2356242e..91a1955a6ce 100644 --- a/idea/testData/intentions/replaceWithInfixFunctionCall/zeroArguments.kt +++ b/idea/testData/intentions/replaceWithInfixFunctionCall/zeroArguments.kt @@ -1,4 +1,4 @@ // IS_APPLICABLE: false -fun foo(x: Foo) { - x.foo() -} \ No newline at end of file +fun foo(x: Int) { + x.toString() +} diff --git a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt index d2011413bb7..f6787ee667a 100644 --- a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt +++ b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt @@ -1,5 +1,9 @@ // INTENTION_TEXT: Simplify negated 'in' expression to '!in' +class A(val e: Int) { + fun contains(i: Int): Boolean = e == i +} + fun test(n: Int) { - val arr = ArrayList(1) - !(0 in arr) -} \ No newline at end of file + val a = A(1) + !(0 in a) +} diff --git a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt.after b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt.after index 69a092757e1..0416942d8cc 100644 --- a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt.after +++ b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/in.kt.after @@ -1,5 +1,9 @@ // INTENTION_TEXT: Simplify negated 'in' expression to '!in' +class A(val e: Int) { + fun contains(i: Int): Boolean = e == i +} + fun test(n: Int) { - val arr = ArrayList(1) - 0 !in arr -} \ No newline at end of file + val a = A(1) + 0 !in a +} diff --git a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/inapplicableBinaryOperation.kt b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/inapplicableBinaryOperation.kt index cdd82422591..69124a34777 100644 --- a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/inapplicableBinaryOperation.kt +++ b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/inapplicableBinaryOperation.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun lt(a: Int, b: Int): Boolean = a < b +fun Int.lt(b: Int): Boolean = this < b fun test(n: Int) { !(1 lt 2) -} \ No newline at end of file +} diff --git a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt index 36806908ed7..cdc5586efba 100644 --- a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt +++ b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt @@ -1,5 +1,9 @@ // INTENTION_TEXT: Simplify negated '!in' expression to 'in' +class A(val e: Int) { + fun contains(i: Int): Boolean = e == i +} + fun test(n: Int) { - val arr = ArrayList(1) - !(0 !in arr) -} \ No newline at end of file + val a = A(1) + !(0 !in a) +} diff --git a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt.after b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt.after index 37f4a0a679b..60141878621 100644 --- a/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt.after +++ b/idea/testData/intentions/simplifyNegatedBinaryExpressionIntention/notIn.kt.after @@ -1,5 +1,9 @@ // INTENTION_TEXT: Simplify negated '!in' expression to 'in' +class A(val e: Int) { + fun contains(i: Int): Boolean = e == i +} + fun test(n: Int) { - val arr = ArrayList(1) - 0 in arr -} \ No newline at end of file + val a = A(1) + 0 in a +} diff --git a/idea/testData/intentions/splitIf/splitIfAndOr.kt b/idea/testData/intentions/splitIf/splitIfAndOr.kt index 3687f241674..acdcc69e467 100644 --- a/idea/testData/intentions/splitIf/splitIfAndOr.kt +++ b/idea/testData/intentions/splitIf/splitIfAndOr.kt @@ -1,9 +1,11 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a && b || c) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfNotIf.kt b/idea/testData/intentions/splitIf/splitIfNotIf.kt index dedb80d7622..c8a6aef5954 100644 --- a/idea/testData/intentions/splitIf/splitIfNotIf.kt +++ b/idea/testData/intentions/splitIf/splitIfNotIf.kt @@ -1,8 +1,10 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { val a = true val b = false when (a && b) { - println("test") + else -> doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfOneAND.kt b/idea/testData/intentions/splitIf/splitIfOneAND.kt index d0587605453..dab4ce249c9 100644 --- a/idea/testData/intentions/splitIf/splitIfOneAND.kt +++ b/idea/testData/intentions/splitIf/splitIfOneAND.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a && b) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfOneAND.kt.after b/idea/testData/intentions/splitIf/splitIfOneAND.kt.after index 6704f257fc6..45131d41cf6 100644 --- a/idea/testData/intentions/splitIf/splitIfOneAND.kt.after +++ b/idea/testData/intentions/splitIf/splitIfOneAND.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a) { if (b) { - println("test") + doSomething("test") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfOperatorAsFunctionParam.kt b/idea/testData/intentions/splitIf/splitIfOperatorAsFunctionParam.kt index 1ed0bad61b6..8d56c463f7a 100644 --- a/idea/testData/intentions/splitIf/splitIfOperatorAsFunctionParam.kt +++ b/idea/testData/intentions/splitIf/splitIfOperatorAsFunctionParam.kt @@ -1,9 +1,11 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { val a = true val b = false - fun test(a: Boolean, b: Boolean): Boolean { return false } + fun test(a: Boolean): Boolean { return false } if (test(a && b)) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfOrAnd.kt b/idea/testData/intentions/splitIf/splitIfOrAnd.kt index 15ffc159d80..65860b46f9a 100644 --- a/idea/testData/intentions/splitIf/splitIfOrAnd.kt +++ b/idea/testData/intentions/splitIf/splitIfOrAnd.kt @@ -1,8 +1,10 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a || b && c) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfOrAnd.kt.after b/idea/testData/intentions/splitIf/splitIfOrAnd.kt.after index 2a84f6a17b2..1dffa0d23a7 100644 --- a/idea/testData/intentions/splitIf/splitIfOrAnd.kt.after +++ b/idea/testData/intentions/splitIf/splitIfOrAnd.kt.after @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a) { - println("test") + doSomething("test") } else if (b && c) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt b/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt index 30947780810..08250fc0f11 100644 --- a/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt +++ b/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt @@ -1,8 +1,10 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a && b && c) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt.after b/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt.after index 55bbe15f182..7dd2477a21b 100644 --- a/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt.after +++ b/idea/testData/intentions/splitIf/splitIfTwoOperatorsFirst.kt.after @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a) { if (b && c) { - println("test") + doSomething("test") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt b/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt index 36e8991d8c9..95c87ea75c4 100644 --- a/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt +++ b/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt @@ -1,8 +1,10 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a && b && c) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt.after b/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt.after index 2a456cc8cf6..89d63a30f0c 100644 --- a/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt.after +++ b/idea/testData/intentions/splitIf/splitIfTwoOperatorsSecond.kt.after @@ -1,10 +1,12 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false val c = true if (a && b) { if (c) { - println("test") + doSomething("test") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithElse.kt b/idea/testData/intentions/splitIf/splitIfWithElse.kt index ad69755d06a..0e47c4c0180 100644 --- a/idea/testData/intentions/splitIf/splitIfWithElse.kt +++ b/idea/testData/intentions/splitIf/splitIfWithElse.kt @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a && b) { - println("test") + doSomething("test") } else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithElse.kt.after b/idea/testData/intentions/splitIf/splitIfWithElse.kt.after index 32e007e1bbf..77d455c651f 100644 --- a/idea/testData/intentions/splitIf/splitIfWithElse.kt.after +++ b/idea/testData/intentions/splitIf/splitIfWithElse.kt.after @@ -1,13 +1,15 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a) { if (b) { - println("test") + doSomething("test") } else { - println("test2") + doSomething("test2") } } else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithFunction.kt b/idea/testData/intentions/splitIf/splitIfWithFunction.kt index ce5f4a4aff8..dde44982d65 100644 --- a/idea/testData/intentions/splitIf/splitIfWithFunction.kt +++ b/idea/testData/intentions/splitIf/splitIfWithFunction.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun foo() { fun test(): Boolean { return false } val a = true if (test() && a) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithFunction.kt.after b/idea/testData/intentions/splitIf/splitIfWithFunction.kt.after index 375e7c19d25..8c178396aea 100644 --- a/idea/testData/intentions/splitIf/splitIfWithFunction.kt.after +++ b/idea/testData/intentions/splitIf/splitIfWithFunction.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { fun test(): Boolean { return false } val a = true if (test()) { if (a) { - println("test") + doSomething("test") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithNotOperator.kt b/idea/testData/intentions/splitIf/splitIfWithNotOperator.kt index df9f6e96dd1..f0d833be6d9 100644 --- a/idea/testData/intentions/splitIf/splitIfWithNotOperator.kt +++ b/idea/testData/intentions/splitIf/splitIfWithNotOperator.kt @@ -1,8 +1,10 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (!(a && b)) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt b/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt index 8c08dc4b79e..732f5ed667a 100644 --- a/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt +++ b/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a && !b) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt.after b/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt.after index 61de17d4a0b..03b3bd93052 100644 --- a/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt.after +++ b/idea/testData/intentions/splitIf/splitIfWithNotOperatorGood.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a) { if (!b) { - println("test") + doSomething("test") } } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithOR.kt b/idea/testData/intentions/splitIf/splitIfWithOR.kt index 1810d2b907c..e5254cceebf 100644 --- a/idea/testData/intentions/splitIf/splitIfWithOR.kt +++ b/idea/testData/intentions/splitIf/splitIfWithOR.kt @@ -1,7 +1,9 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a || b) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithOR.kt.after b/idea/testData/intentions/splitIf/splitIfWithOR.kt.after index 4bd7bc01931..1714ad7a482 100644 --- a/idea/testData/intentions/splitIf/splitIfWithOR.kt.after +++ b/idea/testData/intentions/splitIf/splitIfWithOR.kt.after @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a) { - println("test") + doSomething("test") } else if (b) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithORElse.kt b/idea/testData/intentions/splitIf/splitIfWithORElse.kt index e7055a9e3b0..791f5a1e075 100644 --- a/idea/testData/intentions/splitIf/splitIfWithORElse.kt +++ b/idea/testData/intentions/splitIf/splitIfWithORElse.kt @@ -1,9 +1,11 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a || b) { - println("test") + doSomething("test") } else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWithORElse.kt.after b/idea/testData/intentions/splitIf/splitIfWithORElse.kt.after index b2c72ce67ce..013622f68a9 100644 --- a/idea/testData/intentions/splitIf/splitIfWithORElse.kt.after +++ b/idea/testData/intentions/splitIf/splitIfWithORElse.kt.after @@ -1,11 +1,13 @@ +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a) { - println("test") + doSomething("test") } else if (b) { - println("test") + doSomething("test") } else { - println("test2") + doSomething("test2") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/splitIf/splitIfWrongCaretLocation.kt b/idea/testData/intentions/splitIf/splitIfWrongCaretLocation.kt index 5f962362e23..fa8bda2a447 100644 --- a/idea/testData/intentions/splitIf/splitIfWrongCaretLocation.kt +++ b/idea/testData/intentions/splitIf/splitIfWrongCaretLocation.kt @@ -1,8 +1,10 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun foo() { val a = true val b = false if (a && b) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/conjunction.kt b/idea/testData/intentions/swapBinaryExpression/conjunction.kt index cb896742a64..bce88ecd38b 100644 --- a/idea/testData/intentions/swapBinaryExpression/conjunction.kt +++ b/idea/testData/intentions/swapBinaryExpression/conjunction.kt @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (a && b) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/conjunction.kt.after b/idea/testData/intentions/swapBinaryExpression/conjunction.kt.after index 6ae31548aae..9aa24d82522 100644 --- a/idea/testData/intentions/swapBinaryExpression/conjunction.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/conjunction.kt.after @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (b && a) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt b/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt index 283e10c4edc..acb6277d570 100644 --- a/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt +++ b/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (a and b) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt.after b/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt.after index 19646609f4a..6cfc124a7c8 100644 --- a/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/conjunctionLiteral.kt.after @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (b and a) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/disjunction.kt b/idea/testData/intentions/swapBinaryExpression/disjunction.kt index 1ccfce8fa35..e7b9156c972 100644 --- a/idea/testData/intentions/swapBinaryExpression/disjunction.kt +++ b/idea/testData/intentions/swapBinaryExpression/disjunction.kt @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (a || b) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/disjunction.kt.after b/idea/testData/intentions/swapBinaryExpression/disjunction.kt.after index 072df5b287e..070a7286f04 100644 --- a/idea/testData/intentions/swapBinaryExpression/disjunction.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/disjunction.kt.after @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (b || a) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt b/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt index ecca5d4b229..e936fbc1cea 100644 --- a/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt +++ b/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (a or b) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt.after b/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt.after index 655cb872c91..14be351139c 100644 --- a/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/disjunctionLiteral.kt.after @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (b or a) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/in.kt b/idea/testData/intentions/swapBinaryExpression/in.kt index cf9e6ed4c02..9cc11021d8b 100644 --- a/idea/testData/intentions/swapBinaryExpression/in.kt +++ b/idea/testData/intentions/swapBinaryExpression/in.kt @@ -1,6 +1,8 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main() { - for (elt in array(1, 2, 3)) { - println("Hello") + for (elt in 0..3) { + doSomething("Hello") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/is.kt b/idea/testData/intentions/swapBinaryExpression/is.kt index 8f230f64bef..40ffa670a91 100644 --- a/idea/testData/intentions/swapBinaryExpression/is.kt +++ b/idea/testData/intentions/swapBinaryExpression/is.kt @@ -1,6 +1,9 @@ // IS_APPLICABLE: false + +fun doSomething(a: T) {} + fun main() { if "test" is String { - println("Hello") + doSomething("Hello") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt b/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt index 1c2e72e2d40..dc0cbe5d7ce 100644 --- a/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt +++ b/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int, c: Int, d: Int, e: Int): Int { return a + b + c + d + e -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt.after b/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt.after index 6043804d2fe..f730ca8781d 100644 --- a/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/multipleOperands.kt.after @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int, c: Int, d: Int, e: Int): Int { return a + c + b + d + e -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/nonBinaryExpr.kt b/idea/testData/intentions/swapBinaryExpression/nonBinaryExpr.kt index 7b05d4881f8..55a8f7e86d5 100644 --- a/idea/testData/intentions/swapBinaryExpression/nonBinaryExpr.kt +++ b/idea/testData/intentions/swapBinaryExpression/nonBinaryExpr.kt @@ -1,5 +1,7 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main() { val c = 500 - println("Today is Friday") -} \ No newline at end of file + doSomething("Today is Friday") +} diff --git a/idea/testData/intentions/swapBinaryExpression/notEquals.kt b/idea/testData/intentions/swapBinaryExpression/notEquals.kt index 758d8fcb573..737f8705aa1 100644 --- a/idea/testData/intentions/swapBinaryExpression/notEquals.kt +++ b/idea/testData/intentions/swapBinaryExpression/notEquals.kt @@ -2,4 +2,5 @@ fun main(): Boolean { if (5 != 20) { return false } -} \ No newline at end of file + return true +} diff --git a/idea/testData/intentions/swapBinaryExpression/notEquals.kt.after b/idea/testData/intentions/swapBinaryExpression/notEquals.kt.after index 4780f3f5a8d..4fe8b71efb9 100644 --- a/idea/testData/intentions/swapBinaryExpression/notEquals.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/notEquals.kt.after @@ -2,4 +2,5 @@ fun main(): Boolean { if (20 != 5) { return false } -} \ No newline at end of file + return true +} diff --git a/idea/testData/intentions/swapBinaryExpression/notIn.kt b/idea/testData/intentions/swapBinaryExpression/notIn.kt index 4f758d78850..c151152da0c 100644 --- a/idea/testData/intentions/swapBinaryExpression/notIn.kt +++ b/idea/testData/intentions/swapBinaryExpression/notIn.kt @@ -1,6 +1,8 @@ // IS_APPLICABLE: false -fun main() { +fun doSomething(a: T) {} + +fun main(x: Int) { if (x !in 5..6) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/notIs.kt b/idea/testData/intentions/swapBinaryExpression/notIs.kt index 4201d9a3155..a90e09efb92 100644 --- a/idea/testData/intentions/swapBinaryExpression/notIs.kt +++ b/idea/testData/intentions/swapBinaryExpression/notIs.kt @@ -1,6 +1,8 @@ // IS_APPLICABLE: false -fun main() { +fun doSomething(a: T) {} + +fun main(x: Int) { if (x !is Int) { - println("test") + doSomething("test") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/nullOperand.kt b/idea/testData/intentions/swapBinaryExpression/nullOperand.kt index c1d5d1383b9..d253e8de16e 100644 --- a/idea/testData/intentions/swapBinaryExpression/nullOperand.kt +++ b/idea/testData/intentions/swapBinaryExpression/nullOperand.kt @@ -1,4 +1,5 @@ // IS_APPLICABLE: false +// DISABLE-ERRORS fun new(x: Int, y: Int): Int { return y - -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plus.kt b/idea/testData/intentions/swapBinaryExpression/plus.kt index f42ce3f0db3..d94845d2ba7 100644 --- a/idea/testData/intentions/swapBinaryExpression/plus.kt +++ b/idea/testData/intentions/swapBinaryExpression/plus.kt @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return a + b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plus.kt.after b/idea/testData/intentions/swapBinaryExpression/plus.kt.after index 01684c97401..74026f76458 100644 --- a/idea/testData/intentions/swapBinaryExpression/plus.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/plus.kt.after @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return b + a -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plusInt.kt b/idea/testData/intentions/swapBinaryExpression/plusInt.kt index f42ce3f0db3..d94845d2ba7 100644 --- a/idea/testData/intentions/swapBinaryExpression/plusInt.kt +++ b/idea/testData/intentions/swapBinaryExpression/plusInt.kt @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return a + b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plusInt.kt.after b/idea/testData/intentions/swapBinaryExpression/plusInt.kt.after index 01684c97401..74026f76458 100644 --- a/idea/testData/intentions/swapBinaryExpression/plusInt.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/plusInt.kt.after @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return b + a -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt b/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt index b58ef6ef374..db5bfd41ef3 100644 --- a/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt +++ b/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return a plus b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt.after b/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt.after index b58681725a9..bcd1af9c7ca 100644 --- a/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/plusLiteral.kt.after @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return b plus a -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/rangeTo.kt b/idea/testData/intentions/swapBinaryExpression/rangeTo.kt index 73f46d81856..93713174fb8 100644 --- a/idea/testData/intentions/swapBinaryExpression/rangeTo.kt +++ b/idea/testData/intentions/swapBinaryExpression/rangeTo.kt @@ -1,6 +1,8 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main() { for (i in 1..10) { - println("Hello World") + doSomething("Hello World") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/rangeToLiteral.kt b/idea/testData/intentions/swapBinaryExpression/rangeToLiteral.kt index f8351ffaa26..acd4506490a 100644 --- a/idea/testData/intentions/swapBinaryExpression/rangeToLiteral.kt +++ b/idea/testData/intentions/swapBinaryExpression/rangeToLiteral.kt @@ -1,6 +1,8 @@ // IS_APPLICABLE: false +fun doSomething(a: T) {} + fun main() { for (i in 1 rangeTo 10) { - println("Hello World") + doSomething("Hello World") } -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt b/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt index 9f3b64844c8..b39f3b457a5 100644 --- a/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt +++ b/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return a times b -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt.after b/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt.after index d9a431a95b8..90346fd8192 100644 --- a/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/timesLiteral.kt.after @@ -1,3 +1,3 @@ -fun main() { +fun test(a: Int, b: Int): Int { return b times a -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/xor.kt b/idea/testData/intentions/swapBinaryExpression/xor.kt index 54adb0ec71b..4ed13955a0c 100644 --- a/idea/testData/intentions/swapBinaryExpression/xor.kt +++ b/idea/testData/intentions/swapBinaryExpression/xor.kt @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (a xor b) {} -} \ No newline at end of file +} diff --git a/idea/testData/intentions/swapBinaryExpression/xor.kt.after b/idea/testData/intentions/swapBinaryExpression/xor.kt.after index 4a03d91b0d2..2230ad97532 100644 --- a/idea/testData/intentions/swapBinaryExpression/xor.kt.after +++ b/idea/testData/intentions/swapBinaryExpression/xor.kt.after @@ -1,3 +1,3 @@ -fun neq(a: Int, b: Int) { +fun neq(a: Boolean, b: Boolean) { if (b xor a) {} -} \ No newline at end of file +}