Fix exception when expected type is subtype of a function type

#KT-28984 Fixed
 #EA-132850 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-12-17 12:33:03 +03:00
parent 68c65a5014
commit 84222afe2f
7 changed files with 50 additions and 8 deletions
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
abstract class SubFunction : kotlin.Function0<Unit>
fun <T> takeIt(x: T, f: SubFunction) {}
fun cr() {}
fun test() {
<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>takeIt<!>(42, <!TYPE_MISMATCH!>::cr<!>)
<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>takeIt<!>(42, <!TYPE_MISMATCH!>{ }<!>)
}
@@ -0,0 +1,13 @@
package
public fun cr(): kotlin.Unit
public fun </*0*/ T> takeIt(/*0*/ x: T, /*1*/ f: SubFunction): kotlin.Unit
public fun test(): kotlin.Unit
public abstract class SubFunction : () -> kotlin.Unit {
public constructor SubFunction()
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
}