Local interfaces are forbidden now
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
interface A : Collection<String>
|
||||
interface B : List<String>
|
||||
interface C : Map<Long, Double>
|
||||
interface D : Map.Entry<Any, Nothing>
|
||||
interface E : Iterator<Int>
|
||||
|
||||
fun box(): String {
|
||||
interface F : A, B, C, D, E
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
interface Interface {
|
||||
fun foo(x: Int): Int
|
||||
}
|
||||
|
||||
fun withLocalClasses(param: Int): Interface {
|
||||
open class LocalBase {
|
||||
open val param: Int
|
||||
get() = 100
|
||||
}
|
||||
|
||||
interface LocalInterface : Interface {
|
||||
override fun foo(x: Int): Int =
|
||||
x + param
|
||||
}
|
||||
|
||||
return object : LocalBase(), LocalInterface {
|
||||
override fun foo(x: Int): Int =
|
||||
x + super.param
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = withLocalClasses(1)
|
||||
|
||||
val test1 = t.foo(10)
|
||||
if (test1 != 110) return "Fail: t.foo(10)==$test1"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
fun box(): String {
|
||||
interface L1 {
|
||||
fun foo(): String
|
||||
abstract class L1 {
|
||||
abstract fun foo(): String
|
||||
}
|
||||
|
||||
open class L2(val s: String) : L1 {
|
||||
open class L2(val s: String) : L1() {
|
||||
override fun foo() = s
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
fun box(): String {
|
||||
interface A {
|
||||
fun foo() = "OK"
|
||||
}
|
||||
|
||||
class B : A
|
||||
|
||||
return B().foo()
|
||||
}
|
||||
Reference in New Issue
Block a user