[AA] KtFirSymbolContainingDeclarationProvider: Support EnumGeneratedDeclaration in getContainingPsi

- The root cause of the exception in KT-62982 is that symbol light
  classes are accessed in dumb mode (see KT-63490). Nonetheless, we can
  patch the exception by supporting `EnumGeneratedDeclaration` in
  `getContainingPsi`.
- To create a symbol from the containing PSI,
  `KtFirSymbolContainingDeclarationProvider` will still try and fail to
  find the enum class symbol via symbol providers, but it'll fall back
  to a designators search in the same `FirFile`, which will find the
  symbol without index access (see `findSourceNonLocalFirDeclaration` in
  LL API's `declarationUtils.kt`).

^KT-62982 fixed
This commit is contained in:
Marco Pennekamp
2023-11-15 16:26:09 +01:00
committed by Space Team
parent dd23415793
commit 4efe7a00f1
@@ -113,6 +113,7 @@ internal class KtFirSymbolContainingDeclarationProvider(
KtFakeSourceElementKind.ImplicitConstructor -> return source.psi as KtDeclaration
KtFakeSourceElementKind.PropertyFromParameter -> return source.psi?.parentOfType<KtPrimaryConstructor>()!!
KtFakeSourceElementKind.EnumInitializer -> return source.psi as KtEnumEntry
KtFakeSourceElementKind.EnumGeneratedDeclaration -> return source.psi as KtDeclaration
KtFakeSourceElementKind.ScriptParameter -> return source.psi as KtScript
KtRealSourceElementKind -> source.psi!!
else ->