Minor, rename variable: expected -> actual

This commit is contained in:
Mikhail Zarechenskiy
2017-10-02 03:53:54 +03:00
parent 68a2ba4918
commit a06203512f
@@ -65,8 +65,8 @@ object ExpectedActualDeclarationChecker : DeclarationChecker {
checkExpectedDeclarationHasActual(declaration, descriptor, diagnosticHolder, descriptor.module) checkExpectedDeclarationHasActual(declaration, descriptor, diagnosticHolder, descriptor.module)
} }
else { else {
val checkExpected = !languageVersionSettings.getFlag(AnalysisFlag.multiPlatformDoNotCheckActual) val checkActual = !languageVersionSettings.getFlag(AnalysisFlag.multiPlatformDoNotCheckActual)
checkActualDeclarationHasExpected(declaration, descriptor, diagnosticHolder, checkExpected) checkActualDeclarationHasExpected(declaration, descriptor, diagnosticHolder, checkActual)
} }
} }
@@ -120,20 +120,20 @@ object ExpectedActualDeclarationChecker : DeclarationChecker {
} }
private fun checkActualDeclarationHasExpected( private fun checkActualDeclarationHasExpected(
reportOn: KtDeclaration, descriptor: MemberDescriptor, diagnosticHolder: DiagnosticSink, checkExpected: Boolean reportOn: KtDeclaration, descriptor: MemberDescriptor, diagnosticHolder: DiagnosticSink, checkActual: Boolean
) { ) {
// Using the platform module instead of the common module is sort of fine here because the former always depends on the latter. // Using the platform module instead of the common module is sort of fine here because the former always depends on the latter.
// However, it would be clearer to find the common module this platform module implements and look for expected there instead. // However, it would be clearer to find the common module this platform module implements and look for expected there instead.
// TODO: use common module here // TODO: use common module here
val compatibility = findExpectedForActual(descriptor, descriptor.module) ?: return val compatibility = findExpectedForActual(descriptor, descriptor.module) ?: return
val hasExpectedModifier = descriptor.isActual && reportOn.hasActualModifier() val hasActualModifier = descriptor.isActual && reportOn.hasActualModifier()
if (!hasExpectedModifier) { if (!hasActualModifier) {
if (Compatible !in compatibility) return if (Compatible !in compatibility) return
// we suppress error, because annotation classes can only have one constructor and it's a 100% boilerplate // we suppress error, because annotation classes can only have one constructor and it's a 100% boilerplate
// to require every annotation constructor with additional parameters with default values be marked with the `actual` modifier // to require every annotation constructor with additional parameters with default values be marked with the `actual` modifier
if (checkExpected && !descriptor.isAnnotationConstructor()) { if (checkActual && !descriptor.isAnnotationConstructor()) {
diagnosticHolder.report(Errors.ACTUAL_MISSING.on(reportOn)) diagnosticHolder.report(Errors.ACTUAL_MISSING.on(reportOn))
} }
} }