EA-215308: Fix unsafe check casts in template entry handling
This commit is contained in:
+4
-2
@@ -243,9 +243,10 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||||||
val toFromOriginalFileMapper = ToFromOriginalFileMapper.create(parameters)
|
val toFromOriginalFileMapper = ToFromOriginalFileMapper.create(parameters)
|
||||||
|
|
||||||
if (position.node.elementType == KtTokens.LONG_TEMPLATE_ENTRY_START) {
|
if (position.node.elementType == KtTokens.LONG_TEMPLATE_ENTRY_START) {
|
||||||
val expression = (position.parent as KtBlockStringTemplateEntry).expression
|
val expression = (position.parent as? KtBlockStringTemplateEntry)?.expression
|
||||||
if (expression is KtDotQualifiedExpression) {
|
if (expression is KtDotQualifiedExpression) {
|
||||||
val correctedPosition = (expression.selectorExpression as KtNameReferenceExpression).firstChild
|
val correctedPosition = (expression.selectorExpression as? KtNameReferenceExpression)?.firstChild
|
||||||
|
if (correctedPosition != null) {
|
||||||
// Workaround for KT-16848
|
// Workaround for KT-16848
|
||||||
// ex:
|
// ex:
|
||||||
// expression: some.IntellijIdeaRulezzz
|
// expression: some.IntellijIdeaRulezzz
|
||||||
@@ -259,6 +260,7 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
doComplete(parameters, toFromOriginalFileMapper, result)
|
doComplete(parameters, toFromOriginalFileMapper, result)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user