d63a2462ef
As far as I can tell (and admittedly I'm not an expert in the Kotlin compiler code), it looks like the new logic iterates over all contributed descriptors, which renders the old logic (which explicitly invokes getCompanionObjectDescriptor) obsolete. We ran into this last year when rebasing on top of https://github.com/JetBrains/kotlin/commit/527ccaff16ecebbfbcecabd5fbc8af808a296915 and - after a quick conversation with @sandwwraith (email chain dated December 12, 2017) - we unblocked ourselves by deleting the old code from our local repository. Now we're looking to upstream our changes, thus this PR. Old code: ``` // Generate synthetic (non-declared) companion if needed ClassDescriptor companionObjectDescriptor = descriptor.getCompanionObjectDescriptor(); if (companionObjectDescriptor instanceof SyntheticClassOrObjectDescriptor) { genSyntheticClassOrObject((SyntheticClassOrObjectDescriptor) companionObjectDescriptor); } ``` New code: ``` // Generate synthetic nested classes Collection<DeclarationDescriptor> classifiers = descriptor .getUnsubstitutedMemberScope() .getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.Companion.getALL_NAME_FILTER()); for (DeclarationDescriptor memberDescriptor : classifiers) { if (memberDescriptor instanceof SyntheticClassOrObjectDescriptor) { genSyntheticClassOrObject((SyntheticClassOrObjectDescriptor) memberDescriptor); } } ``` Change-Id: Icb51ee6e56b9928108cc121c78fa50c6354a4b31