Add/fix extra cases for #KT-41886 Fixed

This commit is contained in:
Mikhail Glukhikh
2022-07-12 16:12:45 +02:00
committed by teamcity
parent 7d3368da58
commit 76aaecbdf0
3 changed files with 56 additions and 3 deletions
@@ -462,11 +462,14 @@ class OptInUsageChecker(project: Project) : CallChecker {
}
if (element.getParentOfType<KtImportDirective>(false) == null) {
val containingClass = element.getParentOfType<KtClassOrObject>(strict = true)
val descriptions = targetDescriptor.loadOptIns(
moduleAnnotationsResolver,
bindingContext,
context.languageVersionSettings,
fromSupertype = element.getParentOfType<KtSuperTypeListEntry>(strict = true) != null
fromSupertype = containingClass != null && containingClass.superTypeListEntries.any {
it.typeAsUserType == element.parent
}
)
reportNotAllowedOptIns(descriptions, element, context)
}