This is a doozy..... this works: ``` val x: sus...
# getting-started
v
This is a doozy..... this works:
Copy code
val x: suspend ((String) -> Int) = run {
      { str -> delay(1); str.length }
    }
But adding explicit
String
type to lambda causes a compilation error:
Copy code
val x: suspend ((String) -> Int) = run {
      { str: String -> delay(1); str.length }
    }

Type mismatch: 
Required: suspend (String) -> Int
Found: (String) -> Int
Adding
suspend
doesn't help:
Copy code
val x: suspend ((String) -> Int) = run {
      suspend { str: String -> delay(1); str.length }
    }

Type mismatch: 
Required: suspend (String) -> Int
Found: suspend () -> Int
Going further with the anonymous lambda syntax doesn't help either... P.S. Kotlin 2.1.10