Files
kotlin-fork/compiler/testData/diagnostics/testsWithJdk21/implementationsForSequencedCollection.kt
T
Denis.Zharkov 1e86a82ee1 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
2023-08-03 13:31:07 +00:00

51 lines
2.0 KiB
Kotlin
Vendored

// 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()<!>
}