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:
committed by
Space Team
parent
44aa2d86d3
commit
c322644860
@@ -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() }
|
||||
}
|
||||
Reference in New Issue
Block a user