Introduce inspection for nullable extension receiver of inline function
So #KT-22303 Fixed
This commit is contained in:
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public class JavaClass {
|
||||
public static String getNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static My getMy() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
fun test() {
|
||||
JavaClass.getNull().toBoolean() // ISE in runtime
|
||||
JavaClass.getNull().toInt() // OK
|
||||
"123".toBoolean() // OK
|
||||
null.toBoolean() // Compilation error, no inspection message
|
||||
|
||||
JavaClass.getNull().contentNotInline() // OK
|
||||
JavaClass.getMy().contentNonExtensionInlineFun() // OK
|
||||
}
|
||||
|
||||
fun String.contentNotInline() {}
|
||||
|
||||
class My {
|
||||
inline fun contentNonExtensionInlineFun() {}
|
||||
}
|
||||
Reference in New Issue
Block a user