Add constraints between two different stub variables instead of creating constraint error due to T1 isn't subtype of T2
^KT-44241 Fixed
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
class A
|
||||
class B<K> {}
|
||||
class Scope<K11, K22>(
|
||||
val key: K11,
|
||||
) {
|
||||
fun emit(key: K22) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <K1, K2> B<K1>.scoped(@kotlin.BuilderInference binder: Scope<K1, K2>.() -> Unit) {}
|
||||
|
||||
fun run(x: B<A>) {
|
||||
x.scoped { emit(key) }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
run(B<A>())
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user