Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt
T
Mikhail Zarechenskiy 1153238fd7 Extract diagnostics about references to variables to a separate one
Note that I've left in FIR everything as is to avoid non-trivial
refactoring that is required right now to report more specific diagnostics

 ^KT-59152
2023-06-19 15:21:32 +00:00

23 lines
473 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun a() {
val x = 10
foo(::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>x<!>)
}
fun foo(a: Any) {}
fun test1(test2: () -> Unit = ::test2) {} // Resolve to function
private fun test2() {}
fun test3(test4: () -> Unit = ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>test4<!>) {}
fun test5(test6: (test: Test) -> Unit = Test::helper) {
test6(Test())
}
class Test {
fun helper() {}
}