KT-2109 Nullability inference fails in extension function

#KT-2109 Fixed
This commit is contained in:
Alexander Udalov
2012-06-20 14:23:02 +04:00
parent 9e727623c2
commit c613b991bf
2 changed files with 21 additions and 1 deletions
@@ -52,7 +52,7 @@ public class DataFlowValueFactory {
@NotNull
public DataFlowValue createDataFlowValue(@NotNull ThisReceiverDescriptor receiver) {
JetType type = receiver.getType();
return new DataFlowValue(receiver.getDeclarationDescriptor(), type, true, getImmanentNullability(type));
return new DataFlowValue(receiver, type, true, getImmanentNullability(type));
}
@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()
}