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
+1
-1
@@ -51,7 +51,7 @@ fun testUnit() {
|
||||
fun testParameter() {
|
||||
takeFnToParameter { }
|
||||
takeFnToParameter { Unit }
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
takeFnToParameter { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
takeFnToParameter { if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> {
|
||||
if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() else <!UNRESOLVED_REFERENCE!>unresolved<!>()
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ fun main() {
|
||||
val number: Int = 5 // doesn't work
|
||||
// val number: Long = 5 // works
|
||||
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!> (WrapperFunctions()) {
|
||||
with (WrapperFunctions()) {
|
||||
wrapper <!NONE_APPLICABLE!>greaterEq<!> number
|
||||
}
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package n
|
||||
|
||||
fun <T> foo(t: T, t1: T) {}
|
||||
|
||||
fun test() {
|
||||
//no type inference error
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!UNRESOLVED_REFERENCE!>aaab<!>, <!UNRESOLVED_REFERENCE!>bbb<!>)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
package n
|
||||
|
||||
fun <T> foo(t: T, t1: T) {}
|
||||
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ fun testParam() {
|
||||
}
|
||||
|
||||
fun testParamCall() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>callParam<!> {
|
||||
callParam {
|
||||
param -> <!UNRESOLVED_REFERENCE!>param<!>()
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -37,7 +37,7 @@ fun testStarProjection() = BiParam(
|
||||
intersect(First, Second),
|
||||
makeStarProjection()
|
||||
)
|
||||
fun testErrorType() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>BiParam<!>(
|
||||
fun testErrorType() = BiParam(
|
||||
intersect(First, Second),
|
||||
<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
)
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ fun insideJob1() = doTheJob1()
|
||||
suspend fun insideJob2() = doTheJob2()
|
||||
suspend fun insideJob3() = doTheJob3()
|
||||
|
||||
fun doTheJob0() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync0<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob0()<!> }
|
||||
fun doTheJob1() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync1<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob1()<!> }
|
||||
suspend fun doTheJob2() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync2<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!NON_LOCAL_SUSPENSION_POINT!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync3<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob3()<!> }
|
||||
fun doTheJob0() = simpleAsync0 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob0()<!> }
|
||||
fun doTheJob1() = simpleAsync1 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob1()<!> }
|
||||
suspend fun doTheJob2() = simpleAsync2 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!NON_LOCAL_SUSPENSION_POINT!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = simpleAsync3 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob3()<!> }
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ fun foo() {
|
||||
fun bar1() = bar1()
|
||||
|
||||
fun bar2() = 1 <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> bar2()
|
||||
fun bar3() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(bar3())
|
||||
fun bar3() = id(bar3())
|
||||
}
|
||||
|
||||
fun <T> id(x: T) = x
|
||||
|
||||
@@ -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<!>)
|
||||
}
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {}
|
||||
class C : Closeable {}
|
||||
|
||||
fun <T: Closeable, R> T.foo(block: (T)-> R) = block
|
||||
|
||||
fun <T: Closeable, R> T.foo(block: (T, T)-> R) = block
|
||||
|
||||
fun main() {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> { // no ambiguity here
|
||||
www ->
|
||||
<!UNRESOLVED_REFERENCE!>xs<!>
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
package a
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ fun <K> id2(x: K, s: String): K = x
|
||||
fun <K> ret(s: String): K = TODO()
|
||||
|
||||
fun test() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id2<!>(<!UNRESOLVED_REFERENCE!>unresolved<!>, "foo")
|
||||
id2(<!UNRESOLVED_REFERENCE!>unresolved<!>, "foo")
|
||||
id2(<!UNRESOLVED_REFERENCE!>unresolved<!>, <!ARGUMENT_TYPE_MISMATCH!>42<!>)
|
||||
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>ret<!>("foo")
|
||||
|
||||
Reference in New Issue
Block a user