KT-7715 Highlight var's that can be replaced by val's
#KT-7715 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.CanBeValInspection
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Make variable immutable" "true"
|
||||
fun foo(p: Int) {
|
||||
<caret>var (v1, v2) = getPair()!!
|
||||
v1
|
||||
}
|
||||
|
||||
fun getPair(): Pair<Int, String>? = null
|
||||
|
||||
data class Pair<T1, T2>(val a: T1, val b: T2)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Make variable immutable" "true"
|
||||
fun foo(p: Int) {
|
||||
<caret>val (v1, v2) = getPair()!!
|
||||
v1
|
||||
}
|
||||
|
||||
fun getPair(): Pair<Int, String>? = null
|
||||
|
||||
data class Pair<T1, T2>(val a: T1, val b: T2)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Make variable immutable" "true"
|
||||
fun foo(p: Int) {
|
||||
<caret>var v: Int
|
||||
if (p > 0) v = 1 else v = 2
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Make variable immutable" "true"
|
||||
fun foo(p: Int) {
|
||||
<caret>val v: Int
|
||||
if (p > 0) v = 1 else v = 2
|
||||
}
|
||||
Reference in New Issue
Block a user