Limit "always null" scope: only for !!, is and dot; senseless comparison rolled back; "smart constant" information for nulls #KT-10029 Fixed
This commit is contained in:
Vendored
+8
-8
@@ -4,7 +4,7 @@ fun test() {
|
||||
a.plus(1)
|
||||
}
|
||||
else {
|
||||
<warning>a</warning>?.plus(1)
|
||||
a?.plus(1)
|
||||
}
|
||||
|
||||
val out : java.io.PrintStream? = null
|
||||
@@ -28,7 +28,7 @@ fun test() {
|
||||
}
|
||||
|
||||
if (out == null) {
|
||||
<warning>out</warning>?.println()
|
||||
out?.println()
|
||||
} else {
|
||||
out.println()
|
||||
}
|
||||
@@ -84,7 +84,7 @@ fun test() {
|
||||
}
|
||||
|
||||
if (out == null) {
|
||||
<warning>out</warning>?.println()
|
||||
out?.println()
|
||||
} else {
|
||||
out.println()
|
||||
}
|
||||
@@ -131,12 +131,12 @@ fun test() {
|
||||
while (out != null) {
|
||||
out.println();
|
||||
}
|
||||
<warning>out</warning>?.println();
|
||||
out?.println();
|
||||
|
||||
val out2 : java.io.PrintStream? = null
|
||||
|
||||
while (out2 == null) {
|
||||
<warning>out2</warning>?.println();
|
||||
out2?.println();
|
||||
}
|
||||
out2.println()
|
||||
|
||||
@@ -224,7 +224,7 @@ fun f7(s : String?, t : String?) {
|
||||
}
|
||||
s?.get(0)
|
||||
if (!(s != null)) {
|
||||
<warning>s</warning>?.get(0)
|
||||
s?.get(0)
|
||||
}
|
||||
else {
|
||||
s.get(0)
|
||||
@@ -234,7 +234,7 @@ fun f7(s : String?, t : String?) {
|
||||
s.get(0)
|
||||
}
|
||||
else {
|
||||
<warning>s</warning>?.get(0)
|
||||
s?.get(0)
|
||||
}
|
||||
s?.get(0)
|
||||
t?.get(0)
|
||||
@@ -253,7 +253,7 @@ fun f7(s : String?, t : String?) {
|
||||
t?.get(0)
|
||||
}
|
||||
else {
|
||||
<warning>s</warning>?.get(0)
|
||||
s?.get(0)
|
||||
t?.get(0)
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
class <info textAttributesKey="KOTLIN_CLASS">My</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_PARAMETER"><info textAttributesKey="KOTLIN_PROPERTY_WITH_BACKING_FIELD">x</info></info></info>: <info textAttributesKey="KOTLIN_CLASS">Int</info>?)
|
||||
|
||||
fun <info textAttributesKey="KOTLIN_CLASS">My</info>?.<info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</info>(): <info textAttributesKey="KOTLIN_CLASS">Int</info> {
|
||||
if (this == null || <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_SMART_CAST_RECEIVER">x</info></info> == null) return 42
|
||||
if (this == null) return 42
|
||||
if (<info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_SMART_CAST_RECEIVER">x</info></info> == null) {
|
||||
if (<warning textAttributesKey="WARNING_ATTRIBUTES"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_SMART_CONSTANT"><info textAttributesKey="KOTLIN_SMART_CAST_RECEIVER">x</info></info></info> != null</warning>) {
|
||||
<warning textAttributesKey="WARNING_ATTRIBUTES">return</warning> <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_SMART_CAST_RECEIVER"><info textAttributesKey="KOTLIN_SMART_CAST_VALUE">x</info></info></info>
|
||||
}
|
||||
return 13
|
||||
}
|
||||
return <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_SMART_CAST_RECEIVER"><info textAttributesKey="KOTLIN_SMART_CAST_VALUE">x</info></info></info>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user