Removed 'implicit this' from scope for member lookup
This commit is contained in:
-7
@@ -262,16 +262,9 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
||||
@NotNull
|
||||
@Override
|
||||
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
|
||||
ReceiverParameterDescriptor receiver = getImplicitReceiver();
|
||||
if (receiver != null) {
|
||||
return Collections.singletonList(receiver);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract ReceiverParameterDescriptor getImplicitReceiver();
|
||||
|
||||
// Do not change this, override in concrete subclasses:
|
||||
// it is very easy to compromise laziness of this class, and fail all the debugging
|
||||
// a generic implementation can't do this properly
|
||||
|
||||
+1
@@ -243,6 +243,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
private JetScope computeScopeForMemberDeclarationResolution() {
|
||||
WritableScopeImpl thisScope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with 'this' for " + getName());
|
||||
thisScope.addLabeledDeclaration(this);
|
||||
thisScope.setImplicitReceiver(this.getThisAsReceiverParameter());
|
||||
thisScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
|
||||
ClassDescriptor classObject = getClassObjectDescriptor();
|
||||
|
||||
-6
@@ -326,12 +326,6 @@ public class LazyClassMemberScope extends AbstractLazyMemberScope<LazyClassDescr
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ReceiverParameterDescriptor getImplicitReceiver() {
|
||||
return thisDescriptor.getThisAsReceiverParameter();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<ConstructorDescriptor> getConstructors() {
|
||||
ConstructorDescriptor constructor = getPrimaryConstructor();
|
||||
|
||||
-5
@@ -49,11 +49,6 @@ public class LazyPackageMemberScope extends AbstractLazyMemberScope<PackageFragm
|
||||
return resolveSession.getScopeProvider().getFileScope(declaration.getContainingJetFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReceiverParameterDescriptor getImplicitReceiver() {
|
||||
return ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getNonDeclaredFunctions(@NotNull Name name, @NotNull Set<FunctionDescriptor> result) {
|
||||
// No extra functions
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
trait Bar {
|
||||
fun <T> T.bar() {}
|
||||
}
|
||||
|
||||
class A {
|
||||
class object : Bar
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.<error><error>bar</error></error>()
|
||||
}
|
||||
@@ -318,6 +318,11 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
||||
doTest("idea/testData/checker/regression/DoubleDefine.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionMemberInClassObject.kt")
|
||||
public void testExtensionMemberInClassObject() throws Exception {
|
||||
doTest("idea/testData/checker/regression/extensionMemberInClassObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Jet11.kt")
|
||||
public void testJet11() throws Exception {
|
||||
doTest("idea/testData/checker/regression/Jet11.kt");
|
||||
|
||||
Reference in New Issue
Block a user