Overriden setter now cannot weaken visibility #KT-3369 Fixed
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||
|
||||
public abstract class ATest {
|
||||
public constructor ATest()
|
||||
protected open var prop2: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ITest {
|
||||
public open var prop: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Test : ATest, ITest {
|
||||
public constructor Test()
|
||||
public open override /*1*/ var prop: kotlin.Int
|
||||
protected open override /*1*/ var prop2: kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user