[JS, Frontend] Not report warning with non-exportable super type

^KT-53539 fixed
This commit is contained in:
Ilya Goncharov
2022-08-18 12:46:40 +00:00
committed by Space
parent c8a48473e2
commit 2f75ea585e
2 changed files with 5 additions and 14 deletions
@@ -6,27 +6,27 @@ package foo
open class NonExportedClass
@JsExport
class <!NON_EXPORTABLE_TYPE("super; NonExportedClass")!>ExportedClass<!> : NonExportedClass()
class ExportedClass : NonExportedClass()
interface NonExportedInterface
@JsExport
class <!NON_EXPORTABLE_TYPE("super; NonExportedInterface")!>ExportedClass2<!> : NonExportedInterface
class ExportedClass2 : NonExportedInterface
@JsExport
open class ExportedGenericClass<T>
@JsExport
class <!NON_EXPORTABLE_TYPE("super; ExportedGenericClass<NonExportedClass>")!>ExportedClass3<!> : ExportedGenericClass<NonExportedClass>()
class ExportedClass3 : ExportedGenericClass<NonExportedClass>()
@JsExport
interface ExportedGenericInterface<T>
@JsExport
class <!NON_EXPORTABLE_TYPE("super; ExportedGenericInterface<NonExportedClass>")!>ExportedClass4<!> : ExportedGenericInterface<NonExportedClass>
class ExportedClass4 : ExportedGenericInterface<NonExportedClass>
@JsExport
enum class <!NON_EXPORTABLE_TYPE("super; NonExportedInterface")!>ExportedEnum<!> : ExportedGenericInterface<Any>, NonExportedInterface {
enum class ExportedEnum : ExportedGenericInterface<Any>, NonExportedInterface {
EXPORTED_ENUM_1,
EXPORTED_ENUM_2
}
@@ -141,15 +141,6 @@ object JsExportDeclarationChecker : DeclarationChecker {
// Covered by ENUM_CLASS
return
}
val supertypes = descriptor.defaultType.supertypes()
val isEnum = supertypes.any { KotlinBuiltIns.isEnum(it) }
for (superType in supertypes) {
if (!superType.isExportable(bindingContext) && !(KotlinBuiltIns.isComparable(superType) && isEnum)) {
trace.report(ErrorsJs.NON_EXPORTABLE_TYPE.on(declaration, "super", superType))
}
}
}
}
}