Tests: move more diagnostic tests to testsWithJvmBackend
In this commit, tests where backend diagnostics were reported correctly are being moved. FirScopeDumpHandler was added to FIR diagnostic tests with JVM backend to support `SCOPE_DUMP` in `overridesBuiltinNoMagic.kt` and `charAtAndOverload.kt`.
This commit is contained in:
committed by
Space Team
parent
56a1a3153b
commit
d986e0ee9c
+3
@@ -0,0 +1,3 @@
|
||||
/main.kt:21:14: error: Accidental override: The following declarations have the same JVM signature (get(I)C):
|
||||
fun get(index: Int): Char defined in KA
|
||||
fun get(index: Int): Char defined in KA
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/main.kt:21:18: error: This function accidentally overrides both 'public open operator fun /A.get(index: kotlin/Int): kotlin/Char' and a renamed function 'public open fun /A.charAt(index: kotlin/Int): kotlin/Char' from JVM point of view because of mixed Java/Kotlin hierarchy.
|
||||
This situation provokes a JVM clash and thus is forbidden. To fix it, you have to delete either this function or one of overridden functions.
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// SCOPE_DUMP: KA:get
|
||||
// RENDER_ALL_DIAGNOSTICS_FULL_TEXT
|
||||
|
||||
// FILE: A.java
|
||||
abstract public class A implements CharSequence {
|
||||
public final int length() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public char charAt(int index) {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
public char get(int index) {
|
||||
return 'X';
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
abstract class KA : A() {
|
||||
override fun <!ACCIDENTAL_OVERRIDE_CLASH_BY_JVM_SIGNATURE!>get<!>(index: Int) = 'O'
|
||||
}
|
||||
|
||||
fun foo(a: A, ka: KA) {
|
||||
a.get(0)
|
||||
ka.get(0)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KA:
|
||||
[Source]: public open override operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of /KA [id: 0]
|
||||
[Enhancement]: public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /A [id: 1]
|
||||
[Enhancement]: /* hidden due to clash */ public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of /KA [id: 0]
|
||||
[Enhancement]: /* hidden due to clash */ public open operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /A [id: 0]
|
||||
[Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1]
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// SCOPE_DUMP: KA:get
|
||||
// RENDER_ALL_DIAGNOSTICS_FULL_TEXT
|
||||
|
||||
// FILE: A.java
|
||||
abstract public class A implements CharSequence {
|
||||
public final int length() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public char charAt(int index) {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
public char get(int index) {
|
||||
return 'X';
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
abstract class KA : A() {
|
||||
override <!ACCIDENTAL_OVERRIDE!>fun get(index: Int) = 'O'<!>
|
||||
}
|
||||
|
||||
fun foo(a: A, ka: KA) {
|
||||
a.get(0)
|
||||
ka.get(0)
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
// SCOPE_DUMP: Y2:removeAt
|
||||
// FILE: X.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class X implements java.util.List<String> {
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean contains(String o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends String> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends String> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String set(int index, String element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, String element) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String remove(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String removeAt(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<String> listIterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<String> listIterator(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> subList(int fromIndex, int toIndex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class Y : X()
|
||||
class Y2 : X() {
|
||||
override fun <!ACCIDENTAL_OVERRIDE_CLASH_BY_JVM_SIGNATURE!>removeAt<!>(index: Int) = ""
|
||||
}
|
||||
|
||||
fun main() {
|
||||
X().remove("")
|
||||
X().removeAt(1)
|
||||
|
||||
val y: MutableList<String> = Y()
|
||||
y.removeAt(1)
|
||||
|
||||
Y().remove("")
|
||||
Y().removeAt(1)
|
||||
|
||||
X().remove("")
|
||||
X().removeAt(1)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Y2:
|
||||
[Source]: public open override fun removeAt(index: R|kotlin/Int|): R|kotlin/String| from Use site scope of /Y2 [id: 0]
|
||||
[Enhancement]: public open fun removeAt(index: R|kotlin/Int|): R|kotlin/String!| from Java enhancement scope for /X [id: 1]
|
||||
[Enhancement]: /* hidden due to clash */ public open operator fun removeAt(index: R|kotlin/Int|): R|kotlin/String!| from Use site scope of /Y2 [id: 0]
|
||||
[Enhancement]: /* hidden due to clash */ public open operator fun removeAt(index: R|kotlin/Int|): R|kotlin/String!| from Java enhancement scope for /X [id: 0]
|
||||
[SubstitutionOverride(DeclarationSite)]: public abstract override fun removeAt(index: R|kotlin/Int|): R|kotlin/String!| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type X [id: 1]
|
||||
[Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 2]
|
||||
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
// SCOPE_DUMP: Y2:removeAt
|
||||
// FILE: X.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class X implements java.util.List<String> {
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean contains(String o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends String> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends String> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String set(int index, String element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, String element) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String remove(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String removeAt(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<String> listIterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ListIterator<String> listIterator(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> subList(int fromIndex, int toIndex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class Y : X()
|
||||
class Y2 : X() {
|
||||
override <!ACCIDENTAL_OVERRIDE!>fun removeAt(index: Int) = ""<!>
|
||||
}
|
||||
|
||||
fun main() {
|
||||
X().remove("")
|
||||
X().removeAt(1)
|
||||
|
||||
val y: MutableList<String> = Y()
|
||||
y.removeAt(1)
|
||||
|
||||
Y().remove("")
|
||||
Y().removeAt(1)
|
||||
|
||||
X().remove("")
|
||||
X().removeAt(1)
|
||||
}
|
||||
Reference in New Issue
Block a user