Make FileDescriptorForVisibilityCheck subtype of PackageFragmentDescriptor

#KT-20548 Fixed
This commit is contained in:
Mikhail Glukhikh
2020-12-16 09:22:28 +03:00
parent 3ae8521f12
commit 107a825c5f
2 changed files with 5 additions and 9 deletions
@@ -83,11 +83,9 @@ class LazyAnnotationDescriptor(
override val source = annotationEntry.toSourceElement() override val source = annotationEntry.toSourceElement()
private val scope = if (c.scope.ownerDescriptor is PackageFragmentDescriptor) { private val scope = (c.scope.ownerDescriptor as? PackageFragmentDescriptor)?.let {
LexicalScope.Base(c.scope, FileDescriptorForVisibilityChecks(source, c.scope.ownerDescriptor)) LexicalScope.Base(c.scope, FileDescriptorForVisibilityChecks(source, it))
} else { } ?: c.scope
c.scope
}
override val allValueArguments by c.storageManager.createLazyValue { override val allValueArguments by c.storageManager.createLazyValue {
val resolutionResults = c.annotationResolver.resolveAnnotationCall(annotationEntry, scope, c.trace) val resolutionResults = c.annotationResolver.resolveAnnotationCall(annotationEntry, scope, c.trace)
@@ -110,10 +108,9 @@ class LazyAnnotationDescriptor(
private class FileDescriptorForVisibilityChecks( private class FileDescriptorForVisibilityChecks(
private val source: SourceElement, private val source: SourceElement,
private val containingDeclaration: DeclarationDescriptor private val containingDeclaration: PackageFragmentDescriptor
) : DeclarationDescriptorWithSource { ) : DeclarationDescriptorWithSource, PackageFragmentDescriptor by containingDeclaration {
override val annotations: Annotations get() = Annotations.EMPTY override val annotations: Annotations get() = Annotations.EMPTY
override fun getContainingDeclaration() = containingDeclaration
override fun getSource() = source override fun getSource() = source
override fun getOriginal() = this override fun getOriginal() = this
override fun getName() = Name.special("< file descriptor for annotation resolution >") override fun getName() = Name.special("< file descriptor for annotation resolution >")
@@ -1,5 +1,4 @@
// Validation // Validation
// ALLOW_FRONTEND_EXCEPTION
// See KT-24323 // See KT-24323
// FIR_COMPARISON // FIR_COMPARISON