Kotlin: Don't warn if we can't find a label for a fake owner

The fake owner probably just wasn't extracted
This commit is contained in:
Ian Lynagh
2023-11-28 14:52:58 +00:00
parent f111fba4b7
commit b3f8167973
2 changed files with 8 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ open class KotlinFileExtractor(
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
private fun isFake(d: IrDeclarationWithVisibility): Boolean {
fun isFake(d: IrDeclarationWithVisibility): Boolean {
val hasFakeVisibility =
d.visibility.let {
it is DelegatedDescriptorVisibility && it.delegate == Visibilities.InvisibleFake

View File

@@ -41,7 +41,13 @@ open class CommentExtractor(
tw.getExistingLabelFor<DbTop>(label)
}
if (existingLabel == null) {
logger.warn("Couldn't get existing label for $label")
// Sometimes we don't extract elements.
// The actual extractor logic is a bit more nuanced than
// just "isFake", but just checking isFake is good enough
// to not bother with a warning.
if(element !is IrDeclarationWithVisibility || !fileExtractor.isFake(element)) {
logger.warn("Couldn't get existing label for $label")
}
return null
}
return existingLabel