USELESS_ELVIS_RIGHT_IS_NULL is no more reported for flexible left argument #KT-13593 Fixed
This commit is contained in:
+1
-1
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user