[FIR] Expand aliased type before checking for exposure
This commit is contained in:
+5
-1
@@ -11,4 +11,8 @@ class C {
|
||||
}
|
||||
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>AInner0<!> = A.Inner
|
||||
typealias BInner0 = B.Inner
|
||||
typealias BInner0 = B.Inner
|
||||
|
||||
private typealias MyString = String
|
||||
|
||||
fun foo(): MyString = ""
|
||||
@@ -37,3 +37,7 @@ FILE: exposedTypeAlias.kt
|
||||
}
|
||||
public final typealias AInner0 = R|A.Inner|
|
||||
public final typealias BInner0 = R|B.Inner|
|
||||
private final typealias MyString = R|kotlin/String|
|
||||
public final fun foo(): R|MyString| {
|
||||
^foo String()
|
||||
}
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory3
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
@@ -184,7 +185,7 @@ object FirExposedVisibilityDeclarationChecker : FirMemberDeclarationChecker() {
|
||||
base: FirEffectiveVisibility
|
||||
): FirMemberDeclaration? {
|
||||
val type = this as? ConeClassLikeType ?: return null
|
||||
val fir = type.lookupTag.toSymbol(context.session)?.fir ?: return null
|
||||
val fir = type.fullyExpandedType(context.session).lookupTag.toSymbol(context.session)?.fir ?: return null
|
||||
|
||||
if (fir is FirMemberDeclaration) {
|
||||
when (fir.getEffectiveVisibility(context).relation(base)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ class Outer {
|
||||
internal typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate3<!> = Private
|
||||
private typealias TestPrivate4 = Private
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate5<!> = L<Private>
|
||||
typealias TestPrivate6 = L<TestPrivate1>
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate6<!> = L<TestPrivate1>
|
||||
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestProtected1<!> = Protected
|
||||
protected typealias TestProtected2 = Protected
|
||||
@@ -26,7 +26,7 @@ class Outer {
|
||||
internal typealias TestInternal3 = Internal
|
||||
private typealias TestInternal4 = Internal
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestInternal5<!> = L<Internal>
|
||||
typealias TestInternal6 = L<TestInternal1>
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestInternal6<!> = L<TestInternal1>
|
||||
}
|
||||
|
||||
private class Private
|
||||
@@ -36,10 +36,10 @@ typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate1<!> = Private
|
||||
internal typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate2<!> = Private
|
||||
private typealias TestPrivate3 = Private
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate4<!> = L<Private>
|
||||
typealias TestPrivate5 = L<TestPrivate1>
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestPrivate5<!> = L<TestPrivate1>
|
||||
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestInternal1<!> = Internal
|
||||
internal typealias TestInternal2 = Internal
|
||||
private typealias TestInternal3 = Internal
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestInternal4<!> = L<Internal>
|
||||
typealias TestInternal5 = L<TestInternal1>
|
||||
typealias <!EXPOSED_TYPEALIAS_EXPANDED_TYPE!>TestInternal5<!> = L<TestInternal1>
|
||||
|
||||
Reference in New Issue
Block a user