Fix incorrect "senseless null in when" on nullable type

This commit is contained in:
Alexander Udalov
2014-10-17 13:21:33 +04:00
parent fe59dc27b3
commit 63366042ed
4 changed files with 56 additions and 1 deletions
@@ -320,7 +320,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
}
// check if the pattern is essentially a 'null' expression
if (KotlinBuiltIns.getInstance().isNullableNothing(type) && !subjectType.isNullable()) {
if (KotlinBuiltIns.getInstance().isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {
context.trace.report(SENSELESS_NULL_IN_WHEN.on(reportErrorOn));
}
}