Skip to content

Commit

Permalink
[Test] Add tests for KT-65438
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandra-Arsenteva authored and Space Team committed Mar 20, 2024
1 parent 3b68525 commit 85efbe5
Show file tree
Hide file tree
Showing 11 changed files with 182 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import java.lang.invoke.MethodHandles

fun test(short: Short, long: Long, float: Float,
string: String, char: Char, collection: Collection<Any>,
double: Double, boolean: Boolean, list: List<Any>,
int: Int, byte: Byte, enumType: MyEnum){
val x : MethodHandles.Lookup = null!!

short.<!UNRESOLVED_REFERENCE!>describeConstable<!>()

long.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
long.<!UNRESOLVED_REFERENCE!>resolveConstantDesc<!>(x)

float.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
float.<!UNRESOLVED_REFERENCE!>resolveConstantDesc<!>(x)

string.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
string.<!UNRESOLVED_REFERENCE!>resolveConstantDesc<!>(x)
string.indexOf(<!ARGUMENT_TYPE_MISMATCH!>1<!>,1,<!ARGUMENT_TYPE_MISMATCH!>1<!>)
string.indexOf(<!ARGUMENT_TYPE_MISMATCH!>""<!>, 1,<!ARGUMENT_TYPE_MISMATCH!>2<!>)
string.<!UNRESOLVED_REFERENCE!>splitWithDelimiters<!>("", 1)
string.<!UNRESOLVED_REFERENCE!>strip<!>()
string.<!UNRESOLVED_REFERENCE!>stripLeading<!>()
string.<!UNRESOLVED_REFERENCE!>stripTrailing<!>()
string.<!UNRESOLVED_REFERENCE!>indent<!>(1)
string.<!UNRESOLVED_REFERENCE!>stripIndent<!>()
string.<!UNRESOLVED_REFERENCE!>translateEscapes<!>()
string.<!UNRESOLVED_REFERENCE!>transform<!>({})
string.<!UNRESOLVED_REFERENCE!>formatted<!>()

char.<!UNRESOLVED_REFERENCE!>describeConstable<!>()

collection.<!UNRESOLVED_REFERENCE!>toArray<!> {_: Int -> arrayOf(1)}

double.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
double.<!UNRESOLVED_REFERENCE!>resolveConstantDesc<!>(x)

boolean.<!UNRESOLVED_REFERENCE!>describeConstable<!>()

list.<!UNRESOLVED_REFERENCE!>getFirst<!>()
list.<!UNRESOLVED_REFERENCE!>getLast<!>()

int.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
int.<!UNRESOLVED_REFERENCE!>resolveConstantDesc<!>(x)

byte.<!UNRESOLVED_REFERENCE!>describeConstable<!>()

enumType.<!UNRESOLVED_REFERENCE!>describeConstable<!>()
}

enum class MyEnum
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import java.lang.invoke.MethodHandles

fun test(short: Short, long: Long, float: Float,
string: String, char: Char, collection: Collection<Any>,
double: Double, boolean: Boolean, list: List<Any>,
int: Int, byte: Byte, enumType: MyEnum){
val x : MethodHandles.Lookup = null!!

short.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()

long.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()
long.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>resolveConstantDesc<!>(x)

float.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()
float.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>resolveConstantDesc<!>(x)

string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>resolveConstantDesc<!>(x)
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>indexOf<!>(1,1,1)
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>indexOf<!>("", 1,2)
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>splitWithDelimiters<!>("", 1)
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>strip<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>stripLeading<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>stripTrailing<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>indent<!>(1)
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>stripIndent<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>translateEscapes<!>()
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>transform<!>({})
string.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>formatted<!>()

char.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()

collection.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>toArray<!> {_: Int -> arrayOf(1)}

double.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()
double.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>resolveConstantDesc<!>(x)

boolean.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()

list.<!UNRESOLVED_REFERENCE!>getFirst<!>()
list.<!UNRESOLVED_REFERENCE!>getLast<!>()

int.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()
int.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>resolveConstantDesc<!>(x)

byte.<!DEPRECATION, JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE!>describeConstable<!>()

enumType.<!DEPRECATION!>describeConstable<!>()
}

enum class MyEnum
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
/newListMethods.kt:39:7: error: unresolved reference: getFirst
/newListMethods.kt:38:22: error: unresolved reference: getFirst
return super.getFirst()
^^^^^^^^
/newListMethods.kt:42:22: error: unresolved reference: getLast
return super.getLast()
^^^^^^^
/newListMethods.kt:49:7: error: unresolved reference: getFirst
x.getFirst()
^^^^^^^^
/newListMethods.kt:40:7: error: using 'getter for first: E!' is an error. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
/newListMethods.kt:50:7: error: using 'getter for first: E!' is an error. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
x.first // synthetic property for getFirst()
^^^^^
/newListMethods.kt:42:7: error: unresolved reference: getLast
/newListMethods.kt:52:7: error: unresolved reference: getLast
x.getLast()
^^^^^^^
/newListMethods.kt:43:7: error: using 'getter for last: E!' is an error. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
/newListMethods.kt:53:7: error: using 'getter for last: E!' is an error. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
x.last
^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,34 @@

/newListMethods.fir.kt:(955,962): warning: 'fun <T : Any!> toArray(p0: IntFunction<(Array<T!>..Array<out T!>?)>!): (Array<T!>..Array<out T!>?)' is deprecated. This declaration is redundant in Kotlin and might be removed soon.

/newListMethods.fir.kt:(1096,1104): error: Unresolved reference 'getFirst'.
/newListMethods.fir.kt:(1031,1039): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic.

/newListMethods.fir.kt:(1113,1118): error: Function invocation 'first()' expected.
/newListMethods.fir.kt:(1068,1076): 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:(1204,1211): error: Unresolved reference 'getLast'.
/newListMethods.fir.kt:(1103,1110): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic.

/newListMethods.fir.kt:(1220,1224): error: Function invocation 'last()' expected.
/newListMethods.fir.kt:(1138,1145): 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:(1338,1346): 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:(1270,1278): error: Unresolved reference 'getFirst'.

/newListMethods.fir.kt:(1355,1360): 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:(1287,1292): error: Function invocation 'first()' expected.

/newListMethods.fir.kt:(1381,1388): 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:(1378,1385): error: Unresolved reference 'getLast'.

/newListMethods.fir.kt:(1397,1401): 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:(1394,1398): error: Function invocation 'last()' expected.

/newListMethods.fir.kt:(1515,1523): 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:(1512,1520): 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:(1532,1537): 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:(1529,1534): 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:(1558,1565): 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:(1555,1562): 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:(1574,1578): 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:(1571,1575): 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:(1689,1697): 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:(1706,1711): 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:(1732,1739): 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:(1748,1752): 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.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ class A<T> : ArrayList<T>() {
}
}

abstract class B<T>: List<T> {
override fun <!OVERRIDE_DEPRECATION!>getFirst<!>(): T {
return super.<!DEPRECATION!>getFirst<!>()
}

override fun <!OVERRIDE_DEPRECATION!>getLast<!>(): T{
return super.<!DEPRECATION!>getLast<!>()
}
}

fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
x.addFirst("")
x.addLast("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ class A<T> : ArrayList<T>() {
}
}

abstract class B<T>: List<T> {
override fun <!OVERRIDE_DEPRECATION!>getFirst<!>(): T {
return super.<!UNRESOLVED_REFERENCE!>getFirst<!>()
}

override fun <!OVERRIDE_DEPRECATION!>getLast<!>(): T{
return super.<!UNRESOLVED_REFERENCE!>getLast<!>()
}
}

fun foo(x: MutableList<String>, y: ArrayList<String>, z: A<String>) {
x.addFirst("")
x.addLast("")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 85efbe5

Please sign in to comment.