Delegated properties never require backing field #KT-10107 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-12-11 16:03:15 +03:00
parent 9d753f24b7
commit fdc9e9d7f5
4 changed files with 31 additions and 0 deletions
@@ -0,0 +1,12 @@
// See KT-10107: 'Variable must be initialized' for delegate with private set
class My {
var delegate: String by kotlin.properties.Delegates.notNull()
private set
// Error: Variable 'delegate' must be initialized
val another: String = delegate
var delegateWithBackingField: String by kotlin.properties.Delegates.notNull()
<!ACCESSOR_FOR_DELEGATED_PROPERTY!>private set(arg) { field = arg }<!>
}