JS: prohibit to implement functional interfaces. See KT-15136
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//KT-3190 Compiler crash if function called 'invoke' calls a closure
|
||||
// IGNORE_BACKEND: JS
|
||||
// JS backend does not allow to implement Function{N} interfaces
|
||||
|
||||
fun box(): String {
|
||||
val test = Cached<Int,Int>({ it + 2 })
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//KT-3822 Compiler crashes when use invoke convention with `this` in class which extends Function0<T>
|
||||
// IGNORE_BACKEND: JS
|
||||
// JS backend does not allow to implement Function{N} interfaces
|
||||
|
||||
class B() : Function0<Boolean> {
|
||||
override fun invoke() = true
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
abstract class <!IMPLEMENTING_FUNCTION_INTERFACE!>A<!> : () -> Unit
|
||||
|
||||
<!IMPLEMENTING_FUNCTION_INTERFACE!>object B<!> : (String, Int) -> Long {
|
||||
override fun invoke(a: String, B: Int) = 23L
|
||||
}
|
||||
|
||||
abstract class <!IMPLEMENTING_FUNCTION_INTERFACE!>C<!> : kotlin.Function1<Any, Int>
|
||||
|
||||
abstract class <!IMPLEMENTING_FUNCTION_INTERFACE!>D<!> : C()
|
||||
@@ -0,0 +1,33 @@
|
||||
package
|
||||
|
||||
public abstract class A : () -> kotlin.Unit {
|
||||
public constructor A()
|
||||
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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object B : (kotlin.String, kotlin.Int) -> kotlin.Long {
|
||||
private constructor B()
|
||||
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*/ fun invoke(/*0*/ a: kotlin.String, /*1*/ B: kotlin.Int): kotlin.Long
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class C : (kotlin.Any) -> kotlin.Int {
|
||||
public constructor C()
|
||||
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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class D : C {
|
||||
public constructor D()
|
||||
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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user