New J2K: use nullable type for unknown for public declarations & prepare for mutability inference
#KT-32518 fixed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Test {
|
||||
fun foo() {
|
||||
val ss = Array</*T2@*/Array</*T1@*/String?>>(5/*LIT*/, { arrayOfNulls</*T0@*/String?>(5/*LIT*/)/*Array<T0@String!!U>!!L*/ }/*Function0<Int, T3@Array<T4@String>>!!L*/)
|
||||
val ss = Array</*T2@*/Array</*T1@*/String?>>(5/*LIT*/, { arrayOfNulls</*T0@*/String>(5/*LIT*/)/*Array<T0@String!!U>!!L*/ }/*Function0<Int, T3@Array<T4@String>>!!L*/)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun test() {
|
||||
val x: /*T2@*/Array</*T1@*/Int?> = arrayOfNulls</*T0@*/Int?>(10/*LIT*/)/*Array<T0@Int!!U>!!L*/
|
||||
val x: /*T2@*/Array</*T1@*/Int?> = arrayOfNulls</*T0@*/Int>(10/*LIT*/)/*Array<T0@Int!!U>!!L*/
|
||||
}
|
||||
|
||||
//T1 := UPPER due to 'INITIALIZER'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
open class A<T> {
|
||||
open fun foo(): /*T3@*/Map</*T0@*/T, /*T2@*/List</*T1@*/T>>? {
|
||||
open fun foo(): /*T3@*/Map</*T0@*/T, /*T2@*/List</*T1@*/T>?>? {
|
||||
TODO()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ open class A<T> {
|
||||
}
|
||||
|
||||
class B : A</*T10@*/Int>() {
|
||||
override fun foo(): /*T8@*/Map</*T5@*/Int, /*T7@*/List</*T6@*/Int>>? {
|
||||
override fun foo(): /*T8@*/Map</*T5@*/Int, /*T7@*/List</*T6@*/Int>?>? {
|
||||
return null/*NULL!!U*/
|
||||
}
|
||||
override fun bar(): /*T9@*/Int {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun b(m: /*T2@*/Map</*T0@*/Int, /*T1@*/String>): /*T3@*/String? {
|
||||
fun b(m: /*T2@*/Map</*T0@*/Int?, /*T1@*/String?>): /*T3@*/String? {
|
||||
return m/*T2@Map<T0@Int, T1@String>*/.get(42/*LIT*/)/*T1@String!!U*/
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun <T, E, F, S> foo(x: /*T0@*/T, y: /*T2@*/List</*T1@*/E>, z: /*T4@*/List</*T3@*/F>, a: /*T5@*/S) {}
|
||||
fun <T, E, F, S> foo(x: /*T0@*/T, y: /*T2@*/List</*T1@*/E>?, z: /*T4@*/List</*T3@*/F>?, a: /*T5@*/S) {}
|
||||
|
||||
fun bar() {
|
||||
val lst: /*T8@*/List</*T7@*/Int?> = listOf</*T6@*/Int?>(null/*NULL!!U*/)/*List<T6@Int>!!L*/
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
fun notNullParameters(f: /*T3@*/Function2</*T0@*/Int, /*T1@*/Int, /*T2@*/String>) {}
|
||||
fun nullableParameter(f: /*T7@*/Function2</*T4@*/Int?, /*T5@*/Int, /*T6@*/String>) {}
|
||||
fun nullableReturnType(f: /*T11@*/Function2</*T8@*/Int, /*T9@*/Int, /*T10@*/String?>) {}
|
||||
fun notNullParameters(f: /*T3@*/Function2</*T0@*/Int, /*T1@*/Int, /*T2@*/String?>?) {}
|
||||
fun nullableParameter(f: /*T7@*/Function2</*T4@*/Int?, /*T5@*/Int?, /*T6@*/String?>?) {}
|
||||
fun nullableReturnType(f: /*T11@*/Function2</*T8@*/Int, /*T9@*/Int?, /*T10@*/String?>?) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
@@ -8,11 +8,11 @@ fun test() {
|
||||
if (i/*T12@Int*/ < 10/*LIT*//*LIT*/ && j/*T13@Int*/ > 0/*LIT*//*LIT*//*LIT*/) ""/*LIT*/ else ""/*LIT*/
|
||||
}/*Function2<T12@Int, T13@Int, T18@String>!!L*/)
|
||||
|
||||
nullableParameter({ i: /*T14@*/Int?, j: /*T15@*/Int ->
|
||||
nullableParameter({ i: /*T14@*/Int?, j: /*T15@*/Int? ->
|
||||
if (i/*T14@Int*/ == null/*LIT*/) ""/*LIT*/ else ""/*LIT*/
|
||||
}/*Function2<T14@Int, T15@Int, T19@String>!!L*/)
|
||||
|
||||
nullableReturnType({ i: /*T16@*/Int, j: /*T17@*/Int ->
|
||||
nullableReturnType({ i: /*T16@*/Int, j: /*T17@*/Int? ->
|
||||
if (i/*T16@Int*/ < 10/*LIT*//*LIT*/) return@nullableReturnType null/*NULL!!U*/
|
||||
return@nullableReturnType "nya"/*LIT*/
|
||||
}/*Function2<T16@Int, T17@Int, T20@String>!!L*/)
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.stream.Stream
|
||||
fun test(list: /*T1@*/List</*T0@*/String>) {
|
||||
val x: /*T9@*/List</*T8@*/String> = list/*T1@List<T0@String>*/.stream()/*Stream<T0@String>!!L*/
|
||||
.map</*T3@*/String>({ x: /*T2@*/String -> x/*T2@String*/ + ""/*LIT*//*LIT*/ }/*Function1<T2@String, T10@String>!!L*/)/*Stream<T3@String>*/
|
||||
.collect</*T6@*/List</*T5@*/String>, /*T7@*/Any?>(Collectors/*LIT*/.toList</*T4@*/String>()/*Collector<T4@String, Any, MutableList<T4@String>>*/)/*T6@List<T5@String>*/
|
||||
.collect</*T6@*/List</*T5@*/String>, /*T7@*/Any>(Collectors/*LIT*/.toList</*T4@*/String>()/*Collector<T4@String, Any, MutableList<T4@String>>*/)/*T6@List<T5@String>*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
class Test {
|
||||
fun foo1(r: /*T2@*/Function1</*T0@*/Int, /*T1@*/String?>) {}
|
||||
fun foo1(r: /*T2@*/Function1</*T0@*/Int, /*T1@*/String?>?) {}
|
||||
fun foo() {
|
||||
foo1({ x: /*T3@*/Int -> ""/*LIT*/ }/*Function1<T3@Int, T5@String>!!L*/)
|
||||
foo1({ x: /*T3@*/Int? -> ""/*LIT*/ }/*Function1<T3@Int, T5@String>!!L*/)
|
||||
foo1({ i: /*T4@*/Int ->
|
||||
if (i/*T4@Int*/ > 1/*LIT*//*LIT*/) {
|
||||
return@foo1 null/*NULL!!U*/
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
fun test(a: /*T1@*/List</*T0@*/Int>) {
|
||||
for (i: /*T2@*/Int in a/*T1@List<T0@Int>*/) {
|
||||
fun test(a: /*T1@*/List</*T0@*/Int?>) {
|
||||
for (i: /*T2@*/Int? in a/*T1@List<T0@Int>*/) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun bar(map: /*T2@*/HashMap</*T0@*/String?, /*T1@*/Int>, list1: /*T4@*/List</*T3@*/Int>, list2: /*T6@*/List</*T5@*/String?>) {
|
||||
fun bar(map: /*T2@*/HashMap</*T0@*/String?, /*T1@*/Int>, list1: /*T4@*/List</*T3@*/Int?>, list2: /*T6@*/List</*T5@*/String?>) {
|
||||
for (entry: /*T9@*/MutableMap.MutableEntry</*T7@*/String?, /*T8@*/Int> in map/*T2@HashMap<T0@String, T1@Int>*/.entries/*MutableSet<MutableEntry<T0@String, T1@Int>>*/) {
|
||||
val value: /*T10@*/Int = entry/*T9@MutableEntry<T7@String, T8@Int>*/.value/*T8@Int*/
|
||||
if (entry/*T9@MutableEntry<T7@String, T8@Int>*/.key/*T7@String*/ == null/*LIT*/) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fun a(lst: /*T1@*/List</*T0@*/String>) {
|
||||
val newList: /*T8@*/List</*T7@*/Int> = lst/*T1@List<T0@String>*/
|
||||
.asSequence</*T2@*/String>()/*Sequence<T2@String>!!L*/
|
||||
.map</*T4@*/String, /*T5@*/Int>({ x: /*T3@*/String -> 1/*LIT*/ }/*Function1<T3@String, T9@Int>!!L*/)/*Sequence<T5@Int>!!L*/
|
||||
.map</*T4@*/String, /*T5@*/Int>({ x: /*T3@*/String? -> 1/*LIT*/ }/*Function1<T3@String, T9@Int>!!L*/)/*Sequence<T5@Int>!!L*/
|
||||
.toList</*T6@*/Int>()/*List<T6@Int>!!L*/
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
open class A<T> {
|
||||
open fun foo(): /*T3@*/Map</*T0@*/T, /*T2@*/List</*T1@*/T>> {
|
||||
open fun foo(): /*T3@*/Map</*T0@*/T, /*T2@*/List</*T1@*/T>?>? {
|
||||
TODO()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ open class A<T> {
|
||||
}
|
||||
|
||||
class B : A</*T9@*/Int>() {
|
||||
override fun foo(): /*T8@*/Map</*T5@*/Int, /*T7@*/List</*T6@*/Int>> {
|
||||
override fun foo(): /*T8@*/Map</*T5@*/Int, /*T7@*/List</*T6@*/Int>?>? {
|
||||
TODO()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
open class A<T> {
|
||||
open fun foo(x: /*T1@*/List</*T0@*/T>, y: /*T2@*/Boolean, z: /*T3@*/T) {
|
||||
open fun foo(x: /*T1@*/List</*T0@*/T>?, y: /*T2@*/Boolean?, z: /*T3@*/T) {
|
||||
TODO()
|
||||
}
|
||||
}
|
||||
|
||||
class B : A</*T8@*/Int>() {
|
||||
override fun foo(x: /*T5@*/List</*T4@*/Int>, y: /*T6@*/Boolean, z: /*T7@*/Int) {
|
||||
class B : A</*T8@*/Int?>() {
|
||||
override fun foo(x: /*T5@*/List</*T4@*/Int?>?, y: /*T6@*/Boolean?, z: /*T7@*/Int?) {
|
||||
TODO()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user