Fix anonymous function literals handling in type checker

- [NI] Create type info directly if the expected type is functional.
- Properly handle suspended function expected type.
This commit is contained in:
Dmitry Petrov
2017-06-07 13:06:45 +03:00
committed by Mikhail Zarechenskiy
parent 6facdcb7ea
commit 26cc08be65
3 changed files with 32 additions and 7 deletions
@@ -4,3 +4,8 @@ val test1: suspend () -> Unit = {}
val test2: suspend Any.() -> Unit = {}
val test3: suspend Any.(Int) -> Int = { k: Int -> k + 1 }
val test4: SuspendFn = {}
val test1f: suspend () -> Unit = fun () {}
val test2f: suspend Any.() -> Unit = fun Any.() {}
val test3f: suspend Any.(Int) -> Int = fun (k: Int) = k + 1
val test4f: SuspendFn = fun Any.() {}
@@ -1,7 +1,11 @@
package
public val test1: suspend () -> kotlin.Unit
public val test1f: suspend () -> kotlin.Unit
public val test2: suspend kotlin.Any.() -> kotlin.Unit
public val test2f: suspend kotlin.Any.() -> kotlin.Unit
public val test3: suspend kotlin.Any.(kotlin.Int) -> kotlin.Int
public val test3f: suspend kotlin.Any.(kotlin.Int) -> kotlin.Int
public val test4: SuspendFn /* = suspend () -> kotlin.Unit */
public val test4f: SuspendFn /* = suspend () -> kotlin.Unit */
public typealias SuspendFn = suspend () -> kotlin.Unit