[NI] Set correct applicability for unknown lambda parameter diagnostic
Unknown lambda parameter should not change resolve. So the new diagnostic should not have error status; othrewise candidates with lower priority but more specific expected type may be chosen. KT-34335 Fixed See also KT-36264
This commit is contained in:
Generated
+5
@@ -10161,6 +10161,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("resolveWithUnknownLambdaParameterType.kt")
|
||||||
|
public void testResolveWithUnknownLambdaParameterType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
+1
-1
@@ -213,7 +213,7 @@ class ResolvedToSamWithVarargDiagnostic(val argument: KotlinCallArgument) : Kotl
|
|||||||
class NotEnoughInformationForLambdaParameter(
|
class NotEnoughInformationForLambdaParameter(
|
||||||
val lambdaArgument: LambdaKotlinCallArgument,
|
val lambdaArgument: LambdaKotlinCallArgument,
|
||||||
val parameterIndex: Int
|
val parameterIndex: Int
|
||||||
) : KotlinCallDiagnostic(INAPPLICABLE) {
|
) : KotlinCallDiagnostic(RESOLVED) {
|
||||||
override fun report(reporter: DiagnosticReporter) {
|
override fun report(reporter: DiagnosticReporter) {
|
||||||
reporter.onCallArgument(lambdaArgument, this)
|
reporter.onCallArgument(lambdaArgument, this)
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
|
||||||
|
|
||||||
|
fun baz(f: (Int) -> String) {}
|
||||||
|
|
||||||
|
object Foo {
|
||||||
|
fun baz(vararg anys: Any?) {}
|
||||||
|
|
||||||
|
fun testResolvedToMember() {
|
||||||
|
baz({ x -> "" }) // should be an error
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
|
||||||
|
|
||||||
|
fun baz(f: (Int) -> String) {}
|
||||||
|
|
||||||
|
object Foo {
|
||||||
|
fun baz(vararg anys: Any?) {}
|
||||||
|
|
||||||
|
fun testResolvedToMember() {
|
||||||
|
baz({ <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> "" }) // should be an error
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun baz(/*0*/ f: (kotlin.Int) -> kotlin.String): kotlin.Unit
|
||||||
|
|
||||||
|
public object Foo {
|
||||||
|
private constructor Foo()
|
||||||
|
public final fun baz(/*0*/ vararg anys: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): 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 testResolvedToMember(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -10168,6 +10168,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("resolveWithUnknownLambdaParameterType.kt")
|
||||||
|
public void testResolveWithUnknownLambdaParameterType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
Generated
+5
@@ -10163,6 +10163,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("resolveWithUnknownLambdaParameterType.kt")
|
||||||
|
public void testResolveWithUnknownLambdaParameterType() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("starApproximation.kt")
|
@TestMetadata("starApproximation.kt")
|
||||||
public void testStarApproximation() throws Exception {
|
public void testStarApproximation() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user