Add structured coroutines and explicit error handling

This commit is contained in:
pavel 2026-08-27 16:26:40 +02:00
commit fe62e81152
31 changed files with 1701 additions and 325 deletions

View file

@ -998,6 +998,10 @@ func functionSemanticDiagnostics(text string, fn lang.FunctionDecl, functions ma
}
case lang.SelectorExpr:
walkExpr(e.Receiver, scope)
case lang.SafeSelectorExpr:
walkExpr(e.Receiver, scope)
case lang.NonNullExpr:
walkExpr(e.Value, scope)
case lang.IndexExpr:
walkExpr(e.Receiver, scope)
walkExpr(e.Index, scope)
@ -2192,33 +2196,42 @@ func builtinHoverDetail(name string) (string, bool) {
}
var builtinDetails = map[string]string{
"println": "fun println(value: Any): Unit",
"runCatching": "fun runCatching(block: () -> Unit): Result",
"Channel": "fun Channel<T>(capacity: Int = 0): Channel<T>",
"after": "fun after(ms: Int): Channel<time.Time>",
"every": "fun every(ms: Int): Channel<time.Time>",
"listOf": "fun listOf<T>(values: T...): List<T>",
"mutableListOf": "fun mutableListOf<T>(values: T...): MutableList<T>",
"mapOf": "fun mapOf<K, V>(pairs: Any...): Map<K, V>",
"mutableMapOf": "fun mutableMapOf<K, V>(pairs: Any...): MutableMap<K, V>",
"ByteSlice": "fun ByteSlice(value: String): ByteSlice",
"append": "fun append<T>(values: List<T>, value: T): List<T>",
"len": "fun len(value: Any): Int",
"cap": "fun cap(value: Any): Int",
"make": "fun make<T>(size: Int): T",
"new": "fun new<T>(): *T",
"copy": "fun copy(target: Any, source: Any): Int",
"delete": "fun delete(map: Any, key: Any): Unit",
"close": "fun close(channel: Any): Unit",
"panic": "fun panic(value: Any): Unit",
"recover": "fun recover(): Any",
"string": "fun string(value: Any): String",
"int": "fun int(value: Any): Int",
"float64": "fun float64(value: Any): Double",
"bool": "fun bool(value: Any): Boolean",
"sql": "typed PostgreSQL query DSL",
"set": "fun set(target: Any, value: Any): Unit",
"now": "fun now(): time.Time",
"println": "fun println(value: Any): Unit",
"runCatching": "fun runCatching(block: () -> Unit): Result",
"Channel": "fun Channel<T>(capacity: Int = 0): Channel<T>",
"after": "fun after(ms: Int): Channel<time.Time>",
"every": "fun every(ms: Int): Channel<time.Time>",
"listOf": "fun listOf<T>(values: T...): List<T>",
"mutableListOf": "fun mutableListOf<T>(values: T...): MutableList<T>",
"mapOf": "fun mapOf<K, V>(pairs: Any...): Map<K, V>",
"mutableMapOf": "fun mutableMapOf<K, V>(pairs: Any...): MutableMap<K, V>",
"ByteSlice": "fun ByteSlice(value: String | Int): ByteSlice",
"append": "fun append<T>(values: List<T>, value: T): List<T>",
"keys": "fun keys<K, V>(values: Map<K, V>): List<K>",
"goAssert": "fun goAssert<T>(value: Any): T",
"len": "fun len(value: Any): Int",
"cap": "fun cap(value: Any): Int",
"make": "fun make<T>(size: Int): T",
"new": "fun new<T>(): *T",
"copy": "fun copy(target: Any, source: Any): Int",
"delete": "fun delete(map: Any, key: Any): Unit",
"close": "fun close(channel: Any): Unit",
"panic": "fun panic(value: Any): Unit",
"recover": "fun recover(): Any",
"string": "fun string(value: Any): String",
"int": "fun int(value: Any): Int",
"float64": "fun float64(value: Any): Double",
"bool": "fun bool(value: Any): Boolean",
"sql": "typed PostgreSQL query DSL",
"set": "fun set(target: Any, value: Any): Unit",
"now": "fun now(): time.Time",
"runBlocking": "fun runBlocking(block: suspend () -> Unit): Unit",
"coroutineScope": "suspend fun coroutineScope(block: suspend () -> Unit): Unit",
"launch": "suspend fun launch(block: suspend () -> Unit): Unit",
"async": "suspend fun async<T>(block: suspend () -> T): Deferred<T>",
"delay": "suspend fun delay(ms: Int): Unit",
"withTimeout": "suspend fun withTimeout(ms: Int, block: suspend () -> Unit): Unit",
"isActive": "suspend fun isActive(): Boolean",
}
func contains(values []string, needle string) bool {