Don't perform Unit-conversion for functional types with type variables

#KT-40269 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-07-14 01:26:06 +03:00
parent 09b44b3189
commit bb23556ead
8 changed files with 82 additions and 7 deletions
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Either
infix fun <A, B, C> ((A) -> B).andThen(g: (B) -> C): (A) -> C = TODO()
fun unsafeRunAsync(cb: (Either) -> Unit) {}
fun runAsync(cb: (Either) -> Unit) {
unsafeRunAsync(cb.andThen { })
}
@@ -0,0 +1,12 @@
package
public fun runAsync(/*0*/ cb: (Either) -> kotlin.Unit): kotlin.Unit
public fun unsafeRunAsync(/*0*/ cb: (Either) -> kotlin.Unit): kotlin.Unit
public infix fun </*0*/ A, /*1*/ B, /*2*/ C> ((A) -> B).andThen(/*0*/ g: (B) -> C): (A) -> C
public final class Either {
public constructor Either()
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
}
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> foo(f: () -> T) {}
fun bar(g: () -> Unit) {}
fun <K> baz(): () -> K = TODO()
fun test() {
foo { bar(baz()) }
}
@@ -0,0 +1,6 @@
package
public fun bar(/*0*/ g: () -> kotlin.Unit): kotlin.Unit
public fun </*0*/ K> baz(): () -> K
public fun </*0*/ T> foo(/*0*/ f: () -> T): kotlin.Unit
public fun test(): kotlin.Unit