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