Refactor CallableReferencesResolutionUtils.kt
Get rid of trace & reportOn parameters of createReflectionTypeForCallableDescriptor: move the two checks that required them to DoubleColonExpressionResolver and combine with other checks into a single function that checks the validity of the referenced symbol. This also makes these checks reported only once when invalid expressions are passed as function arguments (previously they were also reported from getResolvedCallableReferenceShapeType). Also inline getReflectionTypeForCandidateDescriptor after this, and refactor its usages
This commit is contained in:
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.idea.completion.suppressAutoInsertion
|
||||
import org.jetbrains.kotlin.idea.core.*
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.util.*
|
||||
import org.jetbrains.kotlin.resolve.callableReferences.getReflectionTypeForCandidateDescriptor
|
||||
import org.jetbrains.kotlin.resolve.callableReferences.createReflectionTypeForCallableDescriptor
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeNullability
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
@@ -248,8 +248,8 @@ private fun MutableCollection<LookupElement>.addLookupElementsForNullable(factor
|
||||
|
||||
fun CallableDescriptor.callableReferenceType(resolutionFacade: ResolutionFacade): FuzzyType? {
|
||||
if (!CallType.CALLABLE_REFERENCE.descriptorKindFilter.accepts(this)) return null // not supported by callable references
|
||||
return getReflectionTypeForCandidateDescriptor(
|
||||
this, resolutionFacade.getFrontendService(ReflectionTypes::class.java), false, resolutionFacade.moduleDescriptor
|
||||
return createReflectionTypeForCallableDescriptor(
|
||||
this, null, resolutionFacade.getFrontendService(ReflectionTypes::class.java), false, resolutionFacade.moduleDescriptor
|
||||
)?.toFuzzyType(emptyList())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user