K2: report only warning on lambda parameters with missing dependencies

During the fix of KT-62525, we've forbidden to use lambda parameters
with inaccessible types at all. After it, some impact was noticed,
so we decided to forbid them only in case it's necessary
(the case when associated types have type arguments, see KT-62525
description), and to deprecate them in other cases.

#KT-64266 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-12-19 14:51:55 +01:00
committed by Space Team
parent 44aa2d86d3
commit c322644860
22 changed files with 172 additions and 27 deletions
@@ -0,0 +1,30 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
// LANGUAGE: +ForbidLambdaParameterWithMissingDependencyType
// ISSUE: KT-64266
// MODULE: m1
// FILE: m1.kt
class Some
// MODULE: m2(m1)
// FILE: m2.kt
fun foo(f: (Some, String) -> Unit) {}
fun bar(f: (Some) -> Unit) {}
// MODULE: m3(m2)
// FILE: m3.kt
fun test() {
foo { _, _ -> }
foo { some, str -> }
foo { some, _ -> some.toString() }
foo { some: <!UNRESOLVED_REFERENCE!>Some<!>, _ -> }
bar { }
bar { _ -> }
bar { it -> }
bar { it.toString() }
bar { some -> some.toString() }
}