no senseless comparison for error type
This commit is contained in:
+2
@@ -1251,6 +1251,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
JetType type = facade.getTypeInfo(expr, context).getType();
|
||||
if (type == null || ErrorUtils.isErrorType(type)) return;
|
||||
|
||||
DataFlowValue value = DataFlowValueFactory.INSTANCE.createDataFlowValue(expr, type, context.trace.getBindingContext());
|
||||
Nullability nullability = context.dataFlowInfo.getNullability(value);
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package a
|
||||
|
||||
fun foo() {
|
||||
val a = <!UNRESOLVED_REFERENCE!>getErrorType<!>()
|
||||
if (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>==<!> null) { //no senseless comparison
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1893,6 +1893,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/kt2014.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoSenselessComparisonForErrorType.kt")
|
||||
public void testNoSenselessComparisonForErrorType() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/NoSenselessComparisonForErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("plusOnTheRight.kt")
|
||||
public void testPlusOnTheRight() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/plusOnTheRight.kt");
|
||||
|
||||
Reference in New Issue
Block a user