Add base declaration checker for fun interfaces
This commit is contained in:
+104
@@ -0,0 +1,104 @@
|
||||
// !LANGUAGE: +FunctionalInterfaceConversion
|
||||
|
||||
fun interface Good {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
fun interface Foo1
|
||||
|
||||
fun interface Foo2 {
|
||||
|
||||
}
|
||||
|
||||
fun interface Foo3 {
|
||||
fun foo()
|
||||
fun bar()
|
||||
}
|
||||
|
||||
interface BaseWithSAM {
|
||||
fun base()
|
||||
}
|
||||
|
||||
fun interface Foo4 : BaseWithSAM {
|
||||
fun oneMore()
|
||||
}
|
||||
|
||||
fun interface Foo4WithDefault : BaseWithSAM {
|
||||
fun oneMore() {}
|
||||
}
|
||||
|
||||
interface BaseWithDefault {
|
||||
fun def() {}
|
||||
}
|
||||
|
||||
fun interface Foo4WithBaseDefault : BaseWithDefault {
|
||||
fun oneMore()
|
||||
}
|
||||
|
||||
fun interface GoodWithBase : BaseWithSAM
|
||||
|
||||
fun interface Foo5 {
|
||||
val prop: Int
|
||||
}
|
||||
|
||||
fun interface Foo6 {
|
||||
fun foo()
|
||||
val prop: Int
|
||||
}
|
||||
|
||||
fun interface Foo7 : BaseWithSAM {
|
||||
val prop: Int
|
||||
}
|
||||
|
||||
fun interface GoodWithPropAndBase : BaseWithSAM {
|
||||
val prop: Int get() = 42
|
||||
}
|
||||
|
||||
fun interface Foo8 {
|
||||
fun <T> invoke(x: T)
|
||||
}
|
||||
|
||||
fun interface GoodGeneric<T> {
|
||||
fun invoke(x: T)
|
||||
}
|
||||
|
||||
interface BaseWithGeneric {
|
||||
fun <T> invoke(x: T)
|
||||
}
|
||||
|
||||
fun interface Foo9 : BaseWithGeneric
|
||||
|
||||
fun interface GoodExtensionGeneric : GoodGeneric<String>
|
||||
|
||||
fun interface GoodSuspend {
|
||||
suspend fun invoke()
|
||||
}
|
||||
|
||||
class WithNestedFun<K> {
|
||||
fun interface NestedSimple
|
||||
|
||||
fun interface GoodFun {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
fun interface NestedFun {
|
||||
fun inovke(element: K)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> local() {
|
||||
fun interface LocalFun {
|
||||
fun invoke(element: T)
|
||||
}
|
||||
}
|
||||
|
||||
fun interface WithDefaultValue {
|
||||
fun invoke(s: String = "")
|
||||
}
|
||||
|
||||
interface BaseWithDefaultValue {
|
||||
fun invoke(s: String = "")
|
||||
}
|
||||
|
||||
fun interface DeriveDefault : BaseWithDefaultValue
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
// !LANGUAGE: +FunctionalInterfaceConversion
|
||||
|
||||
fun interface Good {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Foo1
|
||||
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Foo2 {
|
||||
|
||||
}
|
||||
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Foo3 {
|
||||
fun foo()
|
||||
fun bar()
|
||||
}
|
||||
|
||||
interface BaseWithSAM {
|
||||
fun base()
|
||||
}
|
||||
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Foo4 : BaseWithSAM {
|
||||
fun oneMore()
|
||||
}
|
||||
|
||||
fun interface Foo4WithDefault : BaseWithSAM {
|
||||
fun oneMore() {}
|
||||
}
|
||||
|
||||
interface BaseWithDefault {
|
||||
fun def() {}
|
||||
}
|
||||
|
||||
fun interface Foo4WithBaseDefault : BaseWithDefault {
|
||||
fun oneMore()
|
||||
}
|
||||
|
||||
fun interface GoodWithBase : BaseWithSAM
|
||||
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface Foo5 {
|
||||
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>val<!> prop: Int
|
||||
}
|
||||
|
||||
fun interface Foo6 {
|
||||
fun foo()
|
||||
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>val<!> prop: Int
|
||||
}
|
||||
|
||||
fun interface Foo7 : BaseWithSAM {
|
||||
<!FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES!>val<!> prop: Int
|
||||
}
|
||||
|
||||
fun interface GoodWithPropAndBase : BaseWithSAM {
|
||||
val prop: Int get() = 42
|
||||
}
|
||||
|
||||
fun interface Foo8 {
|
||||
fun <!FUN_INTERFACE_ABSTRACT_METHOD_WITH_TYPE_PARAMETERS!><T><!> invoke(x: T)
|
||||
}
|
||||
|
||||
fun interface GoodGeneric<T> {
|
||||
fun invoke(x: T)
|
||||
}
|
||||
|
||||
interface BaseWithGeneric {
|
||||
fun <T> invoke(x: T)
|
||||
}
|
||||
|
||||
<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_TYPE_PARAMETERS!>fun<!> interface Foo9 : BaseWithGeneric
|
||||
|
||||
fun interface GoodExtensionGeneric : GoodGeneric<String>
|
||||
|
||||
fun interface GoodSuspend {
|
||||
suspend fun invoke()
|
||||
}
|
||||
|
||||
class WithNestedFun<K> {
|
||||
<!FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS!>fun<!> interface NestedSimple
|
||||
|
||||
fun interface GoodFun {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
fun interface NestedFun {
|
||||
fun inovke(element: <!UNRESOLVED_REFERENCE!>K<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> local() {
|
||||
<!LOCAL_INTERFACE_NOT_ALLOWED!>fun interface LocalFun<!> {
|
||||
fun invoke(element: T)
|
||||
}
|
||||
}
|
||||
|
||||
fun interface WithDefaultValue {
|
||||
fun invoke(<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_DEFAULT_VALUE!>s: String = ""<!>)
|
||||
}
|
||||
|
||||
interface BaseWithDefaultValue {
|
||||
fun invoke(s: String = "")
|
||||
}
|
||||
|
||||
<!FUN_INTERFACE_ABSTRACT_METHOD_WITH_DEFAULT_VALUE!>fun<!> interface DeriveDefault : BaseWithDefaultValue
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> local(): kotlin.Unit
|
||||
|
||||
public interface BaseWithDefault {
|
||||
public open fun def(): kotlin.Unit
|
||||
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 BaseWithDefaultValue {
|
||||
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 fun invoke(/*0*/ s: kotlin.String = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface BaseWithGeneric {
|
||||
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 fun </*0*/ T> invoke(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface BaseWithSAM {
|
||||
public abstract fun base(): kotlin.Unit
|
||||
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 fun interface DeriveDefault : BaseWithDefaultValue {
|
||||
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*/ s: kotlin.String = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo1 {
|
||||
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 fun interface Foo2 {
|
||||
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 fun interface Foo3 {
|
||||
public abstract fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo4 : BaseWithSAM {
|
||||
public abstract override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 fun oneMore(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo4WithBaseDefault : BaseWithDefault {
|
||||
public open override /*1*/ /*fake_override*/ fun def(): kotlin.Unit
|
||||
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 fun oneMore(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo4WithDefault : BaseWithSAM {
|
||||
public abstract override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 fun oneMore(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo5 {
|
||||
public abstract val 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 fun interface Foo6 {
|
||||
public abstract val prop: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo7 : BaseWithSAM {
|
||||
public abstract val prop: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 fun interface Foo8 {
|
||||
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 fun </*0*/ T> invoke(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Foo9 : BaseWithGeneric {
|
||||
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 </*0*/ T> invoke(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface Good {
|
||||
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 fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface GoodExtensionGeneric : GoodGeneric<kotlin.String> {
|
||||
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*/ x: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface GoodGeneric</*0*/ T> {
|
||||
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 fun invoke(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface GoodSuspend {
|
||||
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 suspend fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface GoodWithBase : BaseWithSAM {
|
||||
public abstract override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 fun interface GoodWithPropAndBase : BaseWithSAM {
|
||||
public open val prop: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 fun interface WithDefaultValue {
|
||||
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 fun invoke(/*0*/ s: kotlin.String = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class WithNestedFun</*0*/ K> {
|
||||
public constructor WithNestedFun</*0*/ K>()
|
||||
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 fun interface GoodFun {
|
||||
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 fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface NestedFun {
|
||||
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 fun inovke(/*0*/ element: [ERROR : K]): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public fun interface NestedSimple {
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user