Type parameter as result type: more precise expected type definition #KT-5385 Fixed
Tests for KT-5385 KT-10223 KT-7800 KT-7817 + something related
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class Foo(val s: String)
|
||||
fun foo(): Foo? = Foo("OK")
|
||||
|
||||
fun <T> run(f: () -> T): T = f()
|
||||
|
||||
val foo: Foo = run {
|
||||
val x = foo()
|
||||
if (x == null) throw Exception()
|
||||
x
|
||||
}
|
||||
|
||||
fun box() = foo.s
|
||||
Reference in New Issue
Block a user