[FIR] Drop useless check cast to FirCall in FirConstChecks
This commit is contained in:
+5
-5
@@ -83,7 +83,7 @@ internal fun checkConstantArguments(
|
||||
return checkConstantArguments(expression.compareToCall, session)
|
||||
}
|
||||
expression is FirStringConcatenationCall -> {
|
||||
for (exp in (expression as FirCall).arguments) {
|
||||
for (exp in expression.arguments) {
|
||||
if (exp is FirResolvedQualifier || exp is FirGetClassCall) {
|
||||
return ConstantArgumentKind.NOT_CONST
|
||||
}
|
||||
@@ -95,7 +95,7 @@ internal fun checkConstantArguments(
|
||||
return ConstantArgumentKind.NOT_CONST
|
||||
}
|
||||
|
||||
for (exp in (expression as FirCall).arguments) {
|
||||
for (exp in expression.arguments) {
|
||||
if (exp is FirConstExpression<*> && exp.value == null) {
|
||||
return ConstantArgumentKind.NOT_CONST
|
||||
}
|
||||
@@ -111,17 +111,17 @@ internal fun checkConstantArguments(
|
||||
checkConstantArguments(expression.rightOperand, session)?.let { return it }
|
||||
}
|
||||
expression is FirGetClassCall -> {
|
||||
var coneType = (expression as? FirCall)?.argument?.getExpandedType()
|
||||
var coneType = expression.argument.getExpandedType()
|
||||
|
||||
if (coneType is ConeErrorType)
|
||||
return ConstantArgumentKind.NOT_CONST
|
||||
|
||||
while (coneType?.classId == StandardClassIds.Array)
|
||||
while (coneType.classId == StandardClassIds.Array)
|
||||
coneType = (coneType.lowerBoundIfFlexible().typeArguments.first() as? ConeKotlinTypeProjection)?.type ?: break
|
||||
|
||||
return when {
|
||||
coneType is ConeTypeParameterType -> ConstantArgumentKind.KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR
|
||||
(expression as FirCall).argument !is FirResolvedQualifier -> ConstantArgumentKind.NOT_KCLASS_LITERAL
|
||||
expression.argument !is FirResolvedQualifier -> ConstantArgumentKind.NOT_KCLASS_LITERAL
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user