Files
codeql/java/ql/test/kotlin/library-tests/dataflow/whenexpr/WhenExpr.kt
Chris Smowton 1aae3c5f5e Fix whenexpr test
Prior to Kotlin 1.7 the gratuitous `?` was ignored for typing purposes; now it yields a `String?`. We should make the test work everywhere by using a real nullable type.
2022-06-23 15:34:40 +01:00

15 lines
225 B
Kotlin

class WhenExpr {
fun taint() = Uri()
fun sink(s: String?) { }
fun bad(b: Boolean) {
val s0 = if (b) taint() else null
sink(s0?.getQueryParameter())
}
}
class Uri {
fun getQueryParameter() = "tainted"
}