Minor: move local lateinit tests to lateinit/local
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
// !LANGUAGE: +LateinitLocalVariables
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) : String = ""
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
|
||||
fun test() {
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> val test0: Any
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var test1: Int
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var test2: Any?
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var test3: String = ""
|
||||
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var test4 by Delegate
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public object Delegate {
|
||||
private constructor Delegate()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ instance: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun setValue(/*0*/ instance: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>, /*2*/ value: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !LANGUAGE: +LateinitLocalVariables
|
||||
|
||||
fun test() {
|
||||
lateinit var s: String
|
||||
s = ""
|
||||
s.length
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +LateinitLocalVariables
|
||||
|
||||
fun test1() {
|
||||
lateinit var s: String
|
||||
s.length
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
lateinit var s: String
|
||||
run {
|
||||
s = ""
|
||||
}
|
||||
s.length
|
||||
}
|
||||
|
||||
fun almostAlwaysTrue(): Boolean = true
|
||||
|
||||
fun test3() {
|
||||
lateinit var s: String
|
||||
if (almostAlwaysTrue()) {
|
||||
s = ""
|
||||
}
|
||||
s.length
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun almostAlwaysTrue(): kotlin.Boolean
|
||||
public fun test1(): kotlin.Unit
|
||||
public fun test2(): kotlin.Unit
|
||||
public fun test3(): kotlin.Unit
|
||||
Reference in New Issue
Block a user