[NI] Report "not enough information" on callable references in lambdas
^KT-34314 Fixed
This commit is contained in:
Generated
+10
@@ -1854,6 +1854,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt32267.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314.kt")
|
||||
public void testKt34314() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314_lambda.kt")
|
||||
public void testKt34314_lambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
+6
-2
@@ -373,8 +373,12 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
}
|
||||
) return
|
||||
|
||||
val call = error.resolvedAtom.atom?.safeAs<PSIKotlinCall>()?.psiCall ?: call
|
||||
val expression = call.calleeExpression ?: return
|
||||
val expression = when (val atom = error.resolvedAtom.atom) {
|
||||
is PSIKotlinCall -> atom.psiCall.calleeExpression
|
||||
is PSIKotlinCallArgument -> atom.valueArgument.getArgumentExpression()
|
||||
else -> call.calleeExpression
|
||||
} ?: return
|
||||
|
||||
val typeVariableName = when (val typeVariable = error.typeVariable) {
|
||||
is TypeVariableFromCallableDescriptor -> typeVariable.originalTypeParameter.name.asString()
|
||||
is TypeVariableForLambdaReturnType -> "return type of lambda"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun main() {
|
||||
val x = run { ::run } // no error
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun main() {
|
||||
val x = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>run<!> { <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>run<!><!> } // no error
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
@@ -0,0 +1,8 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun <T> materialize(): T = TODO()
|
||||
|
||||
fun main() {
|
||||
val x = run { materialize() }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun <T> materialize(): T = TODO()
|
||||
|
||||
fun main() {
|
||||
val x = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>run<!> { <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>() }
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
public fun </*0*/ T> materialize(): T
|
||||
@@ -1861,6 +1861,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt32267.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314.kt")
|
||||
public void testKt34314() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314_lambda.kt")
|
||||
public void testKt34314_lambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
Generated
+10
@@ -1856,6 +1856,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt32267.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314.kt")
|
||||
public void testKt34314() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt34314_lambda.kt")
|
||||
public void testKt34314_lambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
|
||||
|
||||
Reference in New Issue
Block a user