mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
The C# 14 feature is pure source sugar: a lambda parameter may carry ref/out/in/scoped/ref readonly without declaring a type, but the IL always has fully-typed parameters, so the decompiler's explicitly-typed output is the correct round-trip. LambdaParameterModifiers pins that this round-trip works: custom delegate types with each modifier (including scoped by-value, scoped ref, and mixed parameter lists), block- and expression-bodied lambdas, captures alongside ref parameters, generic ref delegates, lambda parameter attributes, call-site modifiers (including 'in' for 'ref readonly' parameters), unused-parameter anonymous methods, and a local-function contrast. CS140-gated branches compile the untyped sugar (and attributed sugar) under Roslyn latest to prove it produces the same decompilation. ScopedLambdaParameters is Assert.Ignore'd: when an anonymous function's 'scoped ref' parameter is unused, the decompiler drops the parameter list, losing the required 'scoped' modifier; the output then fails to recompile with CS8986 because the implicit parameters of a parameter-list-less anonymous method are unscoped. The fixture is the desired output (parameter list retained); all four Roslyn 4.14/latest debug/opt configs compile it and fail only at the output comparison. Assisted-by: Claude:claude-fable-5:Claude Code