diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt index 5b8bff1c10c..58c4c104ae8 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.kt @@ -6,4 +6,12 @@ class A { abstract class B { fun foo(str: String): A.InnerA -} \ No newline at end of file +} + +private enum class Some { + FIRST { + override fun foo(): Some = FIRST + }; + + abstract fun foo(): Some +} diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.txt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.txt index 3f102ee64ed..8b9ca103bf8 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.txt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedFunctionReturnType.txt @@ -20,3 +20,28 @@ FILE: exposedFunctionReturnType.kt public final fun foo(str: R|kotlin/String|): R|A.InnerA| } + private final enum class Some : R|kotlin/Enum| { + private constructor(): R|Some| { + super|>() + } + + public final static enum entry FIRST: R|Some| = object : R|Some| { + private constructor(): R|| { + super() + } + + public final override fun foo(): R|Some| { + ^foo R|/Some.FIRST| + } + + } + + public abstract fun foo(): R|Some| + + public final static fun values(): R|kotlin/Array| { + } + + public final static fun valueOf(value: R|kotlin/String|): R|Some| { + } + + } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityResolverImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityResolverImpl.kt index 4de58f4a04f..1dd4dfa3b2f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityResolverImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirEffectiveVisibilityResolverImpl.kt @@ -81,7 +81,9 @@ class FirEffectiveVisibilityResolverImpl(private val session: FirSession) : FirE if (!succeededToGetSymbol) { if (parentClassId?.isLocal == false) { + // ?: is needed to get enum from enum entry parentSymbol = session.firSymbolProvider.getClassLikeSymbolByFqName(parentClassId) + ?: parentClassId.outerClassId?.let { session.firSymbolProvider.getClassLikeSymbolByFqName(it) } parentSymbol?.fir.safeAs()?.let { parentEffectiveVisibility = resolveFor(it, null, scopeSession) }