[Commonizer] CirTypeDistance: Ensure consistent function signatures
^KT-48288
This commit is contained in:
committed by
Space
parent
24ac122e88
commit
24680144da
@@ -106,25 +106,25 @@ private fun backwardsTypeDistance(
|
|||||||
val resolvedDependencyClassifier =
|
val resolvedDependencyClassifier =
|
||||||
classifiers.commonDependencies.classifier(to) ?: classifiers.targetDependencies[targetIndex].classifier(to)
|
classifiers.commonDependencies.classifier(to) ?: classifiers.targetDependencies[targetIndex].classifier(to)
|
||||||
if (resolvedDependencyClassifier != null) {
|
if (resolvedDependencyClassifier != null) {
|
||||||
return classifiers.backwardsTypeDistance(targetIndex, from, resolvedDependencyClassifier)
|
return backwardsTypeDistance(classifiers, targetIndex, from, resolvedDependencyClassifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
val resolvedClassifier = classifiers.classifierIndices[targetIndex].findClassifier(to) ?: return unreachable
|
val resolvedClassifier = classifiers.classifierIndices[targetIndex].findClassifier(to) ?: return unreachable
|
||||||
return classifiers.backwardsTypeDistance(targetIndex, from, resolvedClassifier)
|
return backwardsTypeDistance(classifiers, targetIndex, from, resolvedClassifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CirKnownClassifiers.backwardsTypeDistance(
|
private fun backwardsTypeDistance(
|
||||||
targetIndex: Int, from: CirEntityId, to: CirProvided.Classifier
|
classifiers: CirKnownClassifiers, targetIndex: Int, from: CirEntityId, to: CirProvided.Classifier
|
||||||
): CirTypeDistance {
|
): CirTypeDistance {
|
||||||
if (to !is CirProvided.TypeAlias) return unreachable
|
if (to !is CirProvided.TypeAlias) return unreachable
|
||||||
if (to.underlyingType.classifierId == from) return CirTypeDistance(-1)
|
if (to.underlyingType.classifierId == from) return CirTypeDistance(-1)
|
||||||
return backwardsTypeDistance(this, targetIndex, from, to.underlyingType.classifierId) - 1
|
return backwardsTypeDistance(classifiers, targetIndex, from, to.underlyingType.classifierId) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CirKnownClassifiers.backwardsTypeDistance(
|
private fun backwardsTypeDistance(
|
||||||
targetIndex: Int, from: CirEntityId, to: CirClassifier
|
classifiers: CirKnownClassifiers, targetIndex: Int, from: CirEntityId, to: CirClassifier
|
||||||
): CirTypeDistance {
|
): CirTypeDistance {
|
||||||
if (to !is CirTypeAlias) return unreachable
|
if (to !is CirTypeAlias) return unreachable
|
||||||
if (to.underlyingType.classifierId == from) return CirTypeDistance(-1)
|
if (to.underlyingType.classifierId == from) return CirTypeDistance(-1)
|
||||||
return backwardsTypeDistance(this, targetIndex, from, to.underlyingType.classifierId) - 1
|
return backwardsTypeDistance(classifiers, targetIndex, from, to.underlyingType.classifierId) - 1
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user