[FIR] Check type alias visibility after constructor visibility
#KT-61576 Fixed
This commit is contained in:
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.fir.resolve.inference.csBuilder
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.hasBuilderInferenceAnnotation
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.model.ConeExplicitTypeParameterConstraintPosition
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.typeAliasForConstructor
|
||||
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirUnstableSmartcastTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
@@ -580,6 +581,13 @@ internal object CheckVisibility : CheckerStage() {
|
||||
sink.yieldDiagnostic(VisibilityError)
|
||||
}
|
||||
}
|
||||
|
||||
val typeAlias = declaration.typeAliasForConstructor
|
||||
if (typeAlias != null) {
|
||||
if (!visibilityChecker.isVisible(typeAlias.fir, candidate)) {
|
||||
sink.yieldDiagnostic(VisibilityError)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import _
|
||||
|
||||
fun baz() {
|
||||
a.A1("") // resolved to B constructor, OK
|
||||
a.A2("") // resolved to B constructor, INVISIBLE_MEMBER because type alias is private, OK
|
||||
a.<!INVISIBLE_REFERENCE!>A2<!>("") // resolved to B constructor, INVISIBLE_MEMBER because type alias is private, OK
|
||||
|
||||
a.A3("") checkType { _<String>() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user