introduceValue() always adds statement before except for safe call case

This commit is contained in:
Valentin Kipyatkov
2016-10-23 01:36:36 +03:00
parent 8f9f2027f2
commit 330d3a255a
15 changed files with 163 additions and 53 deletions
@@ -0,0 +1,8 @@
fun String.<caret>f(p: Int) = hashCode() * p
fun f(s: String?) {
s?.f(1)
s?.substring(1)?.f(2)
val s1 = s?.f(3)
val s2 = s?.substring(1)?.f(4)
}
@@ -0,0 +1,11 @@
fun f(s: String?) {
if (s != null) {
s.hashCode() * 1
}
val substring = s?.substring(1)
if (substring != null) {
substring.hashCode() * 2
}
val s1 = s?.let { it.hashCode() * 3 }
val s2 = s?.substring(1)?.let { it.hashCode() * 4 }
}