KT-7695 Java to Kotlin converter incorrectly generates a cast to non-nullable type

#KT-7695 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-06-03 22:15:22 +03:00
parent 1fa777f3c3
commit 6e7fd19d8e
5 changed files with 41 additions and 2 deletions
@@ -0,0 +1,12 @@
class A {
private String foo(Object o, boolean b) {
if (b) return (String) o;
return "";
}
void bar() {
if (foo(null, true) == null) {
System.out.println("null");
}
}
}
@@ -0,0 +1,12 @@
class A {
private fun foo(o: Any?, b: Boolean): String? {
if (b) return o as String?
return ""
}
fun bar() {
if (foo(null, true) == null) {
println("null")
}
}
}