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
This commit is contained in:
Mikhail Zarechenskiy
2023-06-07 15:26:38 +02:00
committed by Space Team
parent 9cf40f8c2f
commit 1153238fd7
10 changed files with 20 additions and 12 deletions
@@ -3,14 +3,14 @@
fun a() {
val x = 10
foo(::<!UNSUPPORTED!>x<!>)
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!>test4<!>) {}
fun test3(test4: () -> Unit = ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>test4<!>) {}
fun test5(test6: (test: Test) -> Unit = Test::helper) {
test6(Test())
@@ -3,13 +3,13 @@
fun eat(value: Any) {}
fun test(param: String) {
val a = ::<!UNSUPPORTED!>param<!>
val a = ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>param<!>
val local = "local"
val b = ::<!UNSUPPORTED!>local<!>
val b = ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>local<!>
val lambda = { -> }
val g = ::<!UNSUPPORTED!>lambda<!>
val g = ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>lambda<!>
eat(::<!UNSUPPORTED!>param<!>)
eat(::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>param<!>)
}
@@ -9,6 +9,6 @@ class Foo {
fun main() {
val f = Foo()
val a: Int
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>a<!>) // no exception after fix
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>a<!>) // no exception after fix
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
}
@@ -9,6 +9,6 @@ class Foo {
fun main(x: Int) {
val f = Foo()
val a: Int
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>x<!>) // no exception after fix
<!UNRESOLVED_REFERENCE!>get<!>() = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS!>x<!>) // no exception after fix
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
}