Another TypeUtils.isNullableType() introduced
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ public class CompileTimeConstantChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkNullValue(@NotNull JetType expectedType, @NotNull JetConstantExpression expression) {
|
private boolean checkNullValue(@NotNull JetType expectedType, @NotNull JetConstantExpression expression) {
|
||||||
if (!noExpectedTypeOrError(expectedType) && !expectedType.isNullable()) {
|
if (!noExpectedTypeOrError(expectedType) && !TypeUtils.isNullableType(expectedType)) {
|
||||||
return reportError(NULL_FOR_NONNULL_TYPE.on(expression, expectedType));
|
return reportError(NULL_FOR_NONNULL_TYPE.on(expression, expectedType));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// FILE: p/SAM.java
|
||||||
|
|
||||||
|
package p;
|
||||||
|
|
||||||
|
public interface SAM<R> {
|
||||||
|
R foo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: p/Util.java
|
||||||
|
|
||||||
|
package p;
|
||||||
|
|
||||||
|
public class Util {
|
||||||
|
|
||||||
|
public static void sam(SAM<Void> sam) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: k.kt
|
||||||
|
|
||||||
|
import p.*
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
Util.sam {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7848,6 +7848,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sam.kt")
|
||||||
|
public void testSam() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/platformTypes/methodCall/sam.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("singleton.kt")
|
@TestMetadata("singleton.kt")
|
||||||
public void testSingleton() throws Exception {
|
public void testSingleton() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall/singleton.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall/singleton.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user