Disallow extension properties with backing fields
#KT-1682 Fixed
This commit is contained in:
@@ -2,7 +2,7 @@ package As
|
||||
|
||||
val staticProperty : String = "1"
|
||||
|
||||
val String.staticExt = "1"
|
||||
val String.staticExt: String get() = "1"
|
||||
|
||||
open class A(val init: String) {
|
||||
|
||||
@@ -10,7 +10,7 @@ open class A(val init: String) {
|
||||
|
||||
private val privateProperty : String = init
|
||||
|
||||
val String.ext = "1"
|
||||
val String.ext: String get() = "1"
|
||||
|
||||
val Int.myInc : Int
|
||||
get() = this + 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
val Int.ext : () -> Int = { 5 }
|
||||
val Long.ext : Long = 4.ext().toLong() //(c.kt:4)
|
||||
val y : Long = 10.toLong().ext
|
||||
val Int.ext: () -> Int get() = { 5 }
|
||||
val Long.ext: Long get() = 4.ext().toLong() //(c.kt:4)
|
||||
val y: Long get() = 10L.ext
|
||||
|
||||
fun box() : String = if (y == 5.toLong()) "OK" else "fail"
|
||||
fun box(): String = if (y == 5L) "OK" else "fail: $y"
|
||||
|
||||
Reference in New Issue
Block a user