Misc: Follow-up fixes for 172/182 bunches
This commit is contained in:
+7
-1
@@ -129,7 +129,13 @@ sealed class CreateCallableFromCallActionFactory<E : KtExpression>(
|
|||||||
if (javaClass == null || !javaClass.canRefactor()) return null
|
if (javaClass == null || !javaClass.canRefactor()) return null
|
||||||
TypeInfo.StaticContextRequired(TypeInfo(javaClassifier.defaultType, Variance.IN_VARIANCE))
|
TypeInfo.StaticContextRequired(TypeInfo(javaClassifier.defaultType, Variance.IN_VARIANCE))
|
||||||
}
|
}
|
||||||
is ReceiverValue -> TypeInfo(receiver.type, Variance.IN_VARIANCE)
|
is ReceiverValue -> {
|
||||||
|
val originalType = receiver.type
|
||||||
|
val finalType = if (receiver is ExpressionReceiver) {
|
||||||
|
getDataFlowAwareTypes(receiver.expression, context, originalType).firstOrNull() ?: originalType
|
||||||
|
} else originalType
|
||||||
|
TypeInfo(finalType, Variance.IN_VARIANCE)
|
||||||
|
}
|
||||||
else -> throw AssertionError("Unexpected receiver: $receiver")
|
else -> throw AssertionError("Unexpected receiver: $receiver")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ fun PsiElement.canRefactor(): Boolean {
|
|||||||
this is KtElement ||
|
this is KtElement ||
|
||||||
this is PsiMember && language == JavaLanguage.INSTANCE ||
|
this is PsiMember && language == JavaLanguage.INSTANCE ||
|
||||||
this is PsiDirectory ->
|
this is PsiDirectory ->
|
||||||
ProjectRootsUtil.isInProjectSource(this)
|
ProjectRootsUtil.isInProjectSource(this) || ((containingFile as? KtFile)?.isScript() ?: false)
|
||||||
else ->
|
else ->
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user