KT-12152 : constructor consistency: distinguish properties with and w/o backing fields, with default / custom accessors
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
class My {
|
||||
var x = 1
|
||||
set(value) {
|
||||
field = value
|
||||
}
|
||||
|
||||
var y: Int = 1
|
||||
set(value) {
|
||||
field = value + if (w == "") 0 else 1
|
||||
}
|
||||
|
||||
var z: Int = 2
|
||||
set(value) {
|
||||
field = value + if (w == "") 1 else 0
|
||||
}
|
||||
|
||||
init {
|
||||
// Writing properties using setters is dangerous
|
||||
<!DEBUG_INFO_LEAKING_THIS!>y<!> = 4
|
||||
this.<!DEBUG_INFO_LEAKING_THIS!>z<!> = 5
|
||||
}
|
||||
|
||||
val w = "6"
|
||||
}
|
||||
Reference in New Issue
Block a user