Foreach over an inline array is reconstructed (since the fix for
issue 3804) only when the receiver is a local or a by-value
parameter. Every other receiver shape leaks the unnameable
<PrivateImplementationDetails>.InlineArrayElementRef helper (or its
ReadOnly variant) into the output, which does not compile: instance,
static, and nested struct fields (the compiler emits a ref local to
the field), ref and in parameters, this inside the inline array
struct itself, and inline arrays whose element type is another
inline array. Two more shapes break only in optimized builds, where
the element load is not stored in a separate local: a loop variable
consumed directly by a call, and an unused loop variable.
The fixture is the desired output; the test is Assert.Ignore'd until
the foreach reconstruction covers these shapes. All four Roslyn
4.14/latest debug/opt configs compile the fixture and fail only at
the output comparison.
Assisted-by: Claude:claude-fable-5:Claude Code