Add intentions to convert lazy <--> ordinary property

#KT-23501 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-04-17 10:02:02 +03:00
committed by Mikhail Glukhikh
parent a2205cfc98
commit fbd992f8c7
55 changed files with 280 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertLazyPropertyToOrdinaryIntention
@@ -0,0 +1,5 @@
// WITH_RUNTIME
<caret>val x by lazy {
// comment
1
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
val x = run {
// comment
1
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
<caret>val x by lazy {
foo()
1
}
fun foo() {}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
val x = run {
foo()
1
}
fun foo() {}
@@ -0,0 +1,3 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
<caret>val x by lazy { }
@@ -0,0 +1,2 @@
// WITH_RUNTIME
<caret>val x: Int by lazy { 1 }
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val x: Int = 1
@@ -0,0 +1,4 @@
// WITH_RUNTIME
val x by lazy {
1
}<caret>
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val x = 1
@@ -0,0 +1,3 @@
// DISABLE-ERRORS
// WITH_RUNTIME
<caret>var x: Int by lazy { 1 }
@@ -0,0 +1,3 @@
// DISABLE-ERRORS
// WITH_RUNTIME
var x: Int = 1
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertOrdinaryPropertyToLazyIntention
@@ -0,0 +1,2 @@
// WITH_RUNTIME
<caret>val x: Int = 1
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val x: Int by lazy { 1 }
@@ -0,0 +1,4 @@
// IS_APPLICABLE: false
class Foo {
lateinit <caret>var x: String
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
val x = run {
foo()
3
}<caret>
fun foo() {}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
val x by lazy {
foo()
3
}
fun foo() {}
@@ -0,0 +1,2 @@
// IS_APPLICABLE: false
<caret>var x: Int = 1