FIR: don't raise an internal error for sealed members in intersection scope
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4fba5891c7
commit
c4af92a86a
+8
-4
@@ -134,14 +134,18 @@ class FirTypeIntersectionScope private constructor(
|
||||
|
||||
private fun <D : FirCallableSymbol<*>> chooseIntersectionOverrideModality(
|
||||
extractedOverridden: Collection<MemberWithBaseScope<D>>
|
||||
): Modality {
|
||||
): Modality? {
|
||||
var hasOpen = false
|
||||
var hasAbstract = false
|
||||
|
||||
for ((member) in extractedOverridden) {
|
||||
when ((member.fir as FirMemberDeclaration).modality) {
|
||||
Modality.FINAL -> return Modality.FINAL
|
||||
Modality.SEALED -> error("Members should not be sealed: $member")
|
||||
Modality.SEALED -> {
|
||||
// Members should not be sealed. But, that will be reported as WRONG_MODIFIER_TARGET, and here we shouldn't raise an
|
||||
// internal error. Instead, let the intersection override have the default modality: null.
|
||||
return null
|
||||
}
|
||||
Modality.OPEN -> {
|
||||
hasOpen = true
|
||||
}
|
||||
@@ -258,7 +262,7 @@ class FirTypeIntersectionScope private constructor(
|
||||
private fun createIntersectionOverride(
|
||||
mostSpecific: FirNamedFunctionSymbol,
|
||||
overrides: Collection<FirCallableSymbol<*>>,
|
||||
newModality: Modality,
|
||||
newModality: Modality?,
|
||||
newVisibility: Visibility,
|
||||
): FirNamedFunctionSymbol {
|
||||
|
||||
@@ -287,7 +291,7 @@ class FirTypeIntersectionScope private constructor(
|
||||
private fun createIntersectionOverride(
|
||||
mostSpecific: FirPropertySymbol,
|
||||
overrides: Collection<FirCallableSymbol<*>>,
|
||||
newModality: Modality,
|
||||
newModality: Modality?,
|
||||
newVisibility: Visibility,
|
||||
): FirPropertySymbol {
|
||||
val newSymbol = FirIntersectionOverridePropertySymbol(mostSpecific.callableId, overrides)
|
||||
|
||||
Reference in New Issue
Block a user