mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Kotlin: Add a Kotlin 2 copy of the testsuite
This commit is contained in:
32
java/ql/test-kotlin2/library-tests/java-map-methods/test.kt
Normal file
32
java/ql/test-kotlin2/library-tests/java-map-methods/test.kt
Normal file
@@ -0,0 +1,32 @@
|
||||
fun test(m: Map<Int, Int>) = m.getOrDefault(1, 2)
|
||||
|
||||
fun test2(s: String) = s.length
|
||||
|
||||
fun remove(l: MutableList<Int>) {
|
||||
l.remove(5)
|
||||
}
|
||||
|
||||
fun fn1(s: String) = s.plus(other = "")
|
||||
fun fn2(s: String) = s + ""
|
||||
|
||||
fun fn1(i: Int) = i.minus(10)
|
||||
fun fn2(i: Int) = i - 10
|
||||
|
||||
fun special(n: Number, m: Map<String, String>, s: String, l: MutableList<Int>) {
|
||||
s[1]
|
||||
s.get(1)
|
||||
n.toDouble()
|
||||
n.toByte()
|
||||
n.toChar()
|
||||
n.toFloat()
|
||||
n.toInt()
|
||||
n.toShort()
|
||||
m.keys
|
||||
m.values
|
||||
m.entries
|
||||
l.removeAt(1)
|
||||
m.entries.first().key
|
||||
m.entries.first().value
|
||||
}
|
||||
|
||||
// Diagnostic Matches: % Couldn't find a Java equivalent function to kotlin.Number.toChar in java.lang.Number %
|
||||
Reference in New Issue
Block a user