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,15 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Foo<X> {
fun foo(x: X)
}
open class FooImpl : Foo<String> {
override fun foo(x: String) {
}
}
open class FooImpl2 : FooImpl() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun foo(x: Any)<!> {
}<!>
}
@@ -1,4 +1,4 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Foo<X> {
fun foo(x: X)
@@ -10,6 +10,6 @@ open class FooImpl : Foo<String> {
}
open class FooImpl2 : FooImpl() {
<!ACCIDENTAL_OVERRIDE!>fun foo(x: Any)<!> {
}
<!ACCIDENTAL_OVERRIDE!>fun foo(x: Any) {
}<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
open class B {
fun getX() = 1
}
class C : B() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>val x: Int<!>
<!ACCIDENTAL_OVERRIDE!>val x: Int
get() = 1<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
open class B {
fun getX() = 1
}
class C : B() {
val x: Int
<!ACCIDENTAL_OVERRIDE!>get()<!> = 1
<!ACCIDENTAL_OVERRIDE!>get() = 1<!>
}
@@ -1,9 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
open class B {
fun getX() = 1
}
class C : B() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>val x: Int<!> = 1<!>
}
@@ -1,9 +1,9 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
open class B {
fun getX() = 1
}
class C : B() {
<!ACCIDENTAL_OVERRIDE!>val x: Int<!> = 1
<!ACCIDENTAL_OVERRIDE!>val x: Int = 1<!>
}
@@ -1,10 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
open class B {
val x: Int
get() = 1
}
class C : B() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun getX()<!> = 1<!>
}
@@ -1,4 +1,4 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
open class B {
val x: Int
@@ -6,5 +6,5 @@ open class B {
}
class C : B() {
<!ACCIDENTAL_OVERRIDE!>fun getX()<!> = 1
<!ACCIDENTAL_OVERRIDE!>fun getX() = 1<!>
}
@@ -1,10 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base {
open fun `foo$default`(d: Derived, i: Int, mask: Int, mh: Any) {}
}
class Derived : Base() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun foo(i: Int = 0)<!> {}<!>
}
@@ -1,4 +1,4 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base {
@@ -6,5 +6,5 @@ open class Base {
}
class Derived : Base() {
<!ACCIDENTAL_OVERRIDE!>fun foo(i: Int = 0)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun foo(i: Int = 0) {}<!>
}
@@ -6,4 +6,4 @@ interface D {
val x: Int
}
class <!ACCIDENTAL_OVERRIDE!>C(d: D)<!> : D by d, B
<!ACCIDENTAL_OVERRIDE!>class C(d: D) : D by d, B<!>
@@ -1,10 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B {
fun foo(l: List<String>) {}
}
class C : B() {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun foo(l: List<Int>)<!> {}<!>
}
@@ -1,4 +1,4 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B {
@@ -6,5 +6,5 @@ open class B {
}
class C : B() {
<!ACCIDENTAL_OVERRIDE!>fun foo(l: List<Int>)<!> {}
<!ACCIDENTAL_OVERRIDE!>fun foo(l: List<Int>) {}<!>
}
@@ -1,9 +1,7 @@
// COMPARE_WITH_LIGHT_TREE
interface B {
fun getX() = 1
}
class C : B {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!><!NOTHING_TO_OVERRIDE!>override<!> val x<!> = 1<!>
<!ACCIDENTAL_OVERRIDE!><!NOTHING_TO_OVERRIDE!>override<!> val x = 1<!>
}
@@ -1,9 +1,7 @@
// COMPARE_WITH_LIGHT_TREE
interface B {
fun getX() = 1
}
class C : B {
<!ACCIDENTAL_OVERRIDE!><!NOTHING_TO_OVERRIDE!>override<!> val x<!> = 1
<!NOTHING_TO_OVERRIDE!>override<!> <!ACCIDENTAL_OVERRIDE!>val x = 1<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
fun getX() = 1
}
class C : T {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>val x: Int<!>
<!ACCIDENTAL_OVERRIDE!>val x: Int
get() = 1<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
fun getX() = 1
}
class C : T {
val x: Int
<!ACCIDENTAL_OVERRIDE!>get()<!> = 1
<!ACCIDENTAL_OVERRIDE!>get() = 1<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
fun getX(): Int
}
abstract class C : T {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>val x: Int<!>
<!ACCIDENTAL_OVERRIDE!>val x: Int
get() = 1<!>
}
@@ -1,10 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
fun getX(): Int
}
abstract class C : T {
val x: Int
<!ACCIDENTAL_OVERRIDE!>get()<!> = 1
<!ACCIDENTAL_OVERRIDE!>get() = 1<!>
}
@@ -1,10 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
val x: Int
get() = 1
}
class C : T {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun getX()<!> = 1<!>
}
@@ -1,4 +1,4 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
interface T {
val x: Int
@@ -6,5 +6,5 @@ interface T {
}
class C : T {
<!ACCIDENTAL_OVERRIDE!>fun getX()<!> = 1
<!ACCIDENTAL_OVERRIDE!>fun getX() = 1<!>
}
@@ -1,9 +0,0 @@
// COMPARE_WITH_LIGHT_TREE
interface T {
val x: Int
}
abstract class C : T {
<!ACCIDENTAL_OVERRIDE{LT}!><!ACCIDENTAL_OVERRIDE{PSI}!>fun getX()<!> = 1<!>
}
@@ -1,9 +1,9 @@
// COMPARE_WITH_LIGHT_TREE
// FIR_IDENTICAL
interface T {
val x: Int
}
abstract class C : T {
<!ACCIDENTAL_OVERRIDE!>fun getX()<!> = 1
<!ACCIDENTAL_OVERRIDE!>fun getX() = 1<!>
}