Improved error reporting for candidates with wrong parameter count
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun foo() {}
|
||||
fun foo(s: Int) {}
|
||||
|
||||
|
||||
fun bar(a: Any) {}
|
||||
fun bar(a: Int) {}
|
||||
|
||||
fun test() {
|
||||
<!NONE_APPLICABLE!>foo<!>(1, 2)
|
||||
foo(<!TYPE_MISMATCH!>""<!>)
|
||||
|
||||
<!NONE_APPLICABLE!>bar<!>(1, 2)
|
||||
<!NONE_APPLICABLE!>bar<!>()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package
|
||||
|
||||
internal fun bar(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
internal fun bar(/*0*/ a: kotlin.Int): kotlin.Unit
|
||||
internal fun foo(): kotlin.Unit
|
||||
internal fun foo(/*0*/ s: kotlin.Int): kotlin.Unit
|
||||
internal fun test(): kotlin.Unit
|
||||
+3
-4
@@ -6,12 +6,11 @@ fun <T: Any> joinT(<!UNUSED_PARAMETER!>x<!>: Int, vararg <!UNUSED_PARAMETER!>a<!
|
||||
return null
|
||||
}
|
||||
|
||||
fun <T: Any> joinT(<!UNUSED_PARAMETER!>x<!>: Any, <!UNUSED_PARAMETER!>y<!>: T): T? {
|
||||
fun <T: Any> joinT(<!UNUSED_PARAMETER!>x<!>: Comparable<*>, <!UNUSED_PARAMETER!>y<!>: T): T? {
|
||||
return null
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val x2 = joinT(<!NON_VARARG_SPREAD!>*<!>1, "2")
|
||||
val x2 = <!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>joinT<!>(<!TYPE_MISMATCH!>Unit<!>, "2")
|
||||
checkSubtype<String?>(x2)
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
package d {
|
||||
internal fun </*0*/ T : kotlin.Any> joinT(/*0*/ x: kotlin.Any, /*1*/ y: T): T?
|
||||
internal fun </*0*/ T : kotlin.Any> joinT(/*0*/ x: kotlin.Comparable<*>, /*1*/ y: T): T?
|
||||
internal fun </*0*/ T : kotlin.Any> joinT(/*0*/ x: kotlin.Int, /*1*/ vararg a: T /*kotlin.Array<out T>*/): T?
|
||||
internal fun test(): kotlin.Unit
|
||||
}
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ fun test(n: J?, nn: J) {
|
||||
|
||||
J(nn, nn, nn)
|
||||
J(platformNN, platformNN, platformNN)
|
||||
<!NONE_APPLICABLE!>J<!>(n, n, n)
|
||||
<!NONE_APPLICABLE!>J<!>(platformN, platformN, platformN)
|
||||
J(<!TYPE_MISMATCH!>n<!>, n, n)
|
||||
J(<!TYPE_MISMATCH!>platformN<!>, platformN, platformN)
|
||||
J(platformJ, platformJ, platformJ)
|
||||
}
|
||||
+2
-3
@@ -11,7 +11,6 @@ public class ResolutionTaskHolder<F, G : F> {
|
||||
|
||||
//todo the problem is the type of ResolutionTask is inferred as ResolutionTask<F, F> too early
|
||||
tasks.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>bar<!>(ResolutionTask(candidate))
|
||||
tasks.<!NONE_APPLICABLE!>add<!>(ResolutionTask(candidate))
|
||||
tasks.add(ResolutionTask(candidate))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class X<T>(val t: T) {
|
||||
constructor(t: T, i: Int) : <!NONE_APPLICABLE!>this<!>(i)
|
||||
}
|
||||
constructor(t: T, i: Int) : this(<!TYPE_MISMATCH!>i<!>)
|
||||
}
|
||||
Reference in New Issue
Block a user