Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/completion/basic.fir.kt
T
Pavel Kirpichenkov e9941f8c12 [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.
2019-12-25 14:59:05 +03:00

71 lines
945 B
Kotlin
Vendored

// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
interface Bound
class Cls : Bound
class Inv<T>(val prop: T)
class In<in I>(param: I)
class InB<in I : Bound>(param: I)
class Out<out O>(val prop: O)
fun <K> id(arg: K): K = arg
fun <W> makeInv(arg: W): Inv<W> = TODO()
fun <O> wrapOut(arg: O): Inv<out O> = TODO()
fun <I> wrapIn(arg: I): Inv<in I> = TODO()
fun test1(cls: Cls) {
id(
Inv(cls)
)
}
fun test2(cls: Cls) {
id<Inv<Bound>>(
Inv(cls)
)
}
fun test3(cls: Cls) {
id<Out<Bound>>(
Out(cls)
)
}
fun test4(cls: Cls) {
id(
Out(cls)
)
}
fun test5(cls: Cls) {
id(
In(cls)
)
}
fun test6(cls: Cls) {
id<In<Bound>>(
In(cls)
)
}
fun test7(cls: Cls) {
id(
wrapOut(cls)
)
}
fun test8(cls: Cls) {
// TODO
id(
wrapIn(cls)
)
}
fun test9(cls: Cls) {
id(
InB(cls)
)
}