Skip to content

Commit

Permalink
UPDATE_KOTLIN_VERSION: 1.8.0-dev-2355
Browse files Browse the repository at this point in the history
filter `entries` out in enums
  • Loading branch information
ting-yuan committed Aug 30, 2022
1 parent fd4605a commit 4f5f880
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ import com.google.devtools.ksp.symbol.impl.kotlin.*
import com.google.devtools.ksp.symbol.impl.replaceTypeArguments
import com.intellij.psi.PsiField
import com.intellij.psi.PsiMethod
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.resolve.calls.tower.isSynthesized
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
Expand Down Expand Up @@ -97,7 +99,13 @@ class KSClassDeclarationDescriptorImpl private constructor(val descriptor: Class
override val declarations: Sequence<KSDeclaration> by lazy {
sequenceOf(
descriptor.unsubstitutedMemberScope.getDescriptorsFiltered(),
descriptor.staticScope.getDescriptorsFiltered(),
// FIXME: Support static, synthetic `entries` for enums when the language feature is enabled.
descriptor.staticScope.getDescriptorsFiltered().filterNot {
descriptor.kind == KtClassKind.ENUM_CLASS &&
it is CallableDescriptor &&
it.isSynthesized &&
it.name == StandardNames.ENUM_ENTRIES
},
descriptor.constructors
).flatten()
.filter {
Expand Down

0 comments on commit 4f5f880

Please sign in to comment.