[NI] Postpone calls with not enough information in builder inference

This commit is contained in:
Dmitriy Novozhilov
2020-01-13 15:47:25 +03:00
parent f4b3e9b4b2
commit 3428a17759
16 changed files with 206 additions and 35 deletions
@@ -0,0 +1,35 @@
// !LANGUAGE: +NewInference
// !USE_EXPERIMENTAL: kotlin.Experimental
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-35684
import kotlin.experimental.ExperimentalTypeInference
fun test_1() {
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Int>")!>sequence {
yield(<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Int>")!>materialize()<!>)
yield(materialize<Int>())
}<!>
}
fun test_2() {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
yield(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>())
}
}
fun test_3() {
sequence {
yield(materialize<Int>())
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()
}
}
@UseExperimental(ExperimentalTypeInference::class)
fun <U> sequence(@BuilderInference block: suspend Inv<U>.() -> Unit): U = null!!
interface Inv<T> {
fun yield(element: T)
}
fun <K> materialize(): Inv<K> = TODO()
@@ -0,0 +1,14 @@
package
public fun </*0*/ K> materialize(): Inv<K>
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ U> sequence(/*0*/ @kotlin.BuilderInference block: suspend Inv<U>.() -> kotlin.Unit): U
public fun test_1(): kotlin.Unit
public fun test_2(): kotlin.Unit
public fun test_3(): kotlin.Unit
public interface Inv</*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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract fun yield(/*0*/ element: T): kotlin.Unit
}