Overriden setter now cannot weaken visibility #KT-3369 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-11-13 18:33:58 +03:00
parent 02fb19c3ea
commit 86c37deaee
4 changed files with 69 additions and 0 deletions
@@ -0,0 +1,29 @@
public interface ITest {
public var prop : Int
get() = 12
set(value) {}
}
abstract class ATest {
protected open var prop2 : Int
get() = 13
set(value) {}
}
class Test: ATest(), ITest {
override var prop : Int
get() = 12
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>private<!> set(value) {}
override var prop2 : Int
get() = 14
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>internal<!> set(value) {}
}
fun main(args: Array<String>) {
val test = Test()
<!INVISIBLE_SETTER!>test.prop<!> = 12
val itest: ITest = test
itest.prop = 12 // No error here
}