supertype of error type should be an error type, not any
This commit is contained in:
@@ -47,6 +47,9 @@ public class CommonSupertypes {
|
||||
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type)) {
|
||||
iterator.remove();
|
||||
}
|
||||
if (ErrorUtils.isErrorType(type)) {
|
||||
return ErrorUtils.createErrorType("Supertype of error type " + type);
|
||||
}
|
||||
nullable |= type.isNullable();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package a
|
||||
|
||||
import java.util.Date
|
||||
import java.util.Comparator
|
||||
|
||||
|
||||
fun foo() {
|
||||
|
||||
val <!UNUSED_VARIABLE!>c<!>: Comparator<Date?> = comparator {(date1, date2) ->
|
||||
if (date1 != null && date2 != null) {
|
||||
date1.compareTo(date2) * -11
|
||||
} else {
|
||||
11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(val i: Int, val a: <!UNRESOLVED_REFERENCE!>U<!>) {
|
||||
val r = if (true) i else <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
|
||||
val <!UNUSED_VARIABLE!>b<!>: Any = <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>r<!>
|
||||
}
|
||||
|
||||
//from standard library
|
||||
public inline fun <T> comparator(<!UNUSED_PARAMETER!>fn<!>: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
@@ -1913,6 +1913,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/senselessComparisonWithNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("SupertypeOfErrorType.kt")
|
||||
public void testSupertypeOfErrorType() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError")
|
||||
public static class DiagnosticWithSyntaxError extends AbstractDiagnosticsTestWithEagerResolve {
|
||||
public void testAllFilesPresentInDiagnosticWithSyntaxError() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user