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
+2 -2
View File
@@ -4,10 +4,10 @@ compiler/testData/cli/jvm/conflictingJvmDeclarations.kt:3:9: error: platform dec
fun getY(): Int defined in Foo
get() = 42
^
compiler/testData/cli/jvm/conflictingJvmDeclarations.kt:8:5: error: platform declaration clash: The following declarations have the same JVM signature (getX()I):
compiler/testData/cli/jvm/conflictingJvmDeclarations.kt:9:5: error: platform declaration clash: The following declarations have the same JVM signature (getX()I):
fun `<get-x>`(): Int defined in Foo
fun getX(): Int defined in Foo
fun getY(): Int defined in Foo
@JvmName("getX")
fun getY() = 42
^
COMPILATION_ERROR
+2 -2
View File
@@ -28,11 +28,11 @@ compiler/testData/cli/jvm/signatureClash.kt:20:5: error: accidental override: Th
fun getTr(): Int defined in SubTr
val tr = 1
^
compiler/testData/cli/jvm/signatureClash.kt:24:7: error: platform declaration clash: The following declarations have the same JVM signature (access$f(LC;)V):
compiler/testData/cli/jvm/signatureClash.kt:24:1: error: platform declaration clash: The following declarations have the same JVM signature (access$f(LC;)V):
fun `access$f`(`$this`: C): Unit defined in C
fun `access$f`(c: C): Unit defined in C
class C {
^
^
compiler/testData/cli/jvm/signatureClash.kt:26:5: error: platform declaration clash: The following declarations have the same JVM signature (access$f(LC;)V):
fun `access$f`(`$this`: C): Unit defined in C
fun `access$f`(c: C): Unit defined in C
@@ -1,23 +1,23 @@
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
fun `access$getFoo$cp`(): Int defined in A
fun `access$getFoo$cp`(): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
fun `access$setFoo$cp`(`<set-?>`: Int): Unit defined in A
fun `access$setFoo$cp`(d: Int): Unit defined in A
class A {
^
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
@@ -1,23 +1,23 @@
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
fun `access$getFoo`(`$this`: A): Int defined in A
fun `access$getFoo`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:1: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
fun `access$setFoo`(`$this`: A, i: Int): Unit defined in A
fun `access$setFoo`(a: A, d: Int): Unit defined in A
class A {
^
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
+12 -12
View File
@@ -1,31 +1,31 @@
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$foo(LDerived;)V):
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$foo(LDerived;)V):
fun `access$foo`(d: Derived): Unit defined in Derived
fun `access$foo`(`$this`: Derived): Unit defined in Derived
class Derived : Base() {
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
fun `access$getBar$p`(d: Derived): Int defined in Derived
fun `access$getBar$p`(`$this`: Derived): Int defined in Derived
class Derived : Base() {
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$setBar$p(LDerived;I)V):
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$setBar$p(LDerived;I)V):
fun `access$setBar$p`(d: Derived, i: Int): Unit defined in Derived
fun `access$setBar$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
class Derived : Base() {
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
fun `access$getBaz$p`(d: Derived): Int defined in Derived
fun `access$getBaz$p`(`$this`: Derived): Int defined in Derived
class Derived : Base() {
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
fun `access$getBoo$p`(d: Derived): Int defined in Derived
fun `access$getBoo$p`(`$this`: Derived): Int defined in Derived
class Derived : Base() {
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:1: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
fun `access$setBar1$p`(d: Derived, i: Int): Unit defined in Derived
fun `access$setBar1$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
class Derived : Base() {
^
^
COMPILATION_ERROR