New J2K: separate nullability inference from common one & nullability bug fixes

It will be needed for structure mutability inference

#KT-21467 fixed
#KT-32609 fixed
#KT-32572 fixed
#KT-24677 fixed
This commit is contained in:
Ilya Kirillov
2019-07-25 00:31:50 +03:00
parent d7960caf89
commit 2bd5a1f196
234 changed files with 3940 additions and 1983 deletions
@@ -11,6 +11,6 @@ internal class Test {
fun nya(): Double {
//TODO explicitlly call apply here
return foo(1, FunctionalI<Int, Double> { x: Int -> this.toDouble(x) })
return foo(1, FunctionalI<Int?, Double?> { x: Int -> this.toDouble(x) })
}
}
@@ -1,4 +1,3 @@
// ERROR: Type mismatch: inferred type is B? but B was expected
// ERROR: Unresolved reference: A
// ERROR: Interface FunctionalI does not have constructors
internal interface FunctionalI<A, B> {
@@ -6,7 +5,7 @@ internal interface FunctionalI<A, B> {
}
internal class Test {
fun <A, B> foo(value: A, `fun`: FunctionalI<A?, B?>): B {
fun <A, B> foo(value: A, `fun`: FunctionalI<A, B>): B {
return `fun`.apply(value)
}
@@ -15,6 +14,6 @@ internal class Test {
}
fun nya(): Double {
return foo(1, FunctionalI<Int, Double> { x: A -> this.toDouble(x) })
return foo(1, FunctionalI<Int?, Double?> { x: A -> this.toDouble(x) })
}
}
+1 -1
View File
@@ -1 +1 @@
fun <U> putU(u: U?) {}
fun <U> putU(u: U) {}
+1 -1
View File
@@ -1 +1 @@
fun <U, V, W> putUVW(u: U?, v: V?, w: W?) {}
fun <U, V, W> putUVW(u: U, v: V, w: W) {}