USELESS_ELVIS_RIGHT_IS_NULL is no more reported for flexible left argument #KT-13593 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-12-22 18:22:07 +03:00
parent 8d16bd1215
commit 0e70e3f80e
3 changed files with 40 additions and 1 deletions
@@ -1284,7 +1284,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (leftType != null && isKnownToBeNotNull(left, leftType, context)) {
context.trace.report(USELESS_ELVIS.on(expression, leftType));
}
else if (KtPsiUtil.isNullConstant(right)) {
else if (KtPsiUtil.isNullConstant(right) && leftType != null && !FlexibleTypesKt.isNullabilityFlexible(leftType)) {
context.trace.report(USELESS_ELVIS_RIGHT_IS_NULL.on(expression));
}
KotlinTypeInfo rightTypeInfo = BindingContextUtils.getRecordedTypeInfo(right, context.trace.getBindingContext());