[FE, Java resolve] Support inheritors of sealed Java type without permits clause
This fixes a false negative NO_ELSE_IN_WHEN in K2 and incidentally also fixes a false positive NO_ELSE_IN_WHEN in K1 since the fix is in the common code. #KT-62491 Fixed
This commit is contained in:
committed by
Space Team
parent
15d3bf5e25
commit
ac203591e5
+1
-1
@@ -197,7 +197,7 @@ class LazyJavaClassDescriptor(
|
||||
|
||||
override fun getSealedSubclasses(): Collection<ClassDescriptor> = if (modality == Modality.SEALED) {
|
||||
val attributes = TypeUsage.COMMON.toAttributes()
|
||||
jClass.permittedTypes.mapNotNull {
|
||||
jClass.permittedTypes.mapNotNullTo(mutableListOf()) {
|
||||
c.typeResolver.transformJavaType(it, attributes).constructor.declarationDescriptor as? ClassDescriptor
|
||||
}.sortedBy { it.fqNameSafe.asString() }
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -193,8 +193,8 @@ class SyntheticJavaClassDescriptor(
|
||||
get() = this@SyntheticJavaClassDescriptor.isRecord
|
||||
override val isSealed: Boolean
|
||||
get() = modality == Modality.SEALED
|
||||
override val permittedTypes: Collection<JavaClassifierType>
|
||||
get() = emptyList()
|
||||
override val permittedTypes: Sequence<JavaClassifierType>
|
||||
get() = emptySequence()
|
||||
override val lightClassOriginKind: LightClassOriginKind?
|
||||
get() = null
|
||||
override val methods: Collection<JavaMethod>
|
||||
|
||||
Reference in New Issue
Block a user