Improve inference on generics for callable references

#KT-10711 Fixed
 #KT-12802 Fixed
 #KT-12964 Fixed
 #KT-15439 Fixed

Analyze callable references in `dependent` mode, then complete them with
respect to expected types
This commit is contained in:
Mikhail Zarechenskiy
2017-01-17 02:30:16 +03:00
parent 07bb7ef4d3
commit 2cac6a9e7d
50 changed files with 938 additions and 22 deletions
@@ -0,0 +1,36 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
fun <T, R> foo(x: T): R = TODO()
fun <T> fooReturnInt(x: T): Int = 1
fun <T> fooTakeString(x: String): T = TODO()
fun <T, R> bar(x: T, y: R, f: (T) -> R): Pair<T, R> = TODO()
fun <T, R> baz(f: (T) -> R, g: (T) -> R): Pair<T, R> = TODO()
class Pair<A, B>(val a: A, val b: B)
fun test1() {
bar("", 1, ::foo).checkType { _<Pair<String, Int>>() }
bar("", 1, ::fooReturnInt).checkType { _<Pair<String, Int>>() }
bar("", 1, ::fooTakeString).checkType { _<Pair<String, Int>>() }
bar("", "", ::fooReturnInt).checkType { _<Pair<String, Any>>() }
val x: String = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>bar("", "", ::fooReturnInt)<!>
baz(Int::toString, ::foo).checkType { _<Pair<Int, String>>() }
}
fun <T> listOf(): List<T> = TODO()
fun <T> setOf(): Set<T> = TODO()
fun <T> test2(x: T) {
bar(x, x, ::foo).checkType { _<Pair<T, T>>() }
bar(x, 1, ::foo).checkType { _<Pair<T, Int>>() }
bar(1, x, ::foo).checkType { _<Pair<Int, T>>() }
bar(listOf<T>(), setOf<T>(), ::foo).checkType { _<Pair<List<T>, Set<T>>> () }
bar(listOf<T>(), 1, ::foo).checkType { _<Pair<List<T>, Int>>() }
bar(1, listOf<T>(), ::foo).checkType { _<Pair<Int, List<T>>>() }
}
@@ -0,0 +1,20 @@
package
public fun </*0*/ T, /*1*/ R> bar(/*0*/ x: T, /*1*/ y: R, /*2*/ f: (T) -> R): Pair<T, R>
public fun </*0*/ T, /*1*/ R> baz(/*0*/ f: (T) -> R, /*1*/ g: (T) -> R): Pair<T, R>
public fun </*0*/ T, /*1*/ R> foo(/*0*/ x: T): R
public fun </*0*/ T> fooReturnInt(/*0*/ x: T): kotlin.Int
public fun </*0*/ T> fooTakeString(/*0*/ x: kotlin.String): T
public fun </*0*/ T> listOf(): kotlin.collections.List<T>
public fun </*0*/ T> setOf(): kotlin.collections.Set<T>
public fun test1(): kotlin.Unit
public fun </*0*/ T> test2(/*0*/ x: T): kotlin.Unit
public final class Pair</*0*/ A, /*1*/ B> {
public constructor Pair</*0*/ A, /*1*/ B>(/*0*/ a: A, /*1*/ b: B)
public final val a: A
public final val b: B
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Case<T>
fun <T> test(case: Case<T>) {}
fun runTest(method: (Case<Any>) -> Unit) {}
fun <T> runTestGeneric(f: (Case<T>) -> Unit) {}
fun test() {
runTest(::test)
runTestGeneric<Int>(::test)
}
@@ -0,0 +1,13 @@
package
public fun runTest(/*0*/ method: (Case<kotlin.Any>) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> runTestGeneric(/*0*/ f: (Case<T>) -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public fun </*0*/ T> test(/*0*/ case: Case<T>): kotlin.Unit
public final class Case</*0*/ T> {
public constructor Case</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: A.java
public class A {
public static void invokeLater(Runnable doRun) {
}
}
// FILE: 1.kt
fun <T> foo(t: T, x: (() -> Unit) -> Unit) {}
fun <T> bar(s: T) {}
fun <T> complex(t: T, f: (T) -> Unit) {}
fun test1() {
foo(1, A::invokeLater)
foo(1, ::bar)
complex(1, ::bar)
}
fun <R> test2(x: R) {
foo(x, A::invokeLater)
foo(x, ::bar)
complex(x, ::bar)
}
@@ -0,0 +1,18 @@
package
public fun </*0*/ T> bar(/*0*/ s: T): kotlin.Unit
public fun </*0*/ T> complex(/*0*/ t: T, /*1*/ f: (T) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> foo(/*0*/ t: T, /*1*/ x: (() -> kotlin.Unit) -> kotlin.Unit): kotlin.Unit
public fun test1(): kotlin.Unit
public fun </*0*/ R> test2(/*0*/ x: R): kotlin.Unit
public open class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun invokeLater(/*0*/ doRun: (() -> kotlin.Unit)!): kotlin.Unit
public open fun invokeLater(/*0*/ doRun: java.lang.Runnable!): kotlin.Unit
}
@@ -0,0 +1,24 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A1 {
fun <T> a1(t: T): Unit {}
fun test1(): (String) -> Unit = A1()::a1
}
class A2 {
fun <K, V> a2(key: K): V = TODO()
fun test1(): (String) -> Unit = A2()::a2
fun <T3> test2(): (T3) -> T3 = A2()::a2
}
class A3<T> {
fun <V> a3(key: T): V = TODO()
fun test1(): (T) -> Int = this::a3
fun test2(): (T) -> Unit = A3<T>()::a3
fun test3(): (Int) -> String = A3<Int>()::a3
fun <R> test4(): (R) -> Unit = <!TYPE_MISMATCH!>this::<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>a3<!><!>
fun <R> test5(): (T) -> R = this::a3
}
@@ -0,0 +1,33 @@
package
public final class A1 {
public constructor A1()
public final fun </*0*/ T> a1(/*0*/ t: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun test1(): (kotlin.String) -> kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class A2 {
public constructor A2()
public final fun </*0*/ K, /*1*/ V> a2(/*0*/ key: K): V
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun test1(): (kotlin.String) -> kotlin.Unit
public final fun </*0*/ T3> test2(): (T3) -> T3
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class A3</*0*/ T> {
public constructor A3</*0*/ T>()
public final fun </*0*/ V> a3(/*0*/ key: T): V
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun test1(): (T) -> kotlin.Int
public final fun test2(): (T) -> kotlin.Unit
public final fun test3(): (kotlin.Int) -> kotlin.String
public final fun </*0*/ R> test4(): (R) -> kotlin.Unit
public final fun </*0*/ R> test5(): (T) -> R
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,24 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
fun <T> takeFun(f: (T) -> Unit) {}
fun <T, R> callFun(f: (T) -> R): R = TODO()
fun <T> foo(s: T) {}
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> fooInt(s: T) {}
open class Wrapper<T>(val value: T)
fun <T, R : Wrapper<in T>> createWrapper(s: T): R = TODO()
fun <T> Wrapper<T>.baz(transform: (T) -> Unit): T = TODO()
fun test() {
takeFun<String>(::foo)
takeFun<String>(::<!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>fooInt<!>)
callFun<String, Wrapper<String>>(::createWrapper)
callFun<Int, Wrapper<Number>>(::createWrapper)
callFun<String, Wrapper<*>>(::createWrapper)
callFun<String, Wrapper<Int>>(::<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>createWrapper<!>)
callFun<Int, Wrapper<Int>>(::createWrapper).baz(::foo)
}
@@ -0,0 +1,17 @@
package
public fun </*0*/ T, /*1*/ R> callFun(/*0*/ f: (T) -> R): R
public fun </*0*/ T, /*1*/ R : Wrapper<in T>> createWrapper(/*0*/ s: T): R
public fun </*0*/ T> foo(/*0*/ s: T): kotlin.Unit
public fun </*0*/ T : kotlin.Int> fooInt(/*0*/ s: T): kotlin.Unit
public fun </*0*/ T> takeFun(/*0*/ f: (T) -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public fun </*0*/ T> Wrapper<T>.baz(/*0*/ transform: (T) -> kotlin.Unit): T
public open class Wrapper</*0*/ T> {
public constructor Wrapper</*0*/ T>(/*0*/ value: T)
public final val value: T
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,30 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
class Wrapper
fun <R, S> Wrapper.foo(x: R): S = TODO()
fun Wrapper.fooIntString(x: Int): String = ""
fun <T> Wrapper.fooReturnString(x: T): String = ""
fun <T> Wrapper.fooTakeInt(x: Int): T = TODO()
fun <T, R, S> bar(f: T.(R) -> S): Tripple<T, R, S> = TODO()
fun <T, R, S> baz(x: T, y: R, z: S, f: T.(R) -> S): Tripple<T, R, S> = TODO()
class Tripple<A, B, C>(val a: A, val b: B, val c: C)
fun test1() {
val x: Wrapper.(String) -> Boolean = Wrapper::foo
bar<Wrapper, Double, Float>(Wrapper::foo).checkType { _<Tripple<Wrapper, Double, Float>>() }
bar(Wrapper::fooIntString).checkType { _<Tripple<Wrapper, Int, String>>() }
}
fun <T> test2() {
bar<Wrapper, Int, String>(Wrapper::fooReturnString).checkType { _<Tripple<Wrapper, Int, String>>() }
bar<Wrapper, T, String>(Wrapper::fooReturnString).checkType { _<Tripple<Wrapper, T, String>>() }
bar<Wrapper, T, T>(Wrapper::<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>fooReturnString<!>)
bar<Wrapper, Int, Int>(Wrapper::<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>fooReturnString<!>)
bar<Wrapper, Int, T>(Wrapper::fooTakeInt).checkType { _<Tripple<Wrapper, Int, T>>() }
bar<Wrapper, Int, String>(Wrapper::fooTakeInt).checkType { _<Tripple<Wrapper, Int, String>>() }
}
@@ -0,0 +1,27 @@
package
public fun </*0*/ T, /*1*/ R, /*2*/ S> bar(/*0*/ f: T.(R) -> S): Tripple<T, R, S>
public fun </*0*/ T, /*1*/ R, /*2*/ S> baz(/*0*/ x: T, /*1*/ y: R, /*2*/ z: S, /*3*/ f: T.(R) -> S): Tripple<T, R, S>
public fun test1(): kotlin.Unit
public fun </*0*/ T> test2(): kotlin.Unit
public fun </*0*/ R, /*1*/ S> Wrapper.foo(/*0*/ x: R): S
public fun Wrapper.fooIntString(/*0*/ x: kotlin.Int): kotlin.String
public fun </*0*/ T> Wrapper.fooReturnString(/*0*/ x: T): kotlin.String
public fun </*0*/ T> Wrapper.fooTakeInt(/*0*/ x: kotlin.Int): T
public final class Tripple</*0*/ A, /*1*/ B, /*2*/ C> {
public constructor Tripple</*0*/ A, /*1*/ B, /*2*/ C>(/*0*/ a: A, /*1*/ b: B, /*2*/ c: C)
public final val a: A
public final val b: B
public final val c: C
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Wrapper {
public constructor Wrapper()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,36 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun <T, R> foo(x: T): R = TODO()
fun <T, R> bar(x: T, y: R, f: (T) -> R): Pair<T, R?> = TODO()
inline fun <reified T, reified R> baz(x: T, y: R, f: (T) -> R) {}
data class Pair<A, B>(val a: A, val b: B)
fun <T> test(x: T) {
bar(1, "", ::foo).checkType { _<Pair<Int, String?>>() }
bar(null, "", ::foo).checkType { _<Pair<Nothing?, String?>>() }
bar(1, null, ::foo).checkType { _<Pair<Int, Nothing?>>() }
bar(null, null, ::foo).checkType { _<Pair<Nothing?, Nothing?>>() }
bar(1, x, ::foo).checkType { _<Pair<Int, T?>>() }
val s1: Pair<Int, String?> = bar(1, "", ::foo)
val (a: Int, b: String?) = bar(1, "", ::foo)
val s2: Pair<Int?, String?> = bar(null, null, ::foo)
baz<Int?, String?>(null, null, ::foo)
baz<Int, String?>(<!NULL_FOR_NONNULL_TYPE!>null<!>, null, ::foo)
baz<Int?, String>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>, ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(null, "", ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(1, null, ::foo)
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>baz<!>(null, null, ::foo)
val s3: Pair<Int, String?> = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>bar(null, null, ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>)<!>
val s4: Pair<Int?, String> = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>bar(null, null, ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>)<!>
val s5: Pair<Int, String> = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>bar(1, "", ::foo)<!>
val (a1: Int, b1: String) = <!COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH!>bar(1, "", ::foo)<!>
}
@@ -0,0 +1,18 @@
package
public fun </*0*/ T, /*1*/ R> bar(/*0*/ x: T, /*1*/ y: R, /*2*/ f: (T) -> R): Pair<T, R?>
public inline fun </*0*/ reified T, /*1*/ reified R> baz(/*0*/ x: T, /*1*/ y: R, /*2*/ f: (T) -> R): kotlin.Unit
public fun </*0*/ T, /*1*/ R> foo(/*0*/ x: T): R
public fun </*0*/ T> test(/*0*/ x: T): kotlin.Unit
public final data class Pair</*0*/ A, /*1*/ B> {
public constructor Pair</*0*/ A, /*1*/ B>(/*0*/ a: A, /*1*/ b: B)
public final val a: A
public final val b: B
public final operator /*synthesized*/ fun component1(): A
public final operator /*synthesized*/ fun component2(): B
public final /*synthesized*/ fun copy(/*0*/ a: A = ..., /*1*/ b: B = ...): Pair<A, B>
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun <T> shuffle(x: List<T>): List<T> = x
fun bar() {
val s: (List<String>) -> List<String> = ::shuffle
}
@@ -0,0 +1,4 @@
package
public fun bar(): kotlin.Unit
public fun </*0*/ T> shuffle(/*0*/ x: kotlin.collections.List<T>): kotlin.collections.List<T>
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
fun foo(i: Int) {}
fun foo(s: String) {}
fun <T> id(x: T): T = x
fun <T> baz(x: T, y: T): T = TODO()
fun test() {
val x1: (Int) -> Unit = id(id(::foo))
val x2: (Int) -> Unit = baz(id(::foo), ::foo)
val x3: (Int) -> Unit = baz(id(::foo), id(id(::foo)))
val x4: (String) -> Unit = baz(id(::foo), id(id(::foo)))
val x5: (Double) -> Unit = baz(id(::<!NONE_APPLICABLE!>foo<!>), id(id(::<!NONE_APPLICABLE!>foo<!>)))
id<(Int) -> Unit>(id(id(::foo)))
id(id<(Int) -> Unit>(::foo))
baz<(Int) -> Unit>(id(::foo), id(id(::foo)))
baz(id(::foo), id(id<(Int) -> Unit>(::foo)))
baz(id(::foo), id<(Int) -> Unit>(id(::foo)))
}
@@ -0,0 +1,7 @@
package
public fun </*0*/ T> baz(/*0*/ x: T, /*1*/ y: T): T
public fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
public fun foo(/*0*/ s: kotlin.String): kotlin.Unit
public fun </*0*/ T> id(/*0*/ x: T): T
public fun test(): kotlin.Unit
@@ -0,0 +1,22 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun foo(x: Int?) {}
fun foo(y: String?) {}
fun foo(z: Boolean) {}
fun <T> baz(element: (T) -> Unit): T? = null
fun test1() {
val a1: Int? = baz(::foo)
val a2: String? = baz(::foo)
val a3: Boolean? = baz<Boolean>(::foo)
baz<Int>(::foo).checkType { _<Int?>() }
baz<String>(::foo).checkType { _<String?>() }
baz<Boolean>(::foo).checkType { _<Boolean?>() }
val b1: Int = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>baz(::foo)<!>
val b2: String = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>baz(::foo)<!>
val b3: Boolean = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>baz(::foo)<!>
}
@@ -0,0 +1,7 @@
package
public fun </*0*/ T> baz(/*0*/ element: (T) -> kotlin.Unit): T?
public fun foo(/*0*/ z: kotlin.Boolean): kotlin.Unit
public fun foo(/*0*/ x: kotlin.Int?): kotlin.Unit
public fun foo(/*0*/ y: kotlin.String?): kotlin.Unit
public fun test1(): kotlin.Unit
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun test() {
val a1: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Double::minus)
val a2: Array<Double.(Int) -> Double> = arrayOf(Double::plus, Double::minus)
val a3: Array<Int.(Int) -> Double> = arrayOf(Double::<!NONE_APPLICABLE!>plus<!>, Double::<!NONE_APPLICABLE!>minus<!>)
val a4: Array<Int.(Double) -> Double> = arrayOf(Int::plus, Double::<!NONE_APPLICABLE!>minus<!>)
val a5: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Int::<!NONE_APPLICABLE!>minus<!>)
}
fun foo(x: Int) {}
fun foo(y: String) {}
fun <T> bar(x: T, f: (T) -> Unit) {}
fun test2() {
bar(1, ::foo)
bar("", ::foo)
bar(1.0, ::<!NONE_APPLICABLE!>foo<!>)
}
@@ -0,0 +1,7 @@
package
public fun </*0*/ T> bar(/*0*/ x: T, /*1*/ f: (T) -> kotlin.Unit): kotlin.Unit
public fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
public fun foo(/*0*/ y: kotlin.String): kotlin.Unit
public fun test(): kotlin.Unit
public fun test2(): kotlin.Unit
@@ -0,0 +1,23 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun baz(i: Int) = i
fun <T> bar(x: T): T = TODO()
fun nullableFun(): ((Int) -> Int)? = null
fun test() {
val x1: (Int) -> Int = bar(if (true) ::baz else ::baz)
val x2: (Int) -> Int = bar(nullableFun() ?: ::baz)
val x3: (Int) -> Int = bar(::baz <!USELESS_ELVIS!>?: ::baz<!>)
val i = 0
val x4: (Int) -> Int = bar(when (i) {
10 -> ::baz
20 -> ::baz
else -> ::baz
})
val x5: (Int) -> Int = bar(::baz<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
(if (true) ::baz else ::baz)(1)
}
@@ -0,0 +1,6 @@
package
public fun </*0*/ T> bar(/*0*/ x: T): T
public fun baz(/*0*/ i: kotlin.Int): kotlin.Int
public fun nullableFun(): ((kotlin.Int) -> kotlin.Int)?
public fun test(): kotlin.Unit