K1: Change how Kotlin sees some of the new JDK 21 collections members
- Make addFirst/Last and removeFirst/removeLast as members - Leave getFirst/getLast unprocessed, thus visible for K1, but marked as deprecated Though the implementations of getFirst/getLast and synthetic property access to them are expected to be deprecated as well, it's expected to be fixed in later commits. ^KT-60659 In Progress ^KT-60769 In Progress
This commit is contained in:
committed by
Space Team
parent
d99f8ac9b4
commit
1e86a82ee1
+51
@@ -0,0 +1,51 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun foo(ll: java.util.LinkedList<String>, al: ArrayList<String>, ad: ArrayDeque<String>, jad: java.util.ArrayDeque<String>) {
|
||||
ll.addFirst("")
|
||||
ll.addLast("")
|
||||
ll.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
ll.<!INVISIBLE_REFERENCE!>first<!> // synthetic property for getFirst()
|
||||
ll.first() // stdlib extension on List
|
||||
ll.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
ll.<!INVISIBLE_REFERENCE!>last<!>
|
||||
ll.last()
|
||||
ll.removeFirst()
|
||||
ll.removeLast()
|
||||
ll.reversed()
|
||||
|
||||
al.addFirst("")
|
||||
al.addLast("")
|
||||
al.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
al.<!FUNCTION_CALL_EXPECTED!>first<!>
|
||||
al.first()
|
||||
al.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
al.<!FUNCTION_CALL_EXPECTED!>last<!>
|
||||
al.last()
|
||||
al.removeFirst()
|
||||
al.removeLast()
|
||||
al.reversed()
|
||||
|
||||
ad.addFirst("")
|
||||
ad.addLast("")
|
||||
ad.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
ad.<!FUNCTION_CALL_EXPECTED!>first<!>
|
||||
ad.first()
|
||||
ad.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
ad.<!FUNCTION_CALL_EXPECTED!>last<!>
|
||||
ad.last()
|
||||
ad.removeFirst()
|
||||
ad.removeLast()
|
||||
ad.reversed()
|
||||
|
||||
jad.addFirst("")
|
||||
jad.addLast("")
|
||||
jad.getFirst()
|
||||
jad.first
|
||||
jad.first()
|
||||
jad.getLast()
|
||||
jad.last
|
||||
jad.last()
|
||||
jad.removeFirst()
|
||||
jad.removeLast()
|
||||
jad.reversed()
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun foo(ll: java.util.LinkedList<String>, al: ArrayList<String>, ad: ArrayDeque<String>, jad: java.util.ArrayDeque<String>) {
|
||||
ll.addFirst("")
|
||||
ll.addLast("")
|
||||
ll.getFirst()
|
||||
ll.first // synthetic property for getFirst()
|
||||
ll.first() // stdlib extension on List
|
||||
ll.getLast()
|
||||
ll.last
|
||||
ll.last()
|
||||
ll.<!DEBUG_INFO_CALL("fqName: java.util.LinkedList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
ll.<!DEBUG_INFO_CALL("fqName: java.util.LinkedList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
ll.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
al.addFirst("")
|
||||
al.addLast("")
|
||||
al.getFirst()
|
||||
al.first
|
||||
al.first()
|
||||
al.getLast()
|
||||
al.last
|
||||
al.last()
|
||||
al.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
al.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
al.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
ad.addFirst("")
|
||||
ad.addLast("")
|
||||
ad.<!DEPRECATION!>getFirst<!>()
|
||||
ad.<!DEPRECATION!>first<!>
|
||||
ad.first()
|
||||
ad.<!DEPRECATION!>getLast<!>()
|
||||
ad.<!DEPRECATION!>last<!>
|
||||
ad.last()
|
||||
ad.<!DEBUG_INFO_CALL("fqName: kotlin.collections.ArrayDeque.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
ad.<!DEBUG_INFO_CALL("fqName: kotlin.collections.ArrayDeque.removeLast; typeCall: function")!>removeLast()<!>
|
||||
ad.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
jad.addFirst("")
|
||||
jad.addLast("")
|
||||
jad.getFirst()
|
||||
jad.first
|
||||
jad.first()
|
||||
jad.getLast()
|
||||
jad.last
|
||||
jad.last()
|
||||
jad.<!DEBUG_INFO_CALL("fqName: java.util.ArrayDeque.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
jad.<!DEBUG_INFO_CALL("fqName: java.util.ArrayDeque.removeLast; typeCall: function")!>removeLast()<!>
|
||||
jad.<!DEBUG_INFO_CALL("fqName: java.util.ArrayDeque.reversed; typeCall: function")!>reversed()<!>
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// ISSUE: KT-58371
|
||||
// WITH_STDLIB
|
||||
|
||||
class A<T> : ArrayList<T>() {
|
||||
override fun addFirst(t: T) {
|
||||
super.addFirst(t)
|
||||
}
|
||||
|
||||
override fun addLast(t: T) {
|
||||
super.addLast(t)
|
||||
}
|
||||
|
||||
override fun getFirst(): T = super.getFirst()
|
||||
override fun getLast(): T = super.getLast()
|
||||
|
||||
override fun removeFirst(): T = super.removeFirst()
|
||||
override fun removeLast(): T = super.removeLast()
|
||||
|
||||
override fun reversed(): List<T> = super.reversed()
|
||||
}
|
||||
|
||||
fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
|
||||
x.addFirst("")
|
||||
x.addLast("")
|
||||
x.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
x.<!FUNCTION_CALL_EXPECTED!>first<!> // synthetic property for getFirst()
|
||||
x.first() // stdlib extension on List
|
||||
x.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
x.<!FUNCTION_CALL_EXPECTED!>last<!>
|
||||
x.last()
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.MutableList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.MutableList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
y.addFirst("")
|
||||
y.addLast("")
|
||||
y.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
y.<!FUNCTION_CALL_EXPECTED!>first<!>
|
||||
y.first()
|
||||
y.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
y.<!FUNCTION_CALL_EXPECTED!>last<!>
|
||||
y.last()
|
||||
y.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
y.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
y.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
z.addFirst("")
|
||||
z.addLast("")
|
||||
z.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
z.<!FUNCTION_CALL_EXPECTED!>first<!>
|
||||
z.first()
|
||||
z.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
z.<!FUNCTION_CALL_EXPECTED!>last<!>
|
||||
z.last()
|
||||
z.<!DEBUG_INFO_CALL("fqName: A.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
z.<!DEBUG_INFO_CALL("fqName: A.removeLast; typeCall: function")!>removeLast()<!>
|
||||
z.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
}
|
||||
+32
-21
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-58371
|
||||
// WITH_STDLIB
|
||||
|
||||
@@ -11,8 +10,8 @@ class A<T> : ArrayList<T>() {
|
||||
super.addLast(t)
|
||||
}
|
||||
|
||||
override fun getFirst(): T = super.getFirst()
|
||||
override fun getLast(): T = super.getLast()
|
||||
override fun <!OVERRIDE_DEPRECATION!>getFirst<!>(): T = super.getFirst()
|
||||
override fun <!OVERRIDE_DEPRECATION!>getLast<!>(): T = super.getLast()
|
||||
|
||||
override fun removeFirst(): T = super.removeFirst()
|
||||
override fun removeLast(): T = super.removeLast()
|
||||
@@ -21,27 +20,39 @@ class A<T> : ArrayList<T>() {
|
||||
}
|
||||
|
||||
fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
|
||||
x.<!UNRESOLVED_REFERENCE!>addFirst<!>("")
|
||||
x.<!UNRESOLVED_REFERENCE!>addLast<!>("")
|
||||
x.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
x.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeFirst; typeCall: extension function")!>removeFirst()<!>
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeLast; typeCall: extension function")!>removeLast()<!>
|
||||
x.addFirst("")
|
||||
x.addLast("")
|
||||
x.<!DEPRECATION!>getFirst<!>()
|
||||
x.<!DEPRECATION!>first<!> // synthetic property for getFirst()
|
||||
x.first() // stdlib extension on List
|
||||
x.<!DEPRECATION!>getLast<!>()
|
||||
x.<!DEPRECATION!>last<!>
|
||||
x.last()
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.MutableList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.MutableList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
x.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
y.<!UNRESOLVED_REFERENCE!>addFirst<!>("")
|
||||
y.<!UNRESOLVED_REFERENCE!>addLast<!>("")
|
||||
y.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
y.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
y.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeFirst; typeCall: extension function")!>removeFirst()<!>
|
||||
y.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeLast; typeCall: extension function")!>removeLast()<!>
|
||||
y.addFirst("")
|
||||
y.addLast("")
|
||||
y.getFirst()
|
||||
y.first
|
||||
y.first()
|
||||
y.getLast()
|
||||
y.last
|
||||
y.last()
|
||||
y.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
y.<!DEBUG_INFO_CALL("fqName: java.util.ArrayList.removeLast; typeCall: function")!>removeLast()<!>
|
||||
y.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
|
||||
z.<!UNRESOLVED_REFERENCE!>addFirst<!>("")
|
||||
z.<!UNRESOLVED_REFERENCE!>addLast<!>("")
|
||||
z.<!UNRESOLVED_REFERENCE!>getFirst<!>()
|
||||
z.<!UNRESOLVED_REFERENCE!>getLast<!>()
|
||||
z.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeFirst; typeCall: extension function")!>removeFirst()<!>
|
||||
z.<!DEBUG_INFO_CALL("fqName: kotlin.collections.removeLast; typeCall: extension function")!>removeLast()<!>
|
||||
z.addFirst("")
|
||||
z.addLast("")
|
||||
z.getFirst()
|
||||
z.first
|
||||
z.first()
|
||||
z.getLast()
|
||||
z.last
|
||||
z.last()
|
||||
z.<!DEBUG_INFO_CALL("fqName: A.removeFirst; typeCall: function")!>removeFirst()<!>
|
||||
z.<!DEBUG_INFO_CALL("fqName: A.removeLast; typeCall: function")!>removeLast()<!>
|
||||
z.<!DEBUG_INFO_CALL("fqName: kotlin.collections.reversed; typeCall: extension function")!>reversed()<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user