Fix false positive "Cannot capture" error reporting
There is no need to report an error in case of non-top-level capture conversion, just don't add relevant capture type in the system instead If system can be solved successfully without captured type, then it's just fine (see KT-13950) In case of contradiction TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR is reported #KT-13950 Fixed
This commit is contained in:
@@ -4,6 +4,7 @@ class B<E>
|
||||
|
||||
fun <T> B<T>.foo(f: (T) -> Unit) {}
|
||||
fun <T> B<T>.bar(f: (T, T) -> Unit, g: (T, T) -> Unit) {}
|
||||
fun <T> B<T>.baz(f: (B<T>) -> Unit) {}
|
||||
|
||||
fun number(x: Number) {}
|
||||
fun Number.foobar() {}
|
||||
@@ -34,4 +35,8 @@ fun test(b: B<out Number>) {
|
||||
|
||||
b.foo(::number)
|
||||
b.foo(Number::foobar)
|
||||
|
||||
b.baz {
|
||||
b -> b checkType { _<B<out Number>>() }
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ package
|
||||
public fun number(/*0*/ x: kotlin.Number): kotlin.Unit
|
||||
public fun test(/*0*/ b: B<out kotlin.Number>): kotlin.Unit
|
||||
public fun </*0*/ T> B<T>.bar(/*0*/ f: (T, T) -> kotlin.Unit, /*1*/ g: (T, T) -> kotlin.Unit): kotlin.Unit
|
||||
public fun </*0*/ T> B<T>.baz(/*0*/ f: (B<T>) -> kotlin.Unit): kotlin.Unit
|
||||
public fun </*0*/ T> B<T>.foo(/*0*/ f: (T) -> kotlin.Unit): kotlin.Unit
|
||||
public fun kotlin.Number.foobar(): kotlin.Unit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user