Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed #KT-38427 Fixed #KT-39953 Fixed #KT-38899 Fixed
This commit is contained in:
@@ -4,7 +4,7 @@ fun foo(): String {
|
||||
s = null
|
||||
<!DEBUG_INFO_CONSTANT!>s<!>?.length
|
||||
<!OI;DEBUG_INFO_CONSTANT!>s<!><!UNSAFE_CALL!>.<!>length
|
||||
if (<!SENSELESS_COMPARISON!><!DEBUG_INFO_CONSTANT!>s<!> == null<!>) <!NI;UNREACHABLE_CODE!>return<!> <!ALWAYS_NULL!>s<!>!!
|
||||
if (<!SENSELESS_COMPARISON!><!DEBUG_INFO_CONSTANT!>s<!> == null<!>) return <!ALWAYS_NULL!>s<!>!!
|
||||
var t: String? = "y"
|
||||
if (t == null) t = "x"
|
||||
var x: Int? = null
|
||||
|
||||
@@ -14,7 +14,7 @@ class Example {
|
||||
|
||||
public fun foo(): String {
|
||||
// Smart cast is not possible if property is delegated
|
||||
return <!NI;TYPE_MISMATCH!>if (p != null) <!NI;SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>p<!> else ""<!>
|
||||
return if (p != null) <!SMARTCAST_IMPOSSIBLE!>p<!> else ""
|
||||
}
|
||||
|
||||
public fun bar(): String {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
fun basic(): String {
|
||||
var current: String? = null
|
||||
current = if (current == null) "bar" else <!NI;DEBUG_INFO_SMARTCAST!>current<!>
|
||||
current = if (current == null) "bar" else current
|
||||
return <!DEBUG_INFO_SMARTCAST!>current<!>
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
class MyClass
|
||||
|
||||
operator fun MyClass.inc(): MyClass { <!UNREACHABLE_CODE!>return<!> null!! }
|
||||
operator fun MyClass.inc(): MyClass { <!OI;UNREACHABLE_CODE!>return<!> null!! }
|
||||
|
||||
public fun box() : MyClass? {
|
||||
var i : MyClass?
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
class MyClass
|
||||
|
||||
operator fun MyClass.inc(): MyClass { <!UNREACHABLE_CODE!>return<!> null!! }
|
||||
operator fun MyClass.inc(): MyClass { <!OI;UNREACHABLE_CODE!>return<!> null!! }
|
||||
|
||||
public fun box() {
|
||||
var i : MyClass?
|
||||
|
||||
Reference in New Issue
Block a user