Skip to content

Commit

Permalink
fix annotations on enum entry declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
neetopia committed Jun 10, 2024
1 parent f681871 commit 8e5471f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.google.devtools.ksp.impl.recordLookup
import com.google.devtools.ksp.impl.recordLookupForGetAllFunctions
import com.google.devtools.ksp.impl.recordLookupForGetAllProperties
import com.google.devtools.ksp.symbol.ClassKind
import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.KSDeclaration
import com.google.devtools.ksp.symbol.KSExpectActual
Expand Down Expand Up @@ -46,7 +45,7 @@ class KSClassDeclarationEnumEntryImpl private constructor(private val ktEnumEntr
override val isCompanionObject: Boolean = false

override fun getSealedSubclasses(): Sequence<KSClassDeclaration> {
TODO("Not yet implemented")
return emptySequence()
}

override fun getAllFunctions(): Sequence<KSFunctionDeclaration> {
Expand Down Expand Up @@ -113,8 +112,6 @@ class KSClassDeclarationEnumEntryImpl private constructor(private val ktEnumEntr
return visitor.visitClassDeclaration(this, data)
}

override val annotations: Sequence<KSAnnotation> = emptySequence()

override val declarations: Sequence<KSDeclaration> by lazy {
// TODO: fix after .getDeclaredMemberScope() works for enum entry with no initializer.
emptySequence()
Expand Down
13 changes: 13 additions & 0 deletions kotlin-analysis-api/testData/getSymbolsFromAnnotation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== Anno in depth ====
// Foo:KSClassDeclaration
// constructorParameterFoo:KSPropertyDeclaration
Expand All @@ -44,6 +45,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== Bnno superficial====
// File: Foo.kt:KSFile
// propertyFoo.getter():KSPropertyAccessorImpl
Expand All @@ -67,6 +69,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== A1 in depth ====
// Foo:KSClassDeclaration
// constructorParameterFoo:KSPropertyDeclaration
Expand All @@ -81,6 +84,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== A2 superficial====
// Foo:KSClassDeclaration
// constructorParameterFoo:KSPropertyDeclaration
Expand All @@ -94,6 +98,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== A2 in depth ====
// Foo:KSClassDeclaration
// constructorParameterFoo:KSPropertyDeclaration
Expand All @@ -108,6 +113,7 @@
// Baz:KSClassDeclaration
// Burp:KSClassDeclaration
// Flux:KSTypeAlias
// RGB.B:KSClassDeclaration
// ==== Cnno in depth ====
// constructorParameterFoo:KSPropertyDeclaration
// <set-?>:KSValueParameter
Expand Down Expand Up @@ -160,3 +166,10 @@ class Burp

@Anno
typealias Flux = String

enum class RGB{
R,
G,
@Anno
B
}

0 comments on commit 8e5471f

Please sign in to comment.