fix KT-9553 Invalid const initializers must be compile-time errors
#KT-9553 Fixed
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS:-UNUSED_VARIABLE
|
||||
// !DIAGNOSTICS:-UNUSED_VARIABLE,-CAST_NEVER_SUCCEEDS
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@@ -67,7 +67,11 @@ class Outer {
|
||||
const val defaultGetter = 19
|
||||
<!CONST_VAL_WITH_GETTER!>get<!>
|
||||
|
||||
const val nonConstInitializer = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>foo()<!>
|
||||
const val nonConstInitializer1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>foo()<!>
|
||||
const val nonConstInitializer2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 as String<!>
|
||||
const val nonConstInitializer3 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.0 as String<!>
|
||||
const val nonConstInitializer4 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 as Double<!>
|
||||
const val nonConstInitializer5 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"2" as Int<!>
|
||||
|
||||
// ------------------
|
||||
class Delegate {
|
||||
|
||||
@@ -2,7 +2,11 @@ package
|
||||
|
||||
public const val defaultGetter: kotlin.Int = 19
|
||||
public const val delegated: kotlin.Int
|
||||
public const val nonConstInitializer: kotlin.Int
|
||||
public const val nonConstInitializer1: kotlin.Int
|
||||
public const val nonConstInitializer2: kotlin.String
|
||||
public const val nonConstInitializer3: kotlin.String
|
||||
public const val nonConstInitializer4: kotlin.Double
|
||||
public const val nonConstInitializer5: kotlin.Int
|
||||
private val privateTopLevel: kotlin.Int = 3
|
||||
public const var topLeveLVar: kotlin.Int
|
||||
public const val topLevel: kotlin.Int = 0
|
||||
|
||||
Reference in New Issue
Block a user