New J2K: add support of lambda expressions in nullabilityAnalysis

This commit is contained in:
Ilya Kirillov
2019-04-22 14:31:30 +03:00
parent 1ffe07bb6c
commit 7e7e8f7631
8 changed files with 130 additions and 17 deletions
+19
View File
@@ -0,0 +1,19 @@
fun notNullParameters(f: Function2<Int, Int, String>) {}
fun nullableParameter(f: Function2<Int, Int, String>) {}
fun nullableReturnType(f: Function2<Int, Int, String>) {}
fun test() {
notNullParameters({ i: Int, j: Int ->
if (i < 10 && j > 0) "" else ""
})
nullableParameter({ i: Int, j: Int ->
if (i == null) "" else ""
})
nullableReturnType({ i: Int, j: Int ->
if (i < 10) return@nullableReturnType null
return@nullableReturnType "nya"
})
}
+19
View File
@@ -0,0 +1,19 @@
fun notNullParameters(f: Function2<Int, Int, String>) {}
fun nullableParameter(f: Function2<Int?, Int, String>) {}
fun nullableReturnType(f: Function2<Int, Int, String?>) {}
fun test() {
notNullParameters({ i: Int, j: Int ->
if (i < 10 && j > 0) "" else ""
})
nullableParameter({ i: Int?, j: Int ->
if (i == null) "" else ""
})
nullableReturnType({ i: Int, j: Int ->
if (i < 10) return@nullableReturnType null
return@nullableReturnType "nya"
})
}