Partial body resolve: fixed for ! and parenthesis in conditions

This commit is contained in:
Valentin Kipyatkov
2015-03-25 19:08:02 +03:00
parent 698d839eee
commit cd18b16407
4 changed files with 28 additions and 0 deletions
@@ -319,6 +319,18 @@ class PartialBodyResolveFilter(
val cast = condition.getLeftHandSide().smartCastExpressionName().singletonOrEmptySet()
return if (condition.isNegated()) Pair(setOf(), cast) else Pair(cast, setOf())
}
is JetPrefixExpression -> {
if (condition.getOperationToken() == JetTokens.EXCL) {
val operand = condition.getBaseExpression() ?: return emptyResult
return possiblySmartCastInCondition(operand).swap()
}
}
is JetParenthesizedExpression -> {
val operand = condition.getExpression() ?: return emptyResult
return possiblySmartCastInCondition(operand)
}
}
return emptyResult