Pass LanguageVersionSettings instance to isHiddenInResolution

Unused at the moment, will be used later to check if the API version prohibits
the usage of the element
This commit is contained in:
Alexander Udalov
2016-09-19 14:35:02 +03:00
parent 59b29cf00d
commit 6e0e8c6dc3
7 changed files with 32 additions and 18 deletions
@@ -28,6 +28,7 @@ import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.analyze
@@ -37,6 +38,7 @@ import org.jetbrains.kotlin.idea.core.targetDescriptors
import org.jetbrains.kotlin.idea.imports.importableFqName
import org.jetbrains.kotlin.idea.quickfix.KotlinQuickFixAction
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
import org.jetbrains.kotlin.idea.resolve.frontendService
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.idea.util.application.runReadAction
@@ -66,11 +68,11 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection(), Clean
val nameElement = property.nameIdentifier ?: return
val propertyDescriptor = property.resolveToDescriptor() as? PropertyDescriptor ?: return
val syntheticScopes = resolutionFacade.getFrontendService(SyntheticScopes::class.java)
val syntheticScopes = resolutionFacade.frontendService<SyntheticScopes>()
val conflictingExtension = conflictingSyntheticExtension(propertyDescriptor, syntheticScopes) ?: return
// don't report on hidden declarations
if (propertyDescriptor.isHiddenInResolution()) return
if (propertyDescriptor.isHiddenInResolution(resolutionFacade.frontendService<LanguageVersionSettings>())) return
val fixes = createFixes(property, conflictingExtension, isOnTheFly)