Forbid lateinit variables of inline class types

Proper support of lateinit inline class values will be added later,
 see #KT-23814

 #KT-25603 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-07-20 01:29:14 +03:00
parent 045058c29a
commit 17243c08c1
8 changed files with 59 additions and 0 deletions
@@ -0,0 +1,10 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_VARIABLE
inline class Foo(val x: Int)
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var a: Foo
fun foo() {
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var b: Foo
}
@@ -0,0 +1,12 @@
package
public lateinit var a: Foo
public fun foo(): kotlin.Unit
public final inline class Foo {
public constructor Foo(/*0*/ x: kotlin.Int)
public final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var a: UInt
fun foo() {
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var b: UByte
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var c: UShort
<!INAPPLICABLE_LATEINIT_MODIFIER!>lateinit<!> var d: ULong
}
@@ -0,0 +1,4 @@
package
public lateinit var a: kotlin.UInt
public fun foo(): kotlin.Unit