KT-8861 Package name vs property with wrong receiver
#KT-8861 Fixed
This commit is contained in:
+1
-1
@@ -120,7 +120,7 @@ public class CallExpressionResolver {
|
|||||||
|
|
||||||
// if the expression is a receiver in a qualified expression, it should be resolved after the selector is resolved
|
// if the expression is a receiver in a qualified expression, it should be resolved after the selector is resolved
|
||||||
boolean isLHSOfDot = JetPsiUtil.isLHSOfDot(nameExpression);
|
boolean isLHSOfDot = JetPsiUtil.isLHSOfDot(nameExpression);
|
||||||
if (!resolutionResult.isNothing()) {
|
if (!resolutionResult.isNothing() && resolutionResult.getResultCode() != OverloadResolutionResults.Code.CANDIDATES_WITH_WRONG_RECEIVER) {
|
||||||
boolean isQualifier = isLHSOfDot && resolutionResult.isSingleResult()
|
boolean isQualifier = isLHSOfDot && resolutionResult.isSingleResult()
|
||||||
&& resolutionResult.getResultingDescriptor() instanceof FakeCallableDescriptorForObject;
|
&& resolutionResult.getResultingDescriptor() instanceof FakeCallableDescriptorForObject;
|
||||||
if (!isQualifier) {
|
if (!isQualifier) {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package some
|
||||||
|
|
||||||
|
class A()
|
||||||
|
|
||||||
|
val Int.some: Int get() = 4
|
||||||
|
val Int.foo: Int get() = 4
|
||||||
|
|
||||||
|
fun Int.extFun() = 4
|
||||||
|
|
||||||
|
fun String.test() {
|
||||||
|
<!EXPRESSION_EXPECTED_PACKAGE_FOUND!>some<!>
|
||||||
|
some.A()
|
||||||
|
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>some<!>
|
||||||
|
|
||||||
|
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>
|
||||||
|
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>
|
||||||
|
|
||||||
|
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>extFun<!>()
|
||||||
|
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>extFun<!>()
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package some {
|
||||||
|
internal val kotlin.Int.foo: kotlin.Int
|
||||||
|
internal val kotlin.Int.some: kotlin.Int
|
||||||
|
internal fun kotlin.Int.extFun(): kotlin.Int
|
||||||
|
internal fun kotlin.String.test(): kotlin.Unit
|
||||||
|
|
||||||
|
internal final class A {
|
||||||
|
public constructor 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
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11637,6 +11637,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("wrongReceiver.kt")
|
||||||
|
public void testWrongReceiver() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/wrongReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/resolve/invoke")
|
@TestMetadata("compiler/testData/diagnostics/tests/resolve/invoke")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user