Convert "lift return / assignment" intentions into a single inspection

Also includes minor test fix, related to KT-14900
This commit is contained in:
Mikhail Glukhikh
2017-06-27 13:01:33 +03:00
committed by Mikhail Glukhikh
parent 8f33bd0768
commit 2d1abda9a1
91 changed files with 373 additions and 480 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.LiftReturnOrAssignmentInspection
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun test(n: Int) {
var a: String = ""
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun test(n: Int) {
val a: String
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun test(s: String): Int {
var n: Int = 1;
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun test(n: Int): String {
var res: String = ""
var res2: String = ""
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.LiftReturnOrAssignmentInspection
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun test(n: Int): String {
<caret>if (n == 1)
@@ -1,5 +1,3 @@
// IS_APPLICABLE: false
fun test(n: Int): String {
val a: String
<caret>if (n == 1)
@@ -0,0 +1,10 @@
fun test(n: Int): String {
val a: String
a = if (n == 1)
return "one"
else if (n == 2)
return "two"
else
"three"
return a
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.LiftReturnOrAssignmentInspection
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
fun <T> doSomething(a: T) {}
fun test(n: Int): String {
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.LiftReturnOrAssignmentInspection
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToAssignmentIntention
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnIntention
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldWhenToAssignmentIntention
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldWhenToReturnIntention