Null-aware types introduced

Flexible types should drive their own conversions to nullable/not-null
This commit is contained in:
Andrey Breslav
2014-08-26 16:07:23 +04:00
parent 969beb7898
commit 220c360081
10 changed files with 122 additions and 23 deletions
@@ -0,0 +1,19 @@
// FILE: p/Utils.java
package p;
public class Utils {
public static java.util.Collection<String> c() { return null; }
}
// FILE: k.kt
import p.*
fun <T : Any> T.foo() {}
fun test<D>(b: Boolean) {
val c = if (b) Utils.c() else null
c?.foo()
}
@@ -0,0 +1,19 @@
// FILE: p/Utils.java
package p;
public class Utils {
public static String str() { return null; }
}
// FILE: k.kt
import p.*
fun <T : Any> T.foo() {}
fun test<D>(b: Boolean) {
val str = if (b) Utils.str() else null
str?.foo()
}