[NI] Write info about hidden descriptor to candidate
This commit is contained in:
+9
-1
@@ -17,7 +17,9 @@
|
|||||||
package org.jetbrains.kotlin.resolve.calls.tower
|
package org.jetbrains.kotlin.resolve.calls.tower
|
||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.createFunctionType
|
import org.jetbrains.kotlin.builtins.createFunctionType
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
@@ -39,6 +41,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
|||||||
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategyImpl
|
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategyImpl
|
||||||
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
import org.jetbrains.kotlin.resolve.calls.util.CallMaker
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
|
import org.jetbrains.kotlin.resolve.isHiddenInResolution
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver
|
import org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver
|
||||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||||
@@ -53,7 +56,8 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
val typeApproximator: TypeApproximator,
|
val typeApproximator: TypeApproximator,
|
||||||
val kotlinToResolvedCallTransformer: KotlinToResolvedCallTransformer,
|
val kotlinToResolvedCallTransformer: KotlinToResolvedCallTransformer,
|
||||||
val argumentTypeResolver: ArgumentTypeResolver,
|
val argumentTypeResolver: ArgumentTypeResolver,
|
||||||
val doubleColonExpressionResolver: DoubleColonExpressionResolver
|
val doubleColonExpressionResolver: DoubleColonExpressionResolver,
|
||||||
|
val languageVersionSettings: LanguageVersionSettings
|
||||||
): KotlinResolutionCallbacks {
|
): KotlinResolutionCallbacks {
|
||||||
val trace: BindingTrace = topLevelCallContext.trace
|
val trace: BindingTrace = topLevelCallContext.trace
|
||||||
|
|
||||||
@@ -206,4 +210,8 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
|
|
||||||
expressionTypingServices.getTypeInfo(psiCallArgument.collectionLiteralExpression, actualContext)
|
expressionTypingServices.getTypeInfo(psiCallArgument.collectionLiteralExpression, actualContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isHiddenInResolution(descriptor: DeclarationDescriptor, isSuperCall: Boolean): Boolean {
|
||||||
|
return descriptor.isHiddenInResolution(languageVersionSettings, isSuperCall)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,8 @@ class PSICallResolver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createLambdaAnalyzer(context: BasicCallResolutionContext) =
|
private fun createLambdaAnalyzer(context: BasicCallResolutionContext) =
|
||||||
KotlinResolutionCallbacksImpl(context, expressionTypingServices, typeApproximator, kotlinToResolvedCallTransformer, argumentTypeResolver, doubleColonExpressionResolver)
|
KotlinResolutionCallbacksImpl(context, expressionTypingServices, typeApproximator, kotlinToResolvedCallTransformer,
|
||||||
|
argumentTypeResolver, doubleColonExpressionResolver, languageVersionSettings)
|
||||||
|
|
||||||
private fun calculateExpectedType(context: BasicCallResolutionContext): UnwrappedType? {
|
private fun calculateExpectedType(context: BasicCallResolutionContext): UnwrappedType? {
|
||||||
val expectedType = context.expectedType.unwrap()
|
val expectedType = context.expectedType.unwrap()
|
||||||
|
|||||||
+3
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.resolve.calls.components
|
package org.jetbrains.kotlin.resolve.calls.components
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||||
import org.jetbrains.kotlin.types.UnwrappedType
|
import org.jetbrains.kotlin.types.UnwrappedType
|
||||||
|
|
||||||
@@ -40,4 +41,6 @@ interface KotlinResolutionCallbacks {
|
|||||||
resultTypeParameters: List<UnwrappedType>)
|
resultTypeParameters: List<UnwrappedType>)
|
||||||
|
|
||||||
fun completeCollectionLiteralCalls(collectionLiteralArgument: ResolvedCollectionLiteralArgument)
|
fun completeCollectionLiteralCalls(collectionLiteralArgument: ResolvedCollectionLiteralArgument)
|
||||||
|
|
||||||
|
fun isHiddenInResolution(descriptor: DeclarationDescriptor, isSuperCall: Boolean = false): Boolean
|
||||||
}
|
}
|
||||||
+7
-1
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolve
|
|||||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.CandidateFactory
|
import org.jetbrains.kotlin.resolve.calls.tower.CandidateFactory
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.CandidateWithBoundDispatchReceiver
|
import org.jetbrains.kotlin.resolve.calls.tower.CandidateWithBoundDispatchReceiver
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.tower.HiddenDescriptor
|
||||||
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitScopeTower
|
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitScopeTower
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
|
||||||
import org.jetbrains.kotlin.types.ErrorUtils
|
import org.jetbrains.kotlin.types.ErrorUtils
|
||||||
@@ -75,8 +76,13 @@ class SimpleCandidateFactory(val callContext: KotlinCallContext, val kotlinCall:
|
|||||||
return ErrorKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver, towerCandidate.descriptor)
|
return ErrorKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver, towerCandidate.descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val candidateDiagnostics = towerCandidate.diagnostics.toMutableList()
|
||||||
|
if (callContext.resolutionCallbacks.isHiddenInResolution(towerCandidate.descriptor, kotlinCall.isSuperOrDelegatingConstructorCall)) {
|
||||||
|
candidateDiagnostics.add(HiddenDescriptor)
|
||||||
|
}
|
||||||
|
|
||||||
return SimpleKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver,
|
return SimpleKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver,
|
||||||
towerCandidate.descriptor, null, towerCandidate.diagnostics)
|
towerCandidate.descriptor, null, candidateDiagnostics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user