From e54e844871685175175f16d4fe6b799447ebb99e Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jul 2026 13:14:26 +0200 Subject: [PATCH] Add pretty tests for async local functions The fixture had an iterator local function but no async local function; the async state-machine-in-local-function shape, static and capturing, was not covered. Assisted-by: Claude:claude-fable-5:Claude Code --- .../TestCases/Pretty/LocalFunctions.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs index 8bfdd3b1c..e12420b35 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs @@ -21,6 +21,7 @@ using System.Linq; #if CS90 using System.Runtime.InteropServices; #endif +using System.Threading.Tasks; namespace LocalFunctions { @@ -670,6 +671,32 @@ namespace LocalFunctions } } + public static async Task AsyncLocalFunction() + { + return await GetValueAsync() + await GetValueAsync(); + +#if CS80 + static async Task GetValueAsync() +#else + async Task GetValueAsync() +#endif + { + await Task.Yield(); + return 1; + } + } + + public static async Task AsyncLocalFunctionWithCapture(int n) + { + return await AddAsync(); + + async Task AddAsync() + { + await Task.Yield(); + return n + 1; + } + } + public void WriteCapturedParameter(int i) { ParamWrite();