protected & internal are now forbidden in interfaces
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5f43628f1b
commit
cba6870f52
+4
-3
@@ -6,11 +6,12 @@ interface A {
|
||||
}
|
||||
|
||||
interface B {
|
||||
protected val c: String
|
||||
private val c: String
|
||||
get() = "FAIL"
|
||||
}
|
||||
|
||||
open class C {
|
||||
private val c: String = "FAIL"
|
||||
abstract class C {
|
||||
abstract protected val c: String
|
||||
}
|
||||
|
||||
open class D: C(), A, B {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
interface A {
|
||||
protected fun foo()
|
||||
|
||||
protected fun fooImpl() { }
|
||||
|
||||
protected var bar: Int
|
||||
|
||||
public var baz: String
|
||||
public get() = ""
|
||||
protected set(value) {}
|
||||
|
||||
fun test(): String {
|
||||
foo()
|
||||
fooImpl()
|
||||
bar = bar + 1
|
||||
baz = baz + "1"
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class B : A {
|
||||
protected override fun foo() {}
|
||||
|
||||
protected override var bar: Int = 42
|
||||
|
||||
override var baz: String = ""
|
||||
protected set
|
||||
}
|
||||
|
||||
fun box() = B().test()
|
||||
@@ -1,11 +0,0 @@
|
||||
interface Foo {
|
||||
protected class Bar {
|
||||
fun box() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class Baz : Foo {
|
||||
fun box() = Foo.Bar().box()
|
||||
}
|
||||
|
||||
fun box() = Baz().box()
|
||||
@@ -1,15 +0,0 @@
|
||||
interface A {
|
||||
protected fun foo(): String
|
||||
|
||||
fun box() = foo()
|
||||
}
|
||||
|
||||
interface B : A
|
||||
|
||||
interface C : A {
|
||||
protected override fun foo() = "OK"
|
||||
}
|
||||
|
||||
class D : B, C
|
||||
|
||||
fun box() = D().box()
|
||||
Reference in New Issue
Block a user