[IR] Always validate properties
This is a fundamental invariant that should always hold.
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/IrValidator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/IrValidator.kt
index 286008b..7d8a141 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/IrValidator.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/IrValidator.kt
@@ -21,7 +21,6 @@
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
-import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
@@ -38,7 +37,6 @@
data class IrValidatorConfig(
val checkTreeConsistency: Boolean = true,
val checkTypes: Boolean = false,
- val checkProperties: Boolean = false,
val checkValueScopes: Boolean = false,
val checkTypeParameterScopes: Boolean = false,
val checkCrossFileFieldUsage: Boolean = false,
@@ -119,15 +117,16 @@
private val breakContinueCheckers: MutableList<IrBreakContinueChecker> = mutableListOf()
private val returnCheckers: MutableList<IrReturnChecker> = mutableListOf()
private val throwCheckers: MutableList<IrThrowChecker> = mutableListOf()
- private val functionCheckers: MutableList<IrFunctionChecker> =
- mutableListOf(IrFunctionDispatchReceiverChecker, IrFunctionParametersChecker, IrConstructorReceiverChecker)
+ private val functionCheckers: MutableList<IrFunctionChecker> = mutableListOf(
+ IrFunctionDispatchReceiverChecker, IrFunctionParametersChecker, IrConstructorReceiverChecker, IrFunctionPropertiesChecker
+ )
private val declarationBaseCheckers: MutableList<IrDeclarationChecker<IrDeclaration>> =
mutableListOf(IrPrivateDeclarationOverrideChecker)
private val propertyReferenceCheckers: MutableList<IrPropertyReferenceChecker> = mutableListOf()
private val localDelegatedPropertyReferenceCheckers: MutableList<IrLocalDelegatedPropertyReferenceChecker> = mutableListOf()
private val expressionCheckers: MutableList<IrExpressionChecker<IrExpression>> = mutableListOf()
private val typeOperatorCheckers: MutableList<IrTypeOperatorChecker> = mutableListOf(IrTypeOperatorTypeOperandChecker)
- private val propertyCheckers: MutableList<IrPropertyChecker> = mutableListOf()
+ private val propertyCheckers: MutableList<IrPropertyChecker> = mutableListOf(IrPropertyAccessorsChecker)
private val callCheckers: MutableList<IrCallChecker> = mutableListOf()
@@ -171,10 +170,6 @@
throwCheckers.add(IrNothingTypeExpressionChecker)
fieldAccessExpressionCheckers.add(IrDynamicTypeFieldAccessChecker)
}
- if (config.checkProperties) {
- functionCheckers.add(IrFunctionPropertiesChecker)
- propertyCheckers.add(IrPropertyAccessorsChecker)
- }
if (config.checkFunctionBody) {
functionCheckers.add(IrFunctionBodyChecker)
}
diff --git a/compiler/ir/backend.common/test/org/jetbrains/kotlin/backend/common/IrValidatorTest.kt b/compiler/ir/backend.common/test/org/jetbrains/kotlin/backend/common/IrValidatorTest.kt
index 8499dd1..c8c904e 100644
--- a/compiler/ir/backend.common/test/org/jetbrains/kotlin/backend/common/IrValidatorTest.kt
+++ b/compiler/ir/backend.common/test/org/jetbrains/kotlin/backend/common/IrValidatorTest.kt
@@ -153,7 +153,6 @@
phaseName = "IrValidatorTest",
IrValidatorConfig(
checkTypes = true,
- checkProperties = true,
checkValueScopes = true,
checkTypeParameterScopes = true,
checkCrossFileFieldUsage = true,
diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/irValidation.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/irValidation.kt
index 0e2977b..9dc0c35 100644
--- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/irValidation.kt
+++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/irValidation.kt
@@ -27,7 +27,6 @@
) : IrValidationBeforeLoweringPhase<JvmBackendContext>(context) {
override val defaultValidationConfig: IrValidatorConfig
get() = super.defaultValidationConfig.copy(
- checkProperties = true,
checkCrossFileFieldUsage = false,
checkAllKotlinFieldsArePrivate = false,
checkFunctionBody = false,
@@ -40,7 +39,6 @@
) : IrValidationAfterLoweringPhase<JvmBackendContext>(context) {
override val defaultValidationConfig: IrValidatorConfig
get() = super.defaultValidationConfig.copy(
- checkProperties = true,
checkCrossFileFieldUsage = false,
checkAllKotlinFieldsArePrivate = false,
checkFunctionBody = false,