New J2K: use nullable type for unknown for public declarations & prepare for mutability inference
#KT-32518 fixed
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
val t: T?
|
||||
val t: T
|
||||
get() {}
|
||||
@@ -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) })
|
||||
}
|
||||
}
|
||||
@@ -14,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) })
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
class Java8Class {
|
||||
fun foo0(r: Function0<String>) {}
|
||||
fun foo1(r: Function1<Int, String?>) {}
|
||||
fun foo2(r: Function2<Int, Int, String>) {}
|
||||
fun foo0(r: Function0<String?>?) {}
|
||||
fun foo1(r: Function1<Int, String?>?) {}
|
||||
fun foo2(r: Function2<Int?, Int?, String?>?) {}
|
||||
fun helper() {}
|
||||
fun foo() {
|
||||
foo0 { "42" }
|
||||
@@ -10,8 +10,8 @@ class Java8Class {
|
||||
helper()
|
||||
"42"
|
||||
}
|
||||
foo1 { i: Int -> "42" }
|
||||
foo1 { i: Int -> "42" }
|
||||
foo1 { i: Int? -> "42" }
|
||||
foo1 { i: Int? -> "42" }
|
||||
foo1 { i: Int ->
|
||||
helper()
|
||||
if (i > 1) {
|
||||
@@ -19,12 +19,12 @@ class Java8Class {
|
||||
}
|
||||
"43"
|
||||
}
|
||||
foo2 { i: Int, j: Int -> "42" }
|
||||
foo2 { i: Int, j: Int ->
|
||||
foo2 { i: Int?, j: Int? -> "42" }
|
||||
foo2 { i: Int?, j: Int? ->
|
||||
helper()
|
||||
"42"
|
||||
}
|
||||
val f = label@{ i: Int, k: Int ->
|
||||
val f: Function2<Int, Int, String> = label@{ i: Int, k: Int? ->
|
||||
helper()
|
||||
if (i > 1) {
|
||||
return@label "42"
|
||||
@@ -32,7 +32,7 @@ class Java8Class {
|
||||
"43"
|
||||
}
|
||||
val f1 = label@{ i1: Int, k1: Int ->
|
||||
val f2 = label@{ i2: Int, k2: Int ->
|
||||
val f2: Function2<Int, Int, String> = label@{ i2: Int, k2: Int? ->
|
||||
helper()
|
||||
if (i2 > 1) {
|
||||
return@label "42"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
fun main(): String? {}
|
||||
fun main(): String {}
|
||||
+3
-3
@@ -4,7 +4,7 @@ import java.util.stream.Collectors
|
||||
object TestLambda {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val names: List<String> = Arrays.asList("A", "B")
|
||||
val people: List<Person?> = names.stream().map { name: String -> Person(name) }.collect(Collectors.toList())
|
||||
val names = Arrays.asList("A", "B")
|
||||
val people = names.stream().map { name: String? -> Person(name) }.collect(Collectors.toList())
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package demo
|
||||
|
||||
internal class Test {
|
||||
fun test(vararg args: Any) {
|
||||
fun test(vararg args: Any?) {
|
||||
var args = args
|
||||
args = arrayOf(1, 2, 3)
|
||||
args = arrayOf<Int?>(1, 2, 3)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user