no report 'UNNECESSARY_NOT_NULL_ASSERTION' on error types

This commit is contained in:
Svetlana Isakova
2012-09-19 15:21:45 +04:00
parent 0ff9d95704
commit 0ccdf79051
3 changed files with 13 additions and 1 deletions
@@ -885,7 +885,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
return typeInfo;
}
DataFlowInfo dataFlowInfo = typeInfo.getDataFlowInfo();
if (isKnownToBeNotNull(baseExpression, context)) {
if (isKnownToBeNotNull(baseExpression, context) && !ErrorUtils.isErrorType(type)) {
context.trace.report(UNNECESSARY_NOT_NULL_ASSERTION.on(operationSign, type));
}
else {
@@ -0,0 +1,7 @@
package a
fun foo() {
bar()!!
}
fun bar() = <!UNRESOLVED_REFERENCE!>aa<!>
@@ -2098,6 +2098,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt362.kt");
}
@TestMetadata("noUnnecessaryNotNullAssertionOnErrorType.kt")
public void testNoUnnecessaryNotNullAssertionOnErrorType() throws Exception {
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/noUnnecessaryNotNullAssertionOnErrorType.kt");
}
@TestMetadata("NullableNothingIsExactlyNull.kt")
public void testNullableNothingIsExactlyNull() throws Exception {
doTest("compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/NullableNothingIsExactlyNull.kt");