NI: take into account an extension function annotation during CST calculation

This commit is contained in:
Victor Petukhov
2020-03-31 19:39:52 +03:00
parent f8d72f5dd9
commit 164f25937f
8 changed files with 122 additions and 11 deletions
+24 -2
View File
@@ -1,8 +1,9 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_ANONYMOUS_PARAMETER
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_ANONYMOUS_PARAMETER -CAST_NEVER_SUCCEEDS
// ISSUE: KT-36819
// Case 1
fun <K> select(vararg x: K) = x[0]
interface A
class B: A
@@ -18,8 +19,29 @@ fun main() {
val x3 = select(id1(Out(B())), id2(Out(C())))
}
// Case 2
fun <R> fold(initial: R, operation: (R) -> Unit) {}
fun foo() {
fold({ x: Int -> x }) { acc -> }
}
// Case 3
class Foo
typealias X = Foo.(Foo.() -> Unit) -> Unit
fun bar() {
val y = when {
false -> { _ ->
Unit
}
true -> null as X
else -> { x ->
x()
Unit
}
}
}