[NI] Don't forget to report about unresolved callable reference
This commit is contained in:
+10
-13
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls
|
||||
@@ -118,6 +107,14 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
|
||||
MixingNamedAndPositionArguments::class.java ->
|
||||
trace.report(MIXING_NAMED_AND_POSITIONED_ARGUMENTS.on(callArgument.psiCallArgument.valueArgument.asElement()))
|
||||
|
||||
NoneCallableReferenceCandidates::class.java -> {
|
||||
val expression =
|
||||
(diagnostic as NoneCallableReferenceCandidates).argument.psiExpression.safeAs<KtCallableReferenceExpression>()
|
||||
reportIfNonNull(expression) {
|
||||
trace.report(UNRESOLVED_REFERENCE.on(it.callableReference, it.callableReference))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
class A
|
||||
|
||||
fun test1() {
|
||||
@@ -17,6 +19,6 @@ fun test2() {
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
foo(<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>)
|
||||
foo(<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>unresolved<!>)
|
||||
foo(<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!NI;UNRESOLVED_REFERENCE, OI;DEBUG_INFO_MISSING_UNRESOLVED!>unresolved<!>)
|
||||
::<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
}
|
||||
+1
-1
@@ -7,5 +7,5 @@ class TestClass(var prop: Int)
|
||||
open class OtherClass
|
||||
fun OtherClass.test(prop: KProperty1<TestClass, Int>): Unit = throw Exception()
|
||||
class OtherClass2: OtherClass() {
|
||||
val result = test(TestClass::<!NI;DEBUG_INFO_MISSING_UNRESOLVED, OI;UNRESOLVED_REFERENCE!>result<!>)
|
||||
val result = test(TestClass::<!UNRESOLVED_REFERENCE!>result<!>)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!><<!><!DEBUG_INFO_MISSING_UNRESOLVED!>sdf<!>()()<out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!DEBUG_INFO_MISSING_UNRESOLVED!>unwrap<!>
|
||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!><<!><!DEBUG_INFO_MISSING_UNRESOLVED!>sdf<!>()()<out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!NI;UNRESOLVED_REFERENCE, OI;DEBUG_INFO_MISSING_UNRESOLVED!>unwrap<!>
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>cabc<!><!SYNTAX!>$Wrapper<!><out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!DEBUG_INFO_MISSING_UNRESOLVED!>unwrap<!>
|
||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>cabc<!><!SYNTAX!>$Wrapper<!><out <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!>>::<!NI;UNRESOLVED_REFERENCE, OI;DEBUG_INFO_MISSING_UNRESOLVED!>unwrap<!>
|
||||
@@ -5,6 +5,6 @@ fun h(x: () -> Unit) = 1
|
||||
|
||||
fun foo() {
|
||||
<!UNRESOLVED_REFERENCE!>f<!>(::<!NI;DEBUG_INFO_MISSING_UNRESOLVED, SYNTAX!><!>)
|
||||
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>g<!>(::<!NI;DEBUG_INFO_MISSING_UNRESOLVED, SYNTAX!><!>)
|
||||
h(::<!NI;DEBUG_INFO_MISSING_UNRESOLVED, SYNTAX!><!>)
|
||||
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>g<!>(::<!SYNTAX!><!>)
|
||||
h(::<!SYNTAX!><!>)
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
fun foo() {
|
||||
val <!OI;UNUSED_VARIABLE!>text<!>: List<Any> = null!!
|
||||
text.<!UNRESOLVED_REFERENCE!>map<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Any<!><!SYNTAX!>?<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>
|
||||
text.<!UNRESOLVED_REFERENCE!>map<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>Any<!><!SYNTAX!>?<!>::<!NI;UNRESOLVED_REFERENCE, OI;DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>
|
||||
}
|
||||
|
||||
@@ -10562,6 +10562,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt")
|
||||
public void testReportAboutUnresolvedReferenceAsUnresolved() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryNumberLowerBoundsBeforeUpperBounds.kt")
|
||||
public void testTryNumberLowerBoundsBeforeUpperBounds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/tryNumberLowerBoundsBeforeUpperBounds.kt");
|
||||
|
||||
Generated
+6
@@ -10562,6 +10562,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt")
|
||||
public void testReportAboutUnresolvedReferenceAsUnresolved() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryNumberLowerBoundsBeforeUpperBounds.kt")
|
||||
public void testTryNumberLowerBoundsBeforeUpperBounds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/tryNumberLowerBoundsBeforeUpperBounds.kt");
|
||||
|
||||
Reference in New Issue
Block a user