[FIR] Implement deprecation for calls to overrides of hidden

#KT-65438
This commit is contained in:
Kirill Rakhman
2024-02-06 11:02:37 +01:00
committed by Space Team
parent e16f80c578
commit c6b2675089
12 changed files with 173 additions and 59 deletions
@@ -1,11 +1,11 @@
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.<!DEPRECATION!>getFirst<!>()
ll.<!DEPRECATION!>first<!> // synthetic property for getFirst()
ll.first() // stdlib extension on List
ll.getLast()
ll.last
ll.<!DEPRECATION!>getLast<!>()
ll.<!DEPRECATION!>last<!>
ll.last()
ll.removeFirst()
ll.removeLast()
@@ -13,11 +13,11 @@ fun foo(ll: java.util.LinkedList<String>, al: ArrayList<String>, ad: ArrayDeque<
al.addFirst("")
al.addLast("")
al.getFirst()
al.first
al.<!DEPRECATION!>getFirst<!>()
al.<!DEPRECATION!>first<!>
al.first()
al.getLast()
al.last
al.<!DEPRECATION!>getLast<!>()
al.<!DEPRECATION!>last<!>
al.last()
al.removeFirst()
al.removeLast()
@@ -46,4 +46,4 @@ fun foo(ll: java.util.LinkedList<String>, al: ArrayList<String>, ad: ArrayDeque<
jad.removeFirst()
jad.removeLast()
jad.reversed()
}
}
@@ -1,3 +1,7 @@
/newListMethods.fir.kt:(253,261): warning: 'fun getFirst(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(302,309): warning: 'fun getLast(): T!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(596,604): error: Unresolved reference 'getFirst'.
/newListMethods.fir.kt:(613,618): error: Function invocation 'first()' expected.
@@ -5,3 +9,19 @@
/newListMethods.fir.kt:(704,711): error: Unresolved reference 'getLast'.
/newListMethods.fir.kt:(720,724): error: Function invocation 'last()' expected.
/newListMethods.fir.kt:(838,846): warning: 'fun getFirst(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(855,860): warning: 'val first: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(881,888): warning: 'fun getLast(): String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(897,901): warning: 'val last: String!' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(1015,1023): warning: 'fun getFirst(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(1032,1037): warning: 'val first: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'first()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(1058,1065): warning: 'fun getLast(): String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access.
/newListMethods.fir.kt:(1074,1078): warning: 'val last: String' is deprecated. This declaration will be renamed in a future version of Kotlin. Please consider using the 'last()' stdlib extension if the collection supports fast random access.
@@ -10,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 getFirst(): T = super.<!DEPRECATION!>getFirst<!>()
override fun getLast(): T = super.<!DEPRECATION!>getLast<!>()
override fun removeFirst(): T = super.removeFirst()
override fun removeLast(): T = super.removeLast()
@@ -34,11 +34,11 @@ fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
y.addFirst("")
y.addLast("")
y.getFirst()
y.first
y.<!DEPRECATION!>getFirst<!>()
y.<!DEPRECATION!>first<!>
y.first()
y.getLast()
y.last
y.<!DEPRECATION!>getLast<!>()
y.<!DEPRECATION!>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()<!>
@@ -46,11 +46,11 @@ fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
z.addFirst("")
z.addLast("")
z.getFirst()
z.first
z.<!DEPRECATION!>getFirst<!>()
z.<!DEPRECATION!>first<!>
z.first()
z.getLast()
z.last
z.<!DEPRECATION!>getLast<!>()
z.<!DEPRECATION!>last<!>
z.last()
z.<!DEBUG_INFO_CALL("fqName: A.removeFirst; typeCall: function")!>removeFirst()<!>
z.<!DEBUG_INFO_CALL("fqName: A.removeLast; typeCall: function")!>removeLast()<!>