Use safe cast

This commit is contained in:
Toshiaki Kameyama
2019-06-13 15:38:03 +09:00
committed by Mikhail Glukhikh
parent 0fad3fafa8
commit 5dd0110a59
@@ -127,7 +127,7 @@ abstract class DeprecatedSymbolUsageFixBase(
val receiver = classLiteral.receiverExpression ?: return this
val typeParameterText = (descriptor as? CallableDescriptor)?.typeParameters?.firstOrNull()?.name?.asString() ?: return this
if (receiver.text != typeParameterText) return this
val typeReference = (element.parent as KtCallExpression).typeArguments.firstOrNull()?.typeReference ?: return this
val typeReference = (element.parent as? KtCallExpression)?.typeArguments?.firstOrNull()?.typeReference ?: return this
val type = element.analyze(BodyResolveMode.PARTIAL)[BindingContext.TYPE, typeReference]
if (type != null && KotlinBuiltIns.isArray(type)) {
receiver.replace(typeReference)