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