Add test checking that fun isn't inherited from base interface

This commit is contained in:
Mikhail Zarechenskiy
2020-02-04 17:46:24 +03:00
parent 45bbdaf73f
commit a736551c2a
6 changed files with 80 additions and 0 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun interface Base {
fun invoke()
}
interface WithoutFun : Base
fun interface WithFun : Base
fun takeBase(b: Base) {}
fun takeWithoutFun(a: WithoutFun) {}
fun takeWithFun(a: WithFun) {}
fun test() {
takeBase {}
takeWithoutFun({})
takeWithFun {}
}
@@ -0,0 +1,19 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun interface Base {
fun invoke()
}
interface WithoutFun : Base
fun interface WithFun : Base
fun takeBase(b: Base) {}
fun takeWithoutFun(a: WithoutFun) {}
fun takeWithFun(a: WithFun) {}
fun test() {
takeBase {}
takeWithoutFun(<!TYPE_MISMATCH!>{}<!>)
takeWithFun {}
}
@@ -0,0 +1,27 @@
package
public fun takeBase(/*0*/ b: Base): kotlin.Unit
public fun takeWithFun(/*0*/ a: WithFun): kotlin.Unit
public fun takeWithoutFun(/*0*/ a: WithoutFun): kotlin.Unit
public fun test(): kotlin.Unit
public fun interface Base {
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 WithFun : Base {
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 interface WithoutFun : Base {
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
}