Fix test data OverridenSetterVisibility.kt

This commit is contained in:
Ivan Kochurkin
2021-08-02 20:38:25 +03:00
parent bbd21da835
commit a7e81d5154
2 changed files with 30 additions and 2 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, SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>internal<!> set(value) {}
}
fun main() {
val test = Test()
test.prop = 12
val itest: ITest = test
itest.prop = 12 // No error here
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
public interface ITest {
public var prop : Int
get() = 12
@@ -23,7 +22,7 @@ class Test: ATest(), ITest {
fun main() {
val test = Test()
test.prop = 12
<!INVISIBLE_SETTER!>test.prop<!> = 12
val itest: ITest = test
itest.prop = 12 // No error here