Disallow extension properties with backing fields

#KT-1682 Fixed
This commit is contained in:
Alexander Udalov
2014-05-28 19:17:31 +04:00
parent ea31f372aa
commit d78d4bc44c
72 changed files with 297 additions and 578 deletions
@@ -2,7 +2,7 @@
package outer
fun Int?.optint() : Unit {}
val Int?.optval : Unit = Unit.VALUE
val Int?.optval : Unit get() = Unit.VALUE
fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
y.plus(1)
@@ -1,4 +1,3 @@
//KT-819 Redeclaration error for extension properties with the same name and different receivers
import java.io.*
@@ -15,16 +14,20 @@ open class A() {
open fun String.foo() {}
open fun Int.foo() {}
open val String.foo = 0
open val Int.foo = 1
open val String.foo: Int
get() = 0
open val Int.foo: Int
get() = 1
}
class B() : A() {
override fun String.foo() {}
override fun Int.foo() {}
override val String.foo = 0
override val Int.foo = 0
override val String.foo: Int
get() = 0
override val Int.foo: Int
get() = 0
fun use(s: String) {
s.foo
@@ -1,6 +1,6 @@
object O
fun Any.foo() = 42
val Any?.bar = 239
val Any?.bar: Int get() = 239
val x = O.foo() + O.bar