Files
kotlin-fork/compiler/testData/diagnostics/tests/javac/LambdaNonGenericForbidden.kt
T
Mikhail Glukhikh c322644860 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
2023-12-20 12:48:00 +00:00

31 lines
588 B
Kotlin
Vendored

// !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() }
}