KT-2109 Nullability inference fails in extension function
#KT-2109 Fixed
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ public class DataFlowValueFactory {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public DataFlowValue createDataFlowValue(@NotNull ThisReceiverDescriptor receiver) {
|
public DataFlowValue createDataFlowValue(@NotNull ThisReceiverDescriptor receiver) {
|
||||||
JetType type = receiver.getType();
|
JetType type = receiver.getType();
|
||||||
return new DataFlowValue(receiver.getDeclarationDescriptor(), type, true, getImmanentNullability(type));
|
return new DataFlowValue(receiver, type, true, getImmanentNullability(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//KT-2109 Nullability inference fails in extension function
|
||||||
|
package kt2109
|
||||||
|
|
||||||
|
class A {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun A?.bar() {
|
||||||
|
if (this == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun A.baz() {
|
||||||
|
if (<!SENSELESS_COMPARISON!>this == null<!>) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
foo()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user