K2: report JVM backend errors in the same way in PSI as LT

Do not try to find PSI element, but always use the IR element offsets
instead. This greatly simplifies test data because we don't need to have
custom PSI- and LT- based diagnostic ranges in every test, and K1/K2
behavior also is mostly the same.

The exact offset ranges are not as important for backend diagnostics, so
it's better to have K2+PSI and K2+LT behaving the same.
This commit is contained in:
Alexander Udalov
2023-07-27 19:12:36 +02:00
committed by Space Team
parent 6069aaee9c
commit 965946d3ef
148 changed files with 267 additions and 860 deletions
@@ -1,8 +1,6 @@
// COMPARE_WITH_LIGHT_TREE
enum class E {
ENTRY;
fun <!VIRTUAL_MEMBER_HIDDEN!>getDeclaringClass<!>() {}
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun <!VIRTUAL_MEMBER_HIDDEN!>finalize<!>()<!> {}<!>
<!ACCIDENTAL_OVERRIDE!>fun <!VIRTUAL_MEMBER_HIDDEN!>finalize<!>() {}<!>
}
@@ -1,5 +1,3 @@
// COMPARE_WITH_LIGHT_TREE
enum class E {
ENTRY;
@@ -1,20 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// KT-7174 Report error on members with the same signature as non-overridable methods from mapped Java types (like Object.wait/notify)
class A {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun notify()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun notifyAll()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait(l: Long)<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait(l: Long, i: Int)<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun getClass(): Class<Any><!> = null!!<!>
}
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun notify()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun notifyAll()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait()<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait(l: Long)<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun wait(l: Long, i: Int)<!> {}<!>
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun getClass(): Class<Any><!> = null!!<!>
@@ -1,20 +1,20 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// KT-7174 Report error on members with the same signature as non-overridable methods from mapped Java types (like Object.wait/notify)
class A {
<!ACCIDENTAL_OVERRIDE!>fun notify()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun notifyAll()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any><!> = null!!
<!ACCIDENTAL_OVERRIDE!>fun notify() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun notifyAll() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long) {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int) {}<!>
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any> = null!!<!>
}
<!ACCIDENTAL_OVERRIDE!>fun notify()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun notifyAll()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait()<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any><!> = null!!
<!ACCIDENTAL_OVERRIDE!>fun notify() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun notifyAll() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait() {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long) {}<!>
<!ACCIDENTAL_OVERRIDE!>fun wait(l: Long, i: Int) {}<!>
<!ACCIDENTAL_OVERRIDE!>fun getClass(): Class<Any> = null!!<!>