diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt index 1ed2a8deb0c..acef4dd8b11 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt @@ -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() + reportIfNonNull(expression) { + trace.report(UNRESOLVED_REFERENCE.on(it.callableReference, it.callableReference)) + } + } } } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt index 722e7c87f4a..6242151446c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.kt @@ -1,4 +1,6 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION, -UNUSED_PARAMETER +// !WITH_NEW_INFERENCE + class A fun test1() { @@ -17,6 +19,6 @@ fun test2() { Unresolved::foo foo(Unresolved::foo) - foo(Unresolved::unresolved) + foo(Unresolved::unresolved) ::unresolved } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.kt b/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.kt index b12987cf8bb..26f2448ab03 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.kt @@ -7,5 +7,5 @@ class TestClass(var prop: Int) open class OtherClass fun OtherClass.test(prop: KProperty1): Unit = throw Exception() class OtherClass2: OtherClass() { - val result = test(TestClass::result) + val result = test(TestClass::result) } diff --git a/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.kt b/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.kt index 31bea1ed20a..c7c903b26f5 100644 --- a/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.kt +++ b/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.kt @@ -1,2 +1,2 @@ // !WITH_NEW_INFERENCE -val unwrapped = some<sdf()()Any>::unwrap \ No newline at end of file +val unwrapped = some<sdf()()Any>::unwrap \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.kt b/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.kt index 407f6d15059..790ef459c28 100644 --- a/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.kt +++ b/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.kt @@ -1,3 +1,4 @@ +// !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -val unwrapped = some.<cabc$WrapperAny>::unwrap \ No newline at end of file +val unwrapped = some.<cabc$WrapperAny>::unwrap \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/ea72837.kt b/compiler/testData/diagnostics/tests/regressions/ea72837.kt index aa0263febd1..91b6aac836c 100644 --- a/compiler/testData/diagnostics/tests/regressions/ea72837.kt +++ b/compiler/testData/diagnostics/tests/regressions/ea72837.kt @@ -5,6 +5,6 @@ fun h(x: () -> Unit) = 1 fun foo() { f(::) - g(::) - h(::) + g(::) + h(::) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt13685.kt b/compiler/testData/diagnostics/tests/regressions/kt13685.kt index 3d3772577f7..1287502f6c1 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt13685.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt13685.kt @@ -3,5 +3,5 @@ fun foo() { val text: List = null!! - text.map Any?::toString + text.map Any?::toString } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 928b1401862..2a637e94326 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 094f7514ead..4bcf461ad6e 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -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");