Add test for generic setValue called via synthetic accessor

Synthetic accessor for 'setValue' was generated incorrectly,
specific case of KT-20491 (Incorrect synthetic accessor generated for a
generic base class function specialized with primitive type).

Make sure there's no equivalent of KT-20387 for delegated properties.
This commit is contained in:
Dmitry Petrov
2017-09-28 11:40:17 +03:00
parent f4f1ea91d9
commit 3158700500
5 changed files with 49 additions and 0 deletions
@@ -0,0 +1,25 @@
// FILE: Var.kt
package pvar
open class PVar<T>(private var value: T) {
protected operator fun getValue(thisRef: Any?, prop: Any?) = value
protected operator fun setValue(thisRef: Any?, prop: Any?, newValue: T) {
value = newValue
}
}
// FILE: test.kt
import pvar.*
class C : PVar<Long>(42L) {
inner class Inner {
var x by this@C
}
}
fun box(): String {
val inner = C().Inner()
inner.x = 1L
return "OK"
}