Registry Mirror
Skip to content

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Covers ref structs implementing interfaces (implicit, explicit, and default-interface-method reimplementation, which CS9245 forces on every ref struct implementer), the allows ref struct anti-constraint on methods, classes, interfaces, delegates, local functions, iterators, async methods, and capturing local functions, constraint combinations (interface, IDisposable with using, unmanaged, struct, new()), interface members invoked through a constrained T (instance, static abstract factory, and default interface methods, which are callable through T because implementers must always override them), scoped/ref/ in/out parameters of T, and call sites instantiating with Span/ ReadOnlySpan type arguments.

The test is green in all four Roslyn 4.14/latest debug/opt configs: the decompiler already round-trips the gpAcceptByRefLike flag into "allows ref struct" clauses and re-emits ref struct interface implementations correctly. One cosmetic quirk is pinned as-is: calls whose type arguments are ref structs are printed with explicit type arguments and a declaring-type qualifier even within the declaring class, because type-argument inference validation does not accept ref struct type arguments; the output remains compilable and semantically identical.

Assisted-by: Claude:claude-fable-5:Claude Code

Covers ref structs implementing interfaces (implicit, explicit, and
default-interface-method reimplementation, which CS9245 forces on every
ref struct implementer), the allows ref struct anti-constraint on
methods, classes, interfaces, delegates, local functions, iterators,
async methods, and capturing local functions, constraint combinations
(interface, IDisposable with using, unmanaged, struct, new()),
interface members invoked through a constrained T (instance, static
abstract factory, and default interface methods, which are callable
through T because implementers must always override them), scoped/ref/
in/out parameters of T, and call sites instantiating with Span/
ReadOnlySpan type arguments.

The test is green in all four Roslyn 4.14/latest debug/opt configs: the
decompiler already round-trips the gpAcceptByRefLike flag into
"allows ref struct" clauses and re-emits ref struct interface
implementations correctly. One cosmetic quirk is pinned as-is: calls
whose type arguments are ref structs are printed with explicit type
arguments and a declaring-type qualifier even within the declaring
class, because type-argument inference validation does not accept ref
struct type arguments; the output remains compilable and semantically
identical.

Assisted-by: Claude:claude-fable-5:Claude Code
@siegfriedpammer
siegfriedpammer merged commit d7bbf17 into master Jul 29, 2026
13 checks passed
@siegfriedpammer
siegfriedpammer deleted the tests/829-allows-ref-struct branch July 29, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant