diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/callableReferences/CallableReferencesResolutionUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/callableReferences/CallableReferencesResolutionUtils.kt index 9bbb6760067..22e5e65b735 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/callableReferences/CallableReferencesResolutionUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/callableReferences/CallableReferencesResolutionUtils.kt @@ -27,7 +27,6 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtCallableReferenceExpression import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import org.jetbrains.kotlin.psi.ValueArgument import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.resolve.calls.CallResolver import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode @@ -51,7 +50,6 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils import org.jetbrains.kotlin.utils.Printer -import org.jetbrains.kotlin.utils.ThrowingList private fun ResolveArgumentsMode.acceptResolution(results: OverloadResolutionResults, trace: TemporaryTraceAndCache) { when (this) { @@ -69,7 +67,7 @@ private fun resolvePossiblyAmbiguousCallableReference( resolutionMode: ResolveArgumentsMode, callResolver: CallResolver ): OverloadResolutionResults { - val call = CallMaker.makeCall(reference, receiver, null, reference, ThrowingList.instance()) + val call = CallMaker.makeCall(reference, receiver, null, reference, emptyList()) val temporaryTrace = TemporaryTraceAndCache.create(context, "trace to resolve ::${reference.getReferencedName()} as function", reference) val newContext = if (resolutionMode == ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS) context.replaceTraceAndCache(temporaryTrace).replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE) diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/ThrowingList.java b/compiler/util/src/org/jetbrains/kotlin/utils/ThrowingList.java deleted file mode 100644 index d0a732f2dc2..00000000000 --- a/compiler/util/src/org/jetbrains/kotlin/utils/ThrowingList.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010-2015 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. - */ - -package org.jetbrains.kotlin.utils; - -import org.jetbrains.annotations.NotNull; - -import java.util.AbstractList; - -public class ThrowingList extends AbstractList { - private static final ThrowingList INSTANCE = new ThrowingList(); - - private ThrowingList() {} - - @NotNull - @SuppressWarnings("unchecked") - public static ThrowingList instance() { - return (ThrowingList) INSTANCE; - } - - @NotNull - @Override - public E get(int index) { - throw new UnsupportedOperationException(getClass().getName()); - } - - @Override - public int size() { - throw new UnsupportedOperationException(getClass().getName()); - } -} diff --git a/idea/testData/diagnosticMessage/noneApplicableCallableReference.kt b/idea/testData/diagnosticMessage/noneApplicableCallableReference.kt new file mode 100644 index 00000000000..e52eab6e1a9 --- /dev/null +++ b/idea/testData/diagnosticMessage/noneApplicableCallableReference.kt @@ -0,0 +1,5 @@ +// !DIAGNOSTICS_NUMBER: 1 +// !DIAGNOSTICS: NONE_APPLICABLE + +fun filterChars(chars: List, str: String) = + chars.filter(str::contains) diff --git a/idea/testData/diagnosticMessage/noneApplicableCallableReference1.html b/idea/testData/diagnosticMessage/noneApplicableCallableReference1.html new file mode 100644 index 00000000000..939694e86fd --- /dev/null +++ b/idea/testData/diagnosticMessage/noneApplicableCallableReference1.html @@ -0,0 +1,9 @@ + + +None of the following functions can be called with the arguments supplied. +
    +
  • CharSequence.contains(Char, Boolean = ...) defined in kotlin.text
  • +
  • CharSequence.contains(CharSequence, Boolean = ...) defined in kotlin.text
  • +
  • CharSequence.contains(Regex) defined in kotlin.text
  • +
+ diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java index a55c985c5dc..277e9eb1367 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/DiagnosticMessageTestGenerated.java @@ -161,6 +161,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes doTest(fileName); } + @TestMetadata("noneApplicableCallableReference.kt") + public void testNoneApplicableCallableReference() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/noneApplicableCallableReference.kt"); + doTest(fileName); + } + @TestMetadata("noneApplicableConstructor.kt") public void testNoneApplicableConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/noneApplicableConstructor.kt");