[NI] Implement algorithm for completion mode selection
Current selection of completion mode for call is not always correct in case of full mode, and sometimes too conservative in case of partial mode. Updated algorithm checks constraints wrt position of type variables in return type and in other related constraints. Full completion happens if proper constraint requirements are satisfied for variables.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
import kotlin.internal.Exact
|
||||
|
||||
class Inv<I>(val arg: I)
|
||||
class InvExact<E>(val arg: @kotlin.internal.Exact E)
|
||||
|
||||
interface Base
|
||||
class Derived : Base
|
||||
class Other : Base
|
||||
|
||||
fun <K> id(arg: K): K = arg
|
||||
|
||||
fun test1(arg: Derived) {
|
||||
id<Inv<Base>>(Inv(arg))
|
||||
id<Inv<Base>>(<!TYPE_MISMATCH!>InvExact(arg)<!>)
|
||||
}
|
||||
|
||||
fun <R> Inv<@Exact R>.select(first: R, second: R): R = TODO()
|
||||
|
||||
fun test2(derived: Derived, other: Other) {
|
||||
Inv(derived).select(derived, <!TYPE_MISMATCH!>other<!>)
|
||||
}
|
||||
Reference in New Issue
Block a user