Hopefully fixed EA-87200 - TCE: UtilsKt.tryChangeAndCheckErrors
#EA-87200 Fixed
This commit is contained in:
@@ -247,6 +247,7 @@ private fun isExpressionTypeSupported(expression: KtExpression): Boolean {
|
||||
private fun checkSmartCastsPreserved(loop: KtForExpression, matchResult: MatchResult): Boolean {
|
||||
val bindingContext = loop.analyze(BodyResolveMode.FULL)
|
||||
|
||||
// we declare these keys locally to avoid possible race-condition problems if this code is executed in 2 threads simultaneously
|
||||
val SMARTCAST_KEY = Key<ExplicitSmartCasts>("SMARTCAST_KEY")
|
||||
val IMPLICIT_RECEIVER_SMARTCAST_KEY = Key<ImplicitSmartCasts>("IMPLICIT_RECEIVER_SMARTCAST")
|
||||
|
||||
|
||||
@@ -228,9 +228,6 @@ fun canChangeLocalVariableType(variable: KtProperty, newTypeText: String, loop:
|
||||
}
|
||||
}
|
||||
|
||||
private val EXPRESSION = Key<Unit>("EXPRESSION")
|
||||
private val SCOPE_TO_EXCLUDE = Key<Unit>("SCOPE_TO_EXCLUDE")
|
||||
|
||||
fun <TExpression : KtExpression> tryChangeAndCheckErrors(
|
||||
expressionToChange: TExpression,
|
||||
scopeToExclude: KtElement,
|
||||
@@ -244,6 +241,10 @@ fun <TExpression : KtExpression> tryChangeAndCheckErrors(
|
||||
.firstOrNull { bindingContext[BindingContext.USED_AS_EXPRESSION, it] != true }
|
||||
?: return true
|
||||
|
||||
// we declare these keys locally to avoid possible race-condition problems if this code is executed in 2 threads simultaneously
|
||||
val EXPRESSION = Key<Unit>("EXPRESSION")
|
||||
val SCOPE_TO_EXCLUDE = Key<Unit>("SCOPE_TO_EXCLUDE")
|
||||
|
||||
expressionToChange.putCopyableUserData(EXPRESSION, Unit)
|
||||
scopeToExclude.putCopyableUserData(SCOPE_TO_EXCLUDE, Unit)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user