fixed bug
NULL_FOR_NONNULL_TYPE can represent type mismatch error as well (later the whole method 'makeTraceInterceptingTypeMismatch' should be removed)
This commit is contained in:
+1
-1
@@ -462,7 +462,7 @@ public class ExpressionTypingUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void report(@NotNull Diagnostic diagnostic) {
|
public void report(@NotNull Diagnostic diagnostic) {
|
||||||
AbstractDiagnosticFactory factory = diagnostic.getFactory();
|
AbstractDiagnosticFactory factory = diagnostic.getFactory();
|
||||||
if ((factory == TYPE_MISMATCH || factory == CONSTANT_EXPECTED_TYPE_MISMATCH)
|
if ((factory == TYPE_MISMATCH || factory == CONSTANT_EXPECTED_TYPE_MISMATCH || factory == NULL_FOR_NONNULL_TYPE)
|
||||||
&& diagnostic.getPsiElement() == expressionToWatch) {
|
&& diagnostic.getPsiElement() == expressionToWatch) {
|
||||||
mismatchFound[0] = true;
|
mismatchFound[0] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package m
|
||||||
|
|
||||||
|
trait Element
|
||||||
|
|
||||||
|
fun test(handlers: Map<String, Element.()->Unit>) {
|
||||||
|
|
||||||
|
handlers.getOrElse("name", { null })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <K,V> Map<K,V>.getOrElse(key: K, defaultValue: ()-> V) : V = throw Exception("$key $defaultValue")
|
||||||
@@ -2685,6 +2685,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
doTest("compiler/testData/diagnostics/tests/functionLiterals/NoDanglingFunctionLiteralForNestedCalls.kt");
|
doTest("compiler/testData/diagnostics/tests/functionLiterals/NoDanglingFunctionLiteralForNestedCalls.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("returnNull.kt")
|
||||||
|
public void testReturnNull() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/functionLiterals/returnNull.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unusedLiteral.kt")
|
@TestMetadata("unusedLiteral.kt")
|
||||||
public void testUnusedLiteral() throws Exception {
|
public void testUnusedLiteral() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt");
|
doTest("compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user