Support extensions in functional supertypes
Under a flag for now.
This commit is contained in:
committed by
teamcityserver
parent
10101dc2b4
commit
3f8fa3149b
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +FunctionalTypeWithExtensionAsSupertype
|
||||
// IGNORE_BACKEND: JS, JS_IR, WASM
|
||||
|
||||
interface I: (String) -> String
|
||||
|
||||
class C: String.() -> String, I {
|
||||
override fun invoke(p1: String): String = p1
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
if (c("OK") != "OK") return c("OK")
|
||||
val ext: String.() -> String = c
|
||||
return "OK".ext()
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +FunctionalTypeWithExtensionAsSupertype
|
||||
// SKIP_TXT
|
||||
class A : Double.() -> Unit {
|
||||
override fun invoke(p1: Double) {}
|
||||
}
|
||||
|
||||
class B : Int.(Double) -> Unit {
|
||||
override fun invoke(p1: Int, p2: Double) {}
|
||||
}
|
||||
|
||||
open class C {}
|
||||
|
||||
abstract class A0 : C.() -> Int
|
||||
abstract class A1 : C.(Int) -> Int
|
||||
abstract class A2 : C.(Int, String) -> Int
|
||||
|
||||
open class D<T> {}
|
||||
|
||||
abstract class B0<T> : D<T>.() -> Int
|
||||
abstract class B1<T> : D<T>.(C) -> Int
|
||||
abstract class B2<T> : D<T>.(T, C) -> T
|
||||
|
||||
interface E<T> {}
|
||||
|
||||
abstract class C0: C(), Int.() -> Double
|
||||
abstract class C1<T>: C(), E<T>, Int.(C) -> Double
|
||||
Reference in New Issue
Block a user