Added exception to catch the situation causing #11404

This commit is contained in:
yairm210
2024-04-07 00:07:00 +03:00
parent 027e56d6a7
commit 08bfa381a1

View File

@ -207,6 +207,11 @@ class UniqueValidator(val ruleset: Ruleset) {
if (unique.type == null) return emptyList() if (unique.type == null) return emptyList()
val errorList = ArrayList<UniqueComplianceError>() val errorList = ArrayList<UniqueComplianceError>()
for ((index, param) in unique.params.withIndex()) { for ((index, param) in unique.params.withIndex()) {
// Trying to catch the error at #11404
if (unique.type.parameterTypeMap.size != unique.params.size) {
throw Exception("Unique ${unique.text} has ${unique.params.size} parameters, " +
"but its type ${unique.type} only ${unique.type.parameterTypeMap.size} parameters?!")
}
val acceptableParamTypes = unique.type.parameterTypeMap[index] val acceptableParamTypes = unique.type.parameterTypeMap[index]
val errorTypesForAcceptableParameters = val errorTypesForAcceptableParameters =
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) } acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }