Use language version settings of definitely known module
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.idea.util
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.imports.importableFqName
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
@@ -202,7 +203,7 @@ class ShadowedDeclarationsFilter(
|
||||
val dataFlowInfo = bindingContext.getDataFlowInfoBefore(context)
|
||||
val context = BasicCallResolutionContext.create(bindingTrace, scope, newCall, TypeUtils.NO_EXPECTED_TYPE, dataFlowInfo,
|
||||
ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
|
||||
false, resolutionFacade.frontendService())
|
||||
false, resolutionFacade.frontendService<LanguageVersionSettings>())
|
||||
val callResolver = resolutionFacade.frontendService<CallResolver>()
|
||||
val results = if (isFunction) callResolver.resolveFunctionCall(context) else callResolver.resolveSimpleProperty(context)
|
||||
val resultingDescriptors = results.resultingCalls.map { it.resultingDescriptor }
|
||||
|
||||
+3
-2
@@ -23,6 +23,7 @@ import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.stubs.StubIndex
|
||||
import org.jetbrains.kotlin.asJava.builder.LightClassConstructionContext
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.container.useImpl
|
||||
import org.jetbrains.kotlin.container.useInstance
|
||||
@@ -40,7 +41,6 @@ import org.jetbrains.kotlin.idea.caches.resolve.lightClasses.IDELightClassConstr
|
||||
import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider
|
||||
import org.jetbrains.kotlin.idea.project.IdeaEnvironment
|
||||
import org.jetbrains.kotlin.idea.project.ResolveElementCache
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinOverridableInternalMembersShortNameIndex
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -335,6 +335,7 @@ object IDELightClassContexts {
|
||||
class AdHocAnnotationResolver(
|
||||
private val moduleDescriptor: ModuleDescriptor,
|
||||
private val callResolver: CallResolver,
|
||||
private val languageVersionSettings: LanguageVersionSettings,
|
||||
constantExpressionEvaluator: ConstantExpressionEvaluator,
|
||||
storageManager: StorageManager
|
||||
) : AnnotationResolverImpl(callResolver, constantExpressionEvaluator, storageManager) {
|
||||
@@ -365,7 +366,7 @@ object IDELightClassContexts {
|
||||
BasicCallResolutionContext.create(
|
||||
trace, scope, CallMaker.makeCall(null, null, annotationEntry), TypeUtils.NO_EXPECTED_TYPE,
|
||||
DataFlowInfoFactory.EMPTY, ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
|
||||
true, annotationEntry.languageVersionSettings
|
||||
true, languageVersionSettings
|
||||
),
|
||||
annotationEntry.calleeExpression!!.constructorReferenceExpression!!,
|
||||
annotationConstructor.returnType
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.jetbrains.kotlin.idea.core
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.util.FuzzyType
|
||||
import org.jetbrains.kotlin.idea.util.toFuzzyType
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -39,7 +39,8 @@ import java.util.*
|
||||
|
||||
class IterableTypesDetection(
|
||||
private val project: Project,
|
||||
private val forLoopConventionsChecker: ForLoopConventionsChecker
|
||||
private val forLoopConventionsChecker: ForLoopConventionsChecker,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
companion object {
|
||||
private val iteratorName = Name.identifier("iterator")
|
||||
@@ -77,7 +78,7 @@ class IterableTypesDetection(
|
||||
|
||||
val expression = KtPsiFactory(project).createExpression("fake")
|
||||
val context = ExpressionTypingContext.newContext(
|
||||
BindingTraceContext(), scope, DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE, expression.languageVersionSettings)
|
||||
BindingTraceContext(), scope, DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE, languageVersionSettings)
|
||||
val expressionReceiver = ExpressionReceiver.create(expression, type.type, context.trace.bindingContext)
|
||||
val elementType = forLoopConventionsChecker.checkIterableConvention(expressionReceiver, context)
|
||||
return elementType?.let { it.toFuzzyType(type.freeParameters) }
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package org.jetbrains.kotlin.idea.core
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.analysis.computeTypeInContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.resolve.frontendService
|
||||
@@ -122,7 +122,7 @@ fun Call.resolveCandidates(
|
||||
val callResolutionContext = BasicCallResolutionContext.create(
|
||||
bindingTrace, resolutionScope, this, expectedType, dataFlowInfo,
|
||||
ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
|
||||
false, callElement.languageVersionSettings
|
||||
false, resolutionFacade.frontendService<LanguageVersionSettings>()
|
||||
).replaceCollectAllCandidates(true)
|
||||
val callResolver = resolutionFacade.frontendService<CallResolver>()
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.ui.LabeledComponent
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
@@ -33,7 +34,6 @@ import org.jetbrains.kotlin.idea.core.NotPropertiesService
|
||||
import org.jetbrains.kotlin.idea.core.copied
|
||||
import org.jetbrains.kotlin.idea.core.replaced
|
||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.resolve.frontendService
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
@@ -206,7 +206,7 @@ class UsePropertyAccessSyntaxIntention : SelfTargetingOffsetIndependentIntention
|
||||
val bindingTrace = DelegatingBindingTrace(bindingContext, "Temporary trace")
|
||||
val context = BasicCallResolutionContext.create(bindingTrace, resolutionScope, newCall, expectedType, dataFlowInfo,
|
||||
ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
|
||||
false, resolvedCall.call.callElement.languageVersionSettings)
|
||||
false, facade.frontendService<LanguageVersionSettings>())
|
||||
val callResolver = facade.frontendService<CallResolver>()
|
||||
val result = callResolver.resolveSimpleProperty(context)
|
||||
return result.isSuccess && result.resultingDescriptor.original == property
|
||||
|
||||
Reference in New Issue
Block a user