Fix header scope for secondary constructors
Add companion object's scope and nested classes #KT-6996 fixed
This commit is contained in:
+8
-4
@@ -277,20 +277,22 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
thisScope.setImplicitReceiver(this.getThisAsReceiverParameter());
|
||||
thisScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
|
||||
ClassDescriptor companionObjectDescriptor = getCompanionObjectDescriptor();
|
||||
JetScope companionObjectAdapterScope = (companionObjectDescriptor != null) ? new CompanionObjectMixinScope(companionObjectDescriptor) : JetScope.Empty.INSTANCE$;
|
||||
|
||||
return new ChainedScope(
|
||||
this,
|
||||
"ScopeForMemberDeclarationResolution: " + getName(),
|
||||
thisScope,
|
||||
getScopeForMemberLookup(),
|
||||
getScopeForClassHeaderResolution(),
|
||||
companionObjectAdapterScope,
|
||||
getCompanionObjectScope(),
|
||||
getStaticScope()
|
||||
);
|
||||
}
|
||||
|
||||
private JetScope getCompanionObjectScope() {
|
||||
ClassDescriptor companionObjectDescriptor = getCompanionObjectDescriptor();
|
||||
return (companionObjectDescriptor != null) ? new CompanionObjectMixinScope(companionObjectDescriptor) : JetScope.Empty.INSTANCE$;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JetScope getScopeForInitializerResolution() {
|
||||
@@ -346,6 +348,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
this,
|
||||
"ScopeForSecondaryConstructorHeaderResolution: " + getName(),
|
||||
getScopeForClassHeaderResolution(),
|
||||
getCompanionObjectScope(),
|
||||
DescriptorUtils.getStaticNestedClassesScope(this),
|
||||
getStaticScope()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user