[NI] Relax rules for call completion: require at least one constraint
It's enough to have at least one good constraint. Note that the whole algorithm can be a bit more general: we could check also Out<T>, In<T> and verify that T has good only lower constraint or upper constraint, but there are questions for types like Inv<Out<T>>, where T should have lower and upper constraints #KT-31514 Fixed
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Parent
|
||||
interface Inv<T>
|
||||
|
||||
object Child : Parent
|
||||
|
||||
fun <K : Parent> wrapper(): Inv<K> = TODO()
|
||||
fun <T : Parent> consume(wrapper: Inv<T>) {}
|
||||
|
||||
fun <S> select(x: S, y: S): S = x
|
||||
|
||||
fun error(f: Inv<out Parent>, w: Inv<Child>) {
|
||||
consume(select(f, wrapper<Child>()))
|
||||
}
|
||||
Reference in New Issue
Block a user