J2K: inlining intermediate variable after removing type cast

This commit is contained in:
Valentin Kipyatkov
2015-03-26 14:17:52 +03:00
parent e31648a4b6
commit fb4075cc2f
6 changed files with 53 additions and 7 deletions
@@ -0,0 +1,11 @@
import java.lang.String;
class C {
void foo(Object o) {
if (o instanceof String) {
String s = (String) o;
int l = s.length();
String substring = s.substring(l - 2);
}
}
}
@@ -0,0 +1,8 @@
class C {
fun foo(o: Any) {
if (o is String) {
val l = o.length()
val substring = o.substring(l - 2)
}
}
}