[NI] Fix exception: callable reference is used with an unresolved LHS
#KT-32187 Fixed
This commit is contained in:
+5
@@ -12448,6 +12448,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("contravariantSamConvertedFunctionFromAnotherModule.kt")
|
||||||
|
public void testContravariantSamConvertedFunctionFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/contravariantSamConvertedFunctionFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("enhancedSamConstructor.kt")
|
@TestMetadata("enhancedSamConstructor.kt")
|
||||||
public void testEnhancedSamConstructor() throws Exception {
|
public void testEnhancedSamConstructor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
||||||
|
|||||||
+4
-2
@@ -119,8 +119,10 @@ fun ConstraintSystemOperation.checkCallableReference(
|
|||||||
addSubtypeConstraint(toFreshSubstitutor.safeSubstitute(reflectionCandidateType), expectedType, position)
|
addSubtypeConstraint(toFreshSubstitutor.safeSubstitute(reflectionCandidateType), expectedType, position)
|
||||||
}
|
}
|
||||||
|
|
||||||
addReceiverConstraint(toFreshSubstitutor, dispatchReceiver, candidateDescriptor.dispatchReceiverParameter, position)
|
if (!ErrorUtils.isError(candidateDescriptor)) {
|
||||||
addReceiverConstraint(toFreshSubstitutor, extensionReceiver, candidateDescriptor.extensionReceiverParameter, position)
|
addReceiverConstraint(toFreshSubstitutor, dispatchReceiver, candidateDescriptor.dispatchReceiverParameter, position)
|
||||||
|
addReceiverConstraint(toFreshSubstitutor, extensionReceiver, candidateDescriptor.extensionReceiverParameter, position)
|
||||||
|
}
|
||||||
|
|
||||||
val invisibleMember = Visibilities.findInvisibleMember(
|
val invisibleMember = Visibilities.findInvisibleMember(
|
||||||
dispatchReceiver?.asReceiverValueForVisibilityChecks,
|
dispatchReceiver?.asReceiverValueForVisibilityChecks,
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// !LANGUAGE: +NewInference
|
||||||
|
|
||||||
|
interface Inv
|
||||||
|
class Impl : Inv
|
||||||
|
|
||||||
|
class Scope<InterfaceT, ImplementationT : InterfaceT>(private val implClass: <!UNRESOLVED_REFERENCE!>j<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>Class<!><ImplementationT>) {
|
||||||
|
fun foo(c: Collection<InterfaceT>) {
|
||||||
|
val <!UNUSED_VARIABLE!>hm<!> = c.asSequence()
|
||||||
|
.filter(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>implClass<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>isInstance<!>)
|
||||||
|
.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>map<!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>implClass<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>cast<!>)
|
||||||
|
.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toSet<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class Impl : Inv {
|
||||||
|
public constructor Impl()
|
||||||
|
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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Inv {
|
||||||
|
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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Scope</*0*/ InterfaceT, /*1*/ ImplementationT : InterfaceT> {
|
||||||
|
public constructor Scope</*0*/ InterfaceT, /*1*/ ImplementationT : InterfaceT>(/*0*/ implClass: [ERROR : j.Class<ImplementationT>]<ImplementationT>)
|
||||||
|
private final val implClass: [ERROR : j.Class<ImplementationT>]<ImplementationT>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(/*0*/ c: kotlin.collections.Collection<InterfaceT>): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -12455,6 +12455,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.*)\\.kts?$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.*)\\.kts?$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("contravariantSamConvertedFunctionFromAnotherModule.kt")
|
||||||
|
public void testContravariantSamConvertedFunctionFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/contravariantSamConvertedFunctionFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("enhancedSamConstructor.kt")
|
@TestMetadata("enhancedSamConstructor.kt")
|
||||||
public void testEnhancedSamConstructor() throws Exception {
|
public void testEnhancedSamConstructor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
||||||
|
|||||||
+5
@@ -1784,6 +1784,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/bigArity.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/bigArity.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("callableReferenceOnUnresolvedLHS.kt")
|
||||||
|
public void testCallableReferenceOnUnresolvedLHS() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("property.kt")
|
@TestMetadata("property.kt")
|
||||||
public void testProperty_1_2() throws Exception {
|
public void testProperty_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -1784,6 +1784,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/bigArity.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/bigArity.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("callableReferenceOnUnresolvedLHS.kt")
|
||||||
|
public void testCallableReferenceOnUnresolvedLHS() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("property.kt")
|
@TestMetadata("property.kt")
|
||||||
public void testProperty_1_2() throws Exception {
|
public void testProperty_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/property.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
Generated
+5
@@ -12450,6 +12450,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/j+k/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("contravariantSamConvertedFunctionFromAnotherModule.kt")
|
||||||
|
public void testContravariantSamConvertedFunctionFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/contravariantSamConvertedFunctionFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("enhancedSamConstructor.kt")
|
@TestMetadata("enhancedSamConstructor.kt")
|
||||||
public void testEnhancedSamConstructor() throws Exception {
|
public void testEnhancedSamConstructor() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user