[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:
Kirill Rakhman
2023-10-24 10:00:18 +02:00
committed by Space Team
parent 15d3bf5e25
commit ac203591e5
22 changed files with 291 additions and 21 deletions
@@ -387,7 +387,7 @@ abstract class FirJavaFacade(
if (modality == Modality.SEALED) {
val permittedTypes = javaClass.permittedTypes
setSealedClassInheritors {
permittedTypes.mapNotNull { classifierType ->
permittedTypes.mapNotNullTo(mutableListOf()) { classifierType ->
val classifier = classifierType.classifier as? JavaClass
classifier?.let { JavaToKotlinClassMap.mapJavaToKotlin(it.fqName!!) ?: it.classId }
}