K2: Avoid inference diagnostics when arguments are already error typed
For example, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
It became especially relevant after 0e84bf2053
that together with later commits bring a lot of unnecessary
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic
This commit is contained in:
committed by
Space Team
parent
564b40f05d
commit
fe5adab652
@@ -8,5 +8,5 @@ fun <T> _arrayList(vararg values: T) : List<T> = throw Exception()
|
||||
class _Pair<A>(val a: A)
|
||||
|
||||
fun test() {
|
||||
_arrayList(_Pair(1)).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>_sortBy<!> { it -> <!UNRESOLVED_REFERENCE!>xxx<!> }
|
||||
_arrayList(_Pair(1))._sortBy { it -> <!UNRESOLVED_REFERENCE!>xxx<!> }
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {}
|
||||
class C : Closeable {}
|
||||
|
||||
public inline fun <T: Closeable, R> T.use1(block: (T)-> R) : R {
|
||||
return block(this)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use1<!> {
|
||||
w -> // ERROR here
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
package a
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {
|
||||
fun close() {}
|
||||
}
|
||||
|
||||
class C : Closeable
|
||||
|
||||
public inline fun <T: Closeable, R> T.use(block: (t: T)-> R) : R {
|
||||
return block(this)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
it.close()
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
package a
|
||||
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {
|
||||
fun close() {}
|
||||
}
|
||||
|
||||
class C : Closeable
|
||||
|
||||
public inline fun <T: Closeable, R> use(t: T, block: T.(T)-> R) : R {
|
||||
return t.block(t)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!>(C()) {
|
||||
this.close()
|
||||
it.close()
|
||||
<!UNRESOLVED_REFERENCE!>xx<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
package a
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {
|
||||
fun close() {}
|
||||
}
|
||||
|
||||
class C : Closeable
|
||||
|
||||
public inline fun <T: Closeable, R> T.use(block: T.()-> R) : R {
|
||||
return this.block()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
this.close()
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
package a
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ fun test() {
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
|
||||
when {
|
||||
true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
true -> id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
}
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>) ?: id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user