diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index c57973defd2..bc357335fbb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -619,7 +619,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { JetSimpleNameExpression reference = expression.getCallableReference(); boolean[] result = new boolean[1]; - CallableDescriptor descriptor = resolveCallableReferenceTarget(lhsType, context, expression, result); + CallableDescriptor descriptor = resolveCallableReferenceTarget( + lhsType, context.replaceContextDependency(INDEPENDENT), expression, result); if (!result[0]) { context.trace.report(UNRESOLVED_REFERENCE.on(reference, reference)); diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.kt new file mode 100644 index 00000000000..acbf68eb5d4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.kt @@ -0,0 +1,12 @@ +import kotlin.reflect.* + +fun checkSubtype(t: T) = t + +class A(var g: A) { + val f: Int = 0 + + fun test() { + checkSubtype>(::f) + checkSubtype>(::g) + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.txt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.txt new file mode 100644 index 00000000000..a5987b57df9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.txt @@ -0,0 +1,13 @@ +package + +internal fun checkSubtype(/*0*/ t: T): T + +internal final class A { + public constructor A(/*0*/ g: A) + internal final val f: kotlin.Int = 0 + internal final var g: A + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + internal final fun test(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java index db4bc6b3146..be7c3b48405 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestWithStdLibGenerated.java @@ -909,6 +909,12 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic doTest(fileName); } + @TestMetadata("kt7564.kt") + public void testKt7564() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/callableReference/property/kt7564.kt"); + doTest(fileName); + } + @TestMetadata("localVariable.kt") public void testLocalVariable() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/callableReference/property/localVariable.kt");