// ── AsyncIntegrationTests__Async_DotCase_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_DotCase_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test choice Reply { ok(v: int) err(msg: string) } func replyOf(n: int) -> int { let v = await Task.FromResult(n) let r = Reply.ok(v + 1) match (r: Reply) { .ok(x) { return x } .err(_) { return -1 } } return -2 } // ── AsyncIntegrationTests__Async_ObjectCreation_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_ObjectCreation_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test data Point { x: int, y: int } func buildAt(n: int) -> int { let v = await Task.FromResult(n) let p = Point { x: v, y: v * 2 } return p.x + p.y } // ── AsyncIntegrationTests__Async_StringInterpolation_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_StringInterpolation_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func greet(name: string) -> string { let hello = await Task.FromResult(name) return "hi {hello}!" } // ── AsyncIntegrationTests__Async_Throw_IL_SurfacesException ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_Throw_IL_SurfacesException topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func failIf(n: int) -> int { let v = await Task.FromResult(n) if v < 0 { throw InvalidOperationException("negative") } return v } // ── AsyncIntegrationTests__Async_TryCatch_NoAwaitInTry_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_TryCatch_NoAwaitInTry_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func safe(n: int) -> int { let v = await Task.FromResult(n) var result = 0 try { result = v * 2 } catch (Exception e) { result = -1 } return result } // ── AsyncIntegrationTests__Async_VoidAwait_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_VoidAwait_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func delayThenReturn() -> int { await Task.Delay(1) return 42 } // ── AsyncIntegrationTests__Async_WhileLoop_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::Async_WhileLoop_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func sumTo(n: int) -> int { var i = 1 var total = 0 while i <= n { let step = await Task.FromResult(i) total = total + step i = i + 1 } return total } // ── AsyncIntegrationTests__AsyncLet_SimpleTwoPending_IL_Runs ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::AsyncLet_SimpleTwoPending_IL_Runs topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func runParallel() -> int { async let a = Task.FromResult(20) async let b = Task.FromResult(22) return a + b } // ── AsyncIntegrationTests__AsyncLet_SyncUserFunc_IL_WrapsInTaskRun ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: AsyncIntegrationTests.cs::AsyncLet_SyncUserFunc_IL_WrapsInTaskRun topic: async status: verified // verified behavior: reports diagnostic ES3004 namespace Test func compute(n: int) -> int { return n * 10 } func runBoth() -> int { async let a = compute(4) async let b = compute(3) return a + b } // ── FeatureMixingTests__Axis1_AsyncEvalRefChoice_TryCatchAroundAwait ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis1_AsyncEvalRefChoice_TryCatchAroundAwait topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test ref choice Expr { literal(value: int) add(left: Expr, right: Expr) fail(reason: string) } func eval(e: Expr) -> int { match (e: Expr) { .literal(lit) { let v = await Task.FromResult(lit.value) return v } .add(a) { let l = eval(a.left) let r = eval(a.right) return l + r } .fail(f) { throw InvalidOperationException(f.reason) } } return -1 } func run() -> int { let tree = Expr_add { left: Expr_literal { value: 3 }, right: Expr_fail { reason: "no" } } var result = 0 try { result = await eval(tree) } catch (Exception e) { result = -42 } return result } // ── FeatureMixingTests__Axis1_AsyncMatch_AwaitInEveryArm ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis1_AsyncMatch_AwaitInEveryArm topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test ref choice Cmd { one(n: int) two(a: int, b: int) three(s: string) } func handle(c: Cmd) -> int { match (c: Cmd) { .one(o) { let v = await Task.FromResult(o.n) return v + 1 } .two(t) { let a = await Task.FromResult(t.a) let b = await Task.FromResult(t.b) return a + b } .three(t) { let s = await Task.FromResult(t.s) return s.Length } } return -1 } func one() -> int = await handle(Cmd_one { n: 41 }) func two() -> int = await handle(Cmd_two { a: 10, b: 20 }) func three() -> int = await handle(Cmd_three { s: "hello" }) // ── FeatureMixingTests__Axis1_AsyncResultMatch_TryCatchInsideArm ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis1_AsyncResultMatch_TryCatchInsideArm topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func parseAsync(s: string) -> int { let v = await Task.FromResult(int.Parse(s)) return v } func safeParse(s: string) -> Result { var n = 0 try { n = await parseAsync(s) } catch (Exception e) { return error("bad: {e.Message}") } return ok(n) } func runOk() -> int { let r = await safeParse("42") match (r: Result) { .ok(v) { return v } .err(_) { return -1 } } return -2 } func runErr() -> int { let r = await safeParse("nope") match (r: Result) { .ok(_) { return -1 } .err(_) { return 99 } } return -2 } // ── FeatureMixingTests__Axis2_SpawnPtrCapture_ChanCloseInDefer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis2_SpawnPtrCapture_ChanCloseInDefer topic: async status: verified // verified behavior: Test.run(...) == 9 namespace Test data State { var produced: int } func run() -> int { var s: *State = new State { produced: 0 } let ch = chan(4) let producer = spawn { defer { ch.Close() } ch.Send(1) ch.Send(2) ch.Send(3) s.produced = 3 } producer.Join() var total = 0 for v in ch { total += v } return total + s.produced } // ── FeatureMixingTests__Axis7_AsyncLet_FirstError_ShortCircuitsViaQuestion ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis7_AsyncLet_FirstError_ShortCircuitsViaQuestion topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func loadAsync(n: int) -> Result { let v = await Task.FromResult(n) if v < 0 { return error("neg") } return ok(v) } func combine() -> Result { async let a = loadAsync(5) async let b = loadAsync(0 - 1) let av = a? let bv = b? return ok(av + bv) } // ── FeatureMixingTests__Axis7_AsyncLet_ResultOk_ImplicitAwaitThenUnwrap ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis7_AsyncLet_ResultOk_ImplicitAwaitThenUnwrap topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func loadAsync(n: int) -> Result { let v = await Task.FromResult(n) if v < 0 { return error("neg:{v}") } return ok(v * 10) } func combine() -> Result { async let a = loadAsync(2) async let b = loadAsync(3) let av = a? let bv = b? return ok(av + bv) } // ── ILEmitterTests__AsyncIL_EmitsStateMachineStruct ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::AsyncIL_EmitsStateMachineStruct topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func fetchValue() -> int { let result = await Task.FromResult(42) return result } // ── ILEmitterTests__AsyncIL_TaskFromResult_ProducesCorrectValue ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::AsyncIL_TaskFromResult_ProducesCorrectValue topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func getValue() -> int { let result = await Task.FromResult(42) return result } // ── ILEmitterTests__AsyncIL_VoidFunction_ReturnsValueTask ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::AsyncIL_VoidFunction_ReturnsValueTask topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func doWork() { await Task.Delay(1) } // ── ILEmitterTests__Await_Transpiler_EmitsAsyncSignature ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Await_Transpiler_EmitsAsyncSignature topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func fetchData() -> string { let result = await Task.FromResult("hello") return result } // ── ILEmitterTests__Chan_Buffered_Creation_ReturnsRuntimeChan ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Chan_Buffered_Creation_ReturnsRuntimeChan topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func make() -> Chan { let ch = chan(4) return ch } // ── ILEmitterTests__Chan_OfUserChoice_ParameterSendFromArg ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Chan_OfUserChoice_ParameterSendFromArg topic: async status: verified // verified behavior: Test.run(...) == 7 namespace Test choice Evt { ping(n: int) done } func run() -> int { let feed = chan(8) feed.Send(Evt.ping(5)) feed.Close() return 7 } // ── ILEmitterTests__Chan_SendAndTryReceive_SynchronousRoundTrip ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Chan_SendAndTryReceive_SynchronousRoundTrip topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func echo(x: int) -> bool { let ch = chan(1) ch.Send(x) return true } // ── ILEmitterTests__Chan_Unbuffered_Creation_DefaultsToZeroCapacity ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Chan_Unbuffered_Creation_DefaultsToZeroCapacity topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func make() -> Chan { let ch = chan(0) return ch } // ── ILEmitterTests__Spawn_CallsHelperWithCapturedChan ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Spawn_CallsHelperWithCapturedChan topic: async status: verified // verified behavior: Test.run(...) == 6 namespace Test func send3(ch: chan) { ch.Send(1) ch.Send(2) ch.Send(3) ch.Close() } func run() -> int { let ch = chan(4) let producer = spawn { send3(ch) } producer.Join() var total = 0 for v in ch { total += v } return total } // ── ILEmitterTests__Spawn_CapturesChanOfUserChoice_CallsHelper ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Spawn_CapturesChanOfUserChoice_CallsHelper topic: async status: verified // verified behavior: Test.run(...) == 7 namespace Test choice Evt { ping(n: int) done } func produce(ch: chan) { ch.Send(Evt.ping(1)) ch.Send(Evt.ping(2)) ch.Close() } func run() -> int { let feed = chan(8) let job = spawn { produce(feed) } job.Join() return 7 } // ── ILEmitterTests__Spawn_WithChanCapture_ProducerConsumer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Spawn_WithChanCapture_ProducerConsumer topic: async status: verified // verified behavior: Test.run(...) == 6 namespace Test func run() -> int { let ch = chan(4) let producer = spawn { ch.Send(1) ch.Send(2) ch.Send(3) ch.Close() } producer.Join() var total = 0 for v in ch { total += v } return total } // ── ILEmitterTests_AsyncLetMix__ExternalAwaitable_TaskFromResult ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::ExternalAwaitable_TaskFromResult topic: async status: verified // compiles cleanly (no auto-run claim was extracted) func combine() -> int { async let a = Task.FromResult(20) async let b = Task.FromResult(22) return a + b } // ── ILEmitterTests_AsyncLetMix__PlainAwait_AsyncUserFn ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::PlainAwait_AsyncUserFn topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test // ── ILEmitterTests_AsyncLetMix__QuestionPropagation_InAsync_ErrorPath ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::QuestionPropagation_InAsync_ErrorPath topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func loadAsync(n: int) -> Result { let v = await Task.FromResult(n) if v < 0 { return error("neg") } return ok(v * 10) } func run() -> Result { let r = await loadAsync(0 - 5) let v = r? return ok(v + 1) } // ── ILEmitterTests_AsyncLetMix__QuestionPropagation_InAsync_OkPath ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::QuestionPropagation_InAsync_OkPath topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func loadAsync(n: int) -> Result { let v = await Task.FromResult(n) if v < 0 { return error("neg") } return ok(v * 10) } func run() -> Result { let r = await loadAsync(4) let v = r? return ok(v + 1) } // ── ILEmitterTests_AsyncParity__Added_AwaitArithmeticResult ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_AwaitArithmeticResult topic: async status: verified // verified behavior: Test.sum(...) == 15 namespace Test func sum() -> int { let a = await Task.FromResult(5) let b = await Task.FromResult(10) return a + b } // ── ILEmitterTests_AsyncParity__Added_AwaitInsideIf ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_AwaitInsideIf topic: async status: verified // verified behavior: Test.pick(...) == 1 namespace Test func pick(b: bool) -> int { if b { let x = await Task.FromResult(1) return x } return 0 } // ── ILEmitterTests_AsyncParity__Added_Default_AwaitChain_Value ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_Default_AwaitChain_Value topic: async status: verified // verified behavior: Test.b(...) == 12 namespace Test func a() -> int { let x = await Task.FromResult(10) return x } func b() -> int { let y = await a() return y + 2 } // ── ILEmitterTests_AsyncParity__Added_DefaultAsync_IsValueTask ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_DefaultAsync_IsValueTask topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func compute() -> int { let x = await Task.FromResult(40) return x + 2 } // ── ILEmitterTests_AsyncParity__Added_ExplicitVoid_AsyncVoid ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_ExplicitVoid_AsyncVoid topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func handler() -> void { await Task.Delay(1) } // ── ILEmitterTests_AsyncParity__Added_NonGenericTask_Void ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_NonGenericTask_Void topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func run() -> Task { await Task.Delay(1) } // ── ILEmitterTests_AsyncParity__Added_TaskOfT_AwaitedToValue ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_TaskOfT_AwaitedToValue topic: async status: verified // verified behavior: Test.use(...) == 8 namespace Test func get() -> Task { let x = await Task.FromResult(8) return x } func use() -> int { let v = await get() return v } // ── ILEmitterTests_AsyncParity__Added_TaskOfT_ReturnsTaskType ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Added_TaskOfT_ReturnsTaskType topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func fetch() -> Task { let x = await Task.FromResult(7) return x } // ── ILEmitterTests_AsyncParity__AsyncStream_Parameterized_LoopYield_Streams ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::AsyncStream_Parameterized_LoopYield_Streams topic: async status: verified // verified behavior: Test.range(...) == 10 namespace Test func range(n: int) -> IAsyncEnumerable { var i = 0 while i < n { yield i i += 1 } } // ── ILEmitterTests_AsyncParity__AsyncStream_YieldAndAwait_Streams ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::AsyncStream_YieldAndAwait_Streams topic: async status: verified // verified behavior: Test.nums(...) == 141 namespace Test func nums() -> IAsyncEnumerable { yield 1 let x = await Task.FromResult(40) yield x yield 100 } // ── ILEmitterTests_AsyncParity__ExplicitVoid_Await_EmitsAsyncVoid ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::ExplicitVoid_Await_EmitsAsyncVoid topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func handler() -> void { let _ = await Task.FromResult(0) } // ── ILEmitterTests_AsyncParity__OmittedReturn_Await_StaysValueTask ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::OmittedReturn_Await_StaysValueTask topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func handler() { let _ = await Task.FromResult(0) } // ── ILEmitterTests_AsyncParity__Task_Void_EmitsTaskReturn ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::Task_Void_EmitsTaskReturn topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func ping() -> Task { let _ = await Task.FromResult(0) } // ── ILEmitterTests_AsyncParity__TaskOfT_EmitsTaskReturn ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::TaskOfT_EmitsTaskReturn topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func compute() -> Task { let x = await Task.FromResult(40) return x + 2 } // ── ILEmitterTests_AsyncParity__TaskOfT_RunsAndComposesWithBcl ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::TaskOfT_RunsAndComposesWithBcl topic: async status: verified // verified behavior: Test.two(...) == 10 namespace Test func one() -> Task { let x = await Task.FromResult(4) return x + 1 } func two() -> Task { let y = await one() return y + 5 } // ── ILEmitterTests_AsyncParity__ValueTaskOfT_Explicit_EmitsValueTask ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncParity.cs::ValueTaskOfT_Explicit_EmitsValueTask topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func compute() -> ValueTask { let x = await Task.FromResult(7) return x } // ── ILEmitterTests_Coverage_Misc__AsyncLet_Fanout ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_Coverage_Misc.cs::AsyncLet_Fanout topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func go() -> int { async let a = Task.FromResult(20) async let b = Task.FromResult(22) return a + b } // ── ILEmitterTests_Coverage_Misc__Await_TaskFromResult ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_Coverage_Misc.cs::Await_TaskFromResult topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func go() -> int { let v = await Task.FromResult(42) return v } // ── ILEmitterTests_Coverage_Misc__Await_TwoSequential ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_Coverage_Misc.cs::Await_TwoSequential topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func go() -> int { let a = await Task.FromResult(10) let b = await Task.FromResult(20) return a + b } // ── ILEmitterTests_Coverage_Misc__Spawn_ChannelProducerConsumer ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_Coverage_Misc.cs::Spawn_ChannelProducerConsumer topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test func go() -> int { let ch = chan(8) let producer = spawn { ch.Send(1) ch.Send(2) ch.Send(3) ch.Close() } producer.Wait() var total = 0 for v in ch { total += v } return total } // ── ILEmitterTests_Coverage_Misc__TaskFunc_SpawnAndWait ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_Coverage_Misc.cs::TaskFunc_SpawnAndWait topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() -> int { return 42 } func go() -> int { let job = produce() return job.Wait() } // ── ILEmitterTests_TaskFunc__TaskFunc_Body_Computes_Arithmetic ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Body_Computes_Arithmetic topic: async status: verified // verified behavior: Test.null(...) == 13 namespace Test task func sum() -> int { let a = 3 let b = 4 return a * b + 1 } // ── ILEmitterTests_TaskFunc__TaskFunc_Call_Site_Returns_Job_Typed_Result_To_Caller ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Call_Site_Returns_Job_Typed_Result_To_Caller topic: async status: verified // verified behavior: Test.caller(...) == 5 namespace Test task func produce() -> int { return 5 } func caller() -> int { let j = produce() return j.Wait() } // ── ILEmitterTests_TaskFunc__TaskFunc_Captures_Let_Across_Boundary_Compiles ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Captures_Let_Across_Boundary_Compiles topic: async status: verified // verified behavior: Test.caller(...) == 11 namespace Test task func produce() -> int { let x = 11 return x } func caller() -> int { return produce().Wait() } // ── ILEmitterTests_TaskFunc__TaskFunc_Job_Cancel_Available ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Job_Cancel_Available topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() -> int { return 1 } // ── ILEmitterTests_TaskFunc__TaskFunc_Multiple_Awaits_Sum_To_Expected ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Multiple_Awaits_Sum_To_Expected topic: async status: verified // verified behavior: Test.caller(...) == 60 namespace Test task func first() -> int { return 10 } task func second() -> int { return 20 } task func third() -> int { return 30 } func caller() -> int = first().Wait() + second().Wait() + third().Wait() // ── ILEmitterTests_TaskFunc__TaskFunc_Multiple_TaskFuncs_In_Same_File ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Multiple_TaskFuncs_In_Same_File topic: async status: verified // verified behavior: Test.caller(...) == 5 namespace Test task func two() -> int { return 2 } task func three() -> int { return 3 } func caller() -> int { return two().Wait() + three().Wait() } // ── ILEmitterTests_TaskFunc__TaskFunc_Returns_Boolean_Job ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Returns_Boolean_Job topic: async status: verified // verified behavior: Test.null(...) == true namespace Test task func check() -> bool { return true } // ── ILEmitterTests_TaskFunc__TaskFunc_Returns_String_Job ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Returns_String_Job topic: async status: verified // verified behavior: Test.null(...) == "ok" namespace Test task func tag() -> string { return "ok" } // ── ILEmitterTests_TaskFunc__TaskFunc_Returns_Synonym_Also_Works ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Returns_Synonym_Also_Works topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() returns int { return 7 } // ── ILEmitterTests_TaskFunc__TaskFunc_Two_Independent_Tasks_Wait_Independently ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Two_Independent_Tasks_Wait_Independently topic: async status: verified // verified behavior: Test.caller(...) == 300 namespace Test task func one() -> int { return 100 } task func two() -> int { return 200 } func caller() -> int = one().Wait() + two().Wait() // ── ILEmitterTests_TaskFunc__TaskFunc_Typed_Parses_And_Emits_JobT_Return ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Typed_Parses_And_Emits_JobT_Return topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() -> int { return 42 } // ── ILEmitterTests_TaskFunc__TaskFunc_Var_Capture_In_Function_Literal_Reports_ES2130 ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Var_Capture_In_Function_Literal_Reports_ES2130 topic: async status: verified // verified behavior: reports diagnostic ES2130 namespace Test task func go() { var counter = 0 let bump = func() { counter = counter + 1 } bump() } // ── ILEmitterTests_TaskFunc__TaskFunc_Void_Returns_Job_That_Completes ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Void_Returns_Job_That_Completes topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func ping() { } // ── ILEmitterTests_TaskFunc__TaskFunc_Wrapper_Calls_Job_Spawn ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Wrapper_Calls_Job_Spawn topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() -> int { return 7 } // ── ILEmitterTests_TaskFunc__TaskFunc_Wrapper_Invokes_Inner ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Wrapper_Invokes_Inner topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Test task func produce() -> int { return 99 } // ── TranspilerTests__Transpiles_Chan_Creation ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: TranspilerTests.cs::Transpiles_Chan_Creation topic: async status: verified // compiles cleanly (no auto-run claim was extracted) namespace Audit pub func makeChan() -> Chan { let ch = chan(256) return ch } // ── EmitterStressTests__AsyncWithTupleReturnAndForDestructuring ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: EmitterStressTests.cs::AsyncWithTupleReturnAndForDestructuring topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace T func work() -> (List, List) { var items = List() var errors = List() return (items, errors) } func run() { var tasks = List, List)>>() tasks.Add(Task.Run(func() -> (List, List) { return work() })) let results = await Task.WhenAll(tasks.ToArray()) for (items, errors) in results { let n = items.Count + errors.Count } } // ── EmitterStressTests__RefDataWithAsyncMethodAndTryCatch ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: EmitterStressTests.cs::RefDataWithAsyncMethodAndTryCatch topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace T data Item(title: string, source: string) func fetchItems(client: HttpClient, url: string) -> (List, List) { var items = List() var errors = List() try { let stream = await client.GetStreamAsync(url) items.Add(Item("title", "src")) } catch (Exception ex) { errors.Add(ex.Message) } return (items, errors) } // ── EmitterStressTests__RefDataWithMultipleMethodsAndExpressionBodies ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: EmitterStressTests.cs::RefDataWithMultipleMethodsAndExpressionBodies topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace T data Config(name: string, url: string) data Item(title: string, source: string) data Status(name: string, itemCount: int) ref data Svc { configs: List items: List statuses: List client: HttpClient maxItems: int init() { self.configs = List() self.items = List() self.statuses = List() self.client = HttpClient() self.maxItems = 500 } func poll() { var tasks = List, List)>>() for cfg in self.configs { let c = self.client let f = cfg tasks.Add(Task.Run(func() -> (List, List) { return (List(), List()) })) } let results = await Task.WhenAll(tasks.ToArray()) var all = List() var statuses = List() var i = 0 for (items, errors) in results { let cfg = self.configs[i] i += 1 let err = errors.Count > 0 ? errors[0] : "" statuses.Add(Status(cfg.name, items.Count)) all.AddRange(items) } if all.Count > self.maxItems { all.RemoveRange(self.maxItems, all.Count - self.maxItems) } self.items = all self.statuses = statuses } func count() -> int = self.items.Count func addConfig(name: string, url: string) = self.configs.Add(Config(name, url)) } // ── FeatureMixingTests__Axis1_AsyncResultMatch_BadPattern_DiagnosesUnawaitedAsyncCall ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: FeatureMixingTests.cs::Axis1_AsyncResultMatch_BadPattern_DiagnosesUnawaitedAsyncCall topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test func parseAsync(s: string) -> int { let v = await Task.FromResult(int.Parse(s)) return v } func safeParse(s: string) -> Result { let n = parseAsync(s) return ok(n) } // ── ILEmitterTests__Await_Binder_SetsHasAwait ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Await_Binder_SetsHasAwait topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test func fetch() -> string { let x = await someCall() return x } // ── ILEmitterTests__Await_Parser_ParsesAwaitExpression ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Await_Parser_ParsesAwaitExpression topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test func fetch() -> string { let x = await someTask() return x } // ── ILEmitterTests__Emit_AsyncFunctionWithAwait ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Emit_AsyncFunctionWithAwait topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace T func fetch() -> Task { let client = HttpClient() let result = await client.GetStringAsync("http://example.com") return result } // ── ILEmitterTests__Emit_ComplexRefDataWithAsyncAndLambdas ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Emit_ComplexRefDataWithAsyncAndLambdas topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace T func work() -> (List, List) { var items = List() var errors = List() return (items, errors) } func run() { var tasks = List, List)>>() tasks.Add(Task.Run(func() -> (List, List) { return work() })) let results = await Task.WhenAll(tasks.ToArray()) } // ── ILEmitterTests__Select_WithDefault_NoneReady_TakesDefault ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Select_WithDefault_NoneReady_TakesDefault topic: async status: unverified // verified behavior: Test.run(...) == 99 namespace Test func run() -> int { let ch = chan(1) var fired = 0 select { .recv(v, ch) { fired = 1 } default { fired = 99 } } return fired } // ── ILEmitterTests__Select_WithDefault_OneReady_TakesThatArm ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests.cs::Select_WithDefault_OneReady_TakesThatArm topic: async status: unverified // verified behavior: Test.run(...) == 42 namespace Test func run() -> int { let ch = chan(1) ch.Send(42) var got = 0 select { .recv(v, ch) { got = v } default { got = 99 } } return got } // ── ILEmitterTests_AsyncLetMix__AsyncLet_OrderIndependentUse ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncLet_OrderIndependentUse topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(1) async let b = loadAsync(2) let bv = b? let av = a? return ok(av + bv) } // ── ILEmitterTests_AsyncLetMix__AsyncLet_ResultInterpolatedAfterUnwrap ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncLet_ResultInterpolatedAfterUnwrap topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(2) async let b = loadAsync(2) let av = a? let bv = b? let total = av + bv return ok(total) } // ── ILEmitterTests_AsyncLetMix__AsyncLet_SecondError_Propagates ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncLet_SecondError_Propagates topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(3) async let b = loadAsync(0 - 9) let av = a? let bv = b? return ok(av + bv) } // ── ILEmitterTests_AsyncLetMix__AsyncUserFn_FirstError_ShortCircuits ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncUserFn_FirstError_ShortCircuits topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(5) async let b = loadAsync(0 - 1) let av = a? let bv = b? return ok(av + bv) } // ── ILEmitterTests_AsyncLetMix__AsyncUserFn_SingleAsyncLet ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncUserFn_SingleAsyncLet topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(7) let av = a? return ok(av) } // ── ILEmitterTests_AsyncLetMix__AsyncUserFn_ThreePending ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncUserFn_ThreePending topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(1) async let b = loadAsync(2) async let c = loadAsync(3) let av = a? let bv = b? let cv = c? return ok(av + bv + cv) } // ── ILEmitterTests_AsyncLetMix__AsyncUserFn_TwoPending_OkFold ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::AsyncUserFn_TwoPending_OkFold topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) func combine() -> Result { async let a = loadAsync(2) async let b = loadAsync(3) let av = a? let bv = b? return ok(av + bv) } // ── ILEmitterTests_AsyncLetMix__SyncUserFn_AsyncLet_Compiles ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_AsyncLetMix.cs::SyncUserFn_AsyncLet_Compiles topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test func compute(n: int) -> int = n * 2 func combine() -> int { async let a = compute(4) async let b = compute(3) return a + b } // ── ILEmitterTests_TaskFunc__TaskFunc_Let_Capture_In_Function_Literal_Is_OK ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_Let_Capture_In_Function_Literal_Is_OK topic: async status: unverified // verified behavior: reports diagnostic ES2130 namespace Test task func go() { let value = 7 let read = func() -> int { return value } let v = read() } // ── ILEmitterTests_TaskFunc__TaskFunc_With_Parameters_Reports_NotYetSupported ── // E# — a verified example from the E# language corpus (CLR language; .es, not ECMAScript). // provenance: ILEmitterTests_TaskFunc.cs::TaskFunc_With_Parameters_Reports_NotYetSupported topic: async status: unverified // compiles cleanly (no auto-run claim was extracted) namespace Test task func with_arg(n: int) -> int { return n }