Filter out inapplicable local scopes in call resolution
The idea is that resolution has an approximate complexity close to (n + n*m) * 3 Where n is a number of scopes, m is a number of receivers and 3-constant is used because each of these combinations runs through 3 processors for functions. And while call resolver seems to be a hot spot, it should be useful to decreate the value of n
This commit is contained in:
+3
-3
@@ -168,10 +168,10 @@ class NewResolutionOldInference(
|
||||
val processor = kind.createTowerProcessor(this, nameToResolve, tracing, scopeTower, detailedReceiver, context)
|
||||
|
||||
if (context.collectAllCandidates) {
|
||||
return allCandidatesResult(towerResolver.collectAllCandidates(scopeTower, processor))
|
||||
return allCandidatesResult(towerResolver.collectAllCandidates(scopeTower, processor, nameToResolve))
|
||||
}
|
||||
|
||||
var candidates = towerResolver.runResolve(scopeTower, processor, useOrder = kind != ResolutionKind.CallableReference)
|
||||
var candidates = towerResolver.runResolve(scopeTower, processor, useOrder = kind != ResolutionKind.CallableReference, name = nameToResolve)
|
||||
|
||||
// Temporary hack to resolve 'rem' as 'mod' if the first is do not present
|
||||
val emptyOrInapplicableCandidates = candidates.isEmpty() ||
|
||||
@@ -179,7 +179,7 @@ class NewResolutionOldInference(
|
||||
if (isBinaryRemOperator && shouldUseOperatorRem && emptyOrInapplicableCandidates) {
|
||||
val deprecatedName = OperatorConventions.REM_TO_MOD_OPERATION_NAMES[name]
|
||||
val processorForDeprecatedName = kind.createTowerProcessor(this, deprecatedName!!, tracing, scopeTower, detailedReceiver, context)
|
||||
candidates = towerResolver.runResolve(scopeTower, processorForDeprecatedName, useOrder = kind != ResolutionKind.CallableReference)
|
||||
candidates = towerResolver.runResolve(scopeTower, processorForDeprecatedName, useOrder = kind != ResolutionKind.CallableReference, name = deprecatedName)
|
||||
}
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user