Null-aware types introduced
Flexible types should drive their own conversions to nullable/not-null
This commit is contained in:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user