Disallow extension properties with backing fields
#KT-1682 Fixed
This commit is contained in:
@@ -24,7 +24,8 @@ fun test(a: A) {
|
||||
//variable as extension
|
||||
trait B {
|
||||
}
|
||||
val B.foo = Foo()
|
||||
val B.foo: Foo
|
||||
get() = Foo()
|
||||
|
||||
fun test(b: B) {
|
||||
b.foo()
|
||||
|
||||
@@ -22,7 +22,8 @@ fun test(a: A) {
|
||||
|
||||
//variable as extension
|
||||
trait B {}
|
||||
val B.foo = Foo()
|
||||
val B.foo: Foo
|
||||
get() = Foo()
|
||||
|
||||
|
||||
fun test(b: B) {
|
||||
|
||||
@@ -40,7 +40,8 @@ fun test(c: C, b: B) {
|
||||
//variable as extension,
|
||||
trait D {
|
||||
}
|
||||
val D.foo = Foo()
|
||||
val D.foo: Foo
|
||||
get() = Foo()
|
||||
|
||||
class E {
|
||||
fun Foo.invoke() {}
|
||||
|
||||
@@ -10,10 +10,12 @@ class B {
|
||||
}
|
||||
|
||||
open class C
|
||||
val C.attr = A()
|
||||
val C.attr: A
|
||||
get() = A()
|
||||
|
||||
open class D: C()
|
||||
val D.attr = B()
|
||||
val D.attr: B
|
||||
get() = B()
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
Reference in New Issue
Block a user