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:
Denis.Zharkov
2023-07-28 13:58:52 +02:00
committed by Space Team
parent d99f8ac9b4
commit 1e86a82ee1
8 changed files with 216 additions and 28 deletions
@@ -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()<!>
}