[FE 1.0] Continue completion of calls inside that builder inference call postponed type variables of which has already been inferred
This commit is contained in:
committed by
teamcity
parent
b8030ec1de
commit
7675361380
+20
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class Foo<T> {
|
||||
fun add(x: T) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K1> myBuilder1(@BuilderInference builder: Foo<K1>.() -> Foo<K1>): Foo<K1> = Foo<K1>().apply { builder() }
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K2> myBuilder2(@BuilderInference builder: Foo<K2>.() -> Unit): Foo<K2> = Foo<K2>().apply(builder)
|
||||
|
||||
val result1 = myBuilder1 {
|
||||
add(null)
|
||||
myBuilder2 {
|
||||
add(<!ARGUMENT_TYPE_MISMATCH!>""<!>)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class Foo<T> {
|
||||
fun add(x: T) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K1> myBuilder1(@BuilderInference builder: Foo<K1>.() -> Foo<K1>): Foo<K1> = Foo<K1>().apply { builder() }
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K2> myBuilder2(@BuilderInference builder: Foo<K2>.() -> Unit): Foo<K2> = Foo<K2>().apply(builder)
|
||||
|
||||
val result1 = myBuilder1 {
|
||||
add(null)
|
||||
myBuilder2 {
|
||||
add(<!TYPE_MISMATCH!>""<!>)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public val result1: Foo<kotlin.Nothing?>
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ K1> myBuilder1(/*0*/ @kotlin.BuilderInference builder: Foo<K1>.() -> Foo<K1>): Foo<K1>
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ K2> myBuilder2(/*0*/ @kotlin.BuilderInference builder: Foo<K2>.() -> kotlin.Unit): Foo<K2>
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public final fun add(/*0*/ x: T): 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
|
||||
}
|
||||
Reference in New Issue
Block a user