Skip to content

Commit 1aae3c5

Browse files
committed
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.
1 parent e64a8bc commit 1aae3c5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

java/ql/test/kotlin/library-tests/dataflow/whenexpr/WhenExpr.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
class WhenExpr {
22
fun taint() = Uri()
33

4-
fun sink(s: String) { }
4+
fun sink(s: String?) { }
55

6-
fun bad() {
7-
val s0 = taint()
6+
fun bad(b: Boolean) {
7+
val s0 = if (b) taint() else null
88
sink(s0?.getQueryParameter())
99
}
1010
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| WhenExpr.kt:7:14:7:20 | taint(...) | WhenExpr.kt:8:14:8:32 | <Stmt> |
1+
| WhenExpr.kt:7:21:7:27 | taint(...) | WhenExpr.kt:8:14:8:32 | <Stmt> |

0 commit comments

Comments
 (0)