Do not unbox nullable Result, since before usage it is coerced
#KT-46505
This commit is contained in:
+9
-4
@@ -6,17 +6,22 @@ object Foo {
|
||||
}
|
||||
|
||||
fun bar(value: Value?) {
|
||||
res = value?.value!!
|
||||
res = value?.value
|
||||
}
|
||||
}
|
||||
|
||||
var res = "FAIL"
|
||||
var res: String? = "FAIL"
|
||||
|
||||
fun box(): String {
|
||||
Value("OK").let(Foo::foo)
|
||||
if (res != "OK") return "FAIL 1: $res"
|
||||
res = "FAIL"
|
||||
res = "FAIL 2"
|
||||
|
||||
Value("OK").let(Foo::bar)
|
||||
return res
|
||||
if (res != "OK") return "FAIL 3: $res"
|
||||
res = "FAIL 4"
|
||||
|
||||
null.let(Foo::bar)
|
||||
if (res != null) return "FAIL 3: $res"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user