Add "Convert to notNull delegate" quick fix for INAPPLICABLE_LATEINIT_MODIFIER

#KT-12515 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-06-18 11:52:51 +09:00
committed by Dmitry Gridin
parent b3b7e26985
commit e3c9134904
13 changed files with 163 additions and 0 deletions
@@ -0,0 +1,3 @@
// "Convert to notNull delegate" "true"
// WITH_RUNTIME
<caret>lateinit var x: Boolean
@@ -0,0 +1,5 @@
import kotlin.properties.Delegates
// "Convert to notNull delegate" "true"
// WITH_RUNTIME
var x by Delegates.notNull<Boolean>()
@@ -0,0 +1,3 @@
// "Convert to notNull delegate" "true"
// WITH_RUNTIME
<caret>lateinit var x: Int
@@ -0,0 +1,5 @@
import kotlin.properties.Delegates
// "Convert to notNull delegate" "true"
// WITH_RUNTIME
var x by Delegates.notNull<Int>()
@@ -0,0 +1,8 @@
// "Convert to notNull delegate" "false"
// DISABLE-ERRORS
// ACTION: Make internal
// ACTION: Make private
// ACTION: Remove 'lateinit' modifier
// ACTION: Remove explicit type specification
// ACTION: Remove initializer from property
<caret>lateinit var x: Boolean = true
@@ -0,0 +1,7 @@
// "Convert to notNull delegate" "false"
// DISABLE-ERRORS
// ACTION: Convert to nullable var
// ACTION: Make internal
// ACTION: Make private
// ACTION: Specify type explicitly
<caret>lateinit var x
@@ -0,0 +1,5 @@
// "Convert to notNull delegate" "false"
// ACTION: Convert to nullable var
// ACTION: Make internal
// ACTION: Make private
<caret>lateinit var x: String
@@ -0,0 +1,7 @@
// "Convert to notNull delegate" "false"
// DISABLE-ERRORS
// ACTION: Make internal
// ACTION: Make not-nullable
// ACTION: Make private
// ACTION: Remove 'lateinit' modifier
<caret>lateinit var x: Boolean?
@@ -0,0 +1,7 @@
// "Convert to notNull delegate" "false"
// DISABLE-ERRORS
// ACTION: Change to var
// ACTION: Make internal
// ACTION: Make private
// ACTION: Remove 'lateinit' modifier
<caret>lateinit val x: Boolean